Purchase
API Information
- This API is used to process payments through the SDK using an iframe.
- Payments may fail if the user still has outstanding bills.
Request Via Iframe
Things to prepare:
client idandsecret keyhave been obtained through the back office
Generated Payload
info
The payload data sent will be converted into json_encode(base64_encode(bin2hex(payload)))
Data
| Key | Type | Description | Example |
|---|---|---|---|
| client_id | String | client id user | merchant123 |
| secret_key | String | secret key user | a144981427cdcd89588a98603f14fb3f12 |
| data | Object | The product data to be paid. | Example Payload |
Data Produk
| Key | Type | Description | Example |
|---|---|---|---|
| date | String Datetime | Payment time | "2022-12-18 02:03:05 |
| product | String | Priduct name | Lenovo Thinkpad |
| description | String | Description product | Laptop Thinkpad versi T460s tahun 2017 |
| merchant | String | Name merchant | merchant A |
| amount | String | Total product price | 10000000 |
| additional_data | Object | Additonal data | json {"alamat": "Foo"} |
Example
Sample request
- javascript
const data = {
"client_id": "merchant123",
"secret_key": "a144981427cdcd89588a98603f14fb3f12",
"data": {
"date": "2022-12-18 02:03:05",
"product": "Lenovo Thinkpad",
"description": "Laptop Thinkpad version T460s year 2017",
"merchant": "Merchant A",
"amount": "10000000",
"additional_data": {
"Alamat": "Foo"
}
}
};
const jsonData = JSON.stringify(data);
const base64Data = btoa(jsonData);
const generatedPayload = Buffer.from(base64Data, 'base64').toString('hex');
return generatedPayload
Send Data Payload Via Iframe
| METHOD | PATH | EXAMPLE |
|---|---|---|
| GET | /main-page/data= | https://web-sdk.speedpay.id/main-page/data={generated payload} |
Example Reuest
Sample request
- javascript
<iframe src="https://web-sdk.speedpay.id/main-page/data=42427cdcd89587cdcd89427cdcd895858..." frameborder="0" class="w-full"></iframe>
Example Response
