Skip to main content

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 id and secret key have been obtained through the back office

Generated Payload

info

The payload data sent will be converted into json_encode(base64_encode(bin2hex(payload)))

Data

KeyTypeDescriptionExample
client_idStringclient id usermerchant123
secret_keyStringsecret key usera144981427cdcd89588a98603f14fb3f12
dataObjectThe product data to be paid.Example Payload

Data Produk

KeyTypeDescriptionExample
dateString DatetimePayment time"2022-12-18 02:03:05
productStringPriduct nameLenovo Thinkpad
descriptionStringDescription productLaptop Thinkpad versi T460s tahun 2017
merchantStringName merchantmerchant A
amountStringTotal product price10000000
additional_dataObjectAdditonal datajson {"alamat": "Foo"}

Example

Sample request
    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

METHODPATHEXAMPLE
GET/main-page/data=https://web-sdk.speedpay.id/main-page/data={generated payload}

Example Reuest

Sample request
    <iframe src="https://web-sdk.speedpay.id/main-page/data=42427cdcd89587cdcd89427cdcd895858..." frameborder="0" class="w-full"></iframe>

Example Response

response example