post
https://{URL}/v1/open-api/products/buy
This method involves a POST request that initiates a transaction to purchase a product from Klikoo's B2B inventory.
A. Request Header
| Field | Format | Mandatory | Length | Example |
|---|---|---|---|---|
| Content-Type | string | Y | application/json | |
| Open-Api-Timestamp | yyyy-mm-dd'T'hh:mm:ss+07:00 | Y | 2024-02-07T10:28:35.000+07:0 | |
| Open-Api-Signature | Digital Signature | Y | 88 | vNMoAmiDRV+paVyD5FaidgI5kRy2p Co8oEoQN/GBpIPuO3eicY63b7xY0W DffScvkOZsZ1442ewabI7Wzd22pw== |
B. Request Body
| Field | Type | Description | Required | Example |
|---|---|---|---|---|
| amount | string | The buy price from the partner to Klikoo. The amount will deduct the partner’s balance on Klikoo when the transaction status is success | true | "1" |
| product_code | string | Unique identifier for the product | true | "DNOPEN" |
| selling_price | string | The selling price of the product from the partner. This value is required to calculate the margin value to be shown on the dashboard. It can be set as same as amount if you wouldn’t like to show the margin on the dashboard | true | "2" |
| value | string | Represents the destination number, customer phone number, customer ID, or driver ID | true | "08996647676" |
| msidn | string | In most cases, the msisdn field should be populated with the value. However, for postpaid BPJS products, this field must specifically contain the customer's phone number. | true | "08996647676" |
| partner_reference_id | string | The unique reference identifier provided by the partner or service invoking the transaction, recommended value is UUID v4 | true | “6d654219-d9b7-4e1a-8b51-99a5cafb11cb” |
C. Sample Request
{
"amount": "1",
"msidn": "08996647676",
"product_code": "DNOPEN",
"selling_price": "2",
"value": "089966476766",
"partner_reference_id": "d654219-d9b7-4e1a-8b51-99a5cafb11cb" //This is just an example, please use your UUID v4 for this part.
}
D. Response Body
| Field | Type | Description | Example |
|---|---|---|---|
| response_code | string | Contains the OpenAPI response code | “201022001” |
| response_message | string | Contains the value of OpenAPI response message | “Berhasil dibuat” |
| data | object | The object containing transaction info | |
| transaction_id | string | The value of transaction’s id | "14429004" |
| status | string | The value of transaction’s status. Possible value for Status: "WAITING" "SUCCESS" "FAILED" | "WAITING" |
| sn | string | The value of transaction’s serial number | “223731” |
E. Sample Response Success
{
"response_code": "201022001",
"response_message": "Berhasil dibuat",
"data": {
"transaction_id": "14429004",
"status": "WAITING",
"sn": "223731"
}
}
F. Sample Response Failed
{
"data": null,
"response_code": "422026558",
"response_message": "Dompet tidak cukup"
}
Try It Here (Form)
To try the following endpoint, enter the example request data you want to use in the following form