Below are the steps on how to create QR Code via API in test mode:
1. Create secret API Key on your dashboard in test mode
Reference can be found in this doc.
2. Set your test callback URL in Dashboard - Settings - Callbacks in QR code paid & refunded and make sure upon "test and save" it returns 2XX
3. Create QR Code API using endpoint:
POST https://api.xendit.co/qr_codes
4. Input you secret API key in Authorization
5. In Headers please input below on this section:
KEY: api-version
VALUE: 2022-07-31
6. In Body request, you can use these parameters as sample:
{
"reference_id": "testing_id_1669118631",
"type": "DYNAMIC",
"currency": "IDR",
"amount": 1000
}
{
"reference_id": "testing_id_1669118631",
"type": "DYNAMIC",
"currency": "IDR",
"channel_code": "ID_LINKAJA",
"amount": 1000,
"expires_at": null,
"description": "",
"metadata": null,
"business_id": "6253abec9547485c4a838dbe",
"created": "2022-11-22T12:03:53.627576Z",
"updated": "2022-11-22T12:03:53.627576Z",
"qr_string": "some-random-qr-string",
"status": "ACTIVE",
"id": "qr_9bd909fd-422a-4a43-bd49-958edf383f6d"
}
8. Simulate the QR Code payment using this endpoint:
POST https://api.xendit.co/id/payments/simulate
In Headers please input below on this section:
KEY: api-version
VALUE: 2022-07-31
Input your QR Code ID (which in this case qr_9bd909fd-422a-4a43-bd49-958edf383f6d) in the request endpoint and click send.
PS: If you create static QR Code, then you need to put amount in the body request instead of empty
Afterwards you will get this response and the transaction will pop up in Transaction Tab
{
"id": "qrpy_f83566a0-81e6-4e4a-8677-44320f9fa7d3",
"business_id": "6253abec9547485c4a838dbe",
"currency": "IDR",
"amount": 1000,
"status": "SUCCEEDED",
"created": "2022-11-22T12:04:53.078011Z",
"qr_id": "qr_9bd909fd-422a-4a43-bd49-958edf383f6d",
"qr_string": "some-random-qr-string",
"reference_id": "testing_id_1669118631",
"type": "DYNAMIC",
"channel_code": "ID_LINKAJA",
"expires_at": null,
"basket": null,
"metadata": null,
"payment_detail": {
"receipt_id": null,
"source": null,
"name": null,
"account_details": null
}
}
And simulation is done!
For video of the QR Code creation steps above in test mode (via Postman), check the video below:
For API reference please click here
For steps on how to create QR Code with API in live mode, refer to this article.