Brick API Documentation
Dynamic QR Code

Dynamic QR Code

Dynamic QR Code is a Brick QRIS payment flow for creating a one-time QR code with a predefined amount. Use Dynamic QR Code when each QRIS payment should map to a specific order, invoice, checkout, or transaction reference.

Before using Dynamic QR Code, create and verify a QR Code merchant. See Registering for QR Code, then follow the integration process below.

Integration Guides

1. Generating a dynamic QR code

To start generating Dynamic QR codes, you can use Dynamic QR API with these details:

Code
curl --location 'https://sandbox.onebrick.io/v2/payments/gs/qris/dynamic' \ --header 'publicAccessToken: Bearer {{publicAccessToken}}' \ --header 'Content-Type: application/json' \ --data '{ "referenceId":"test-qris-sandbox", "amount":10000, "validityPeriod":"86400" }'

You will get the responses like below when successful:

JSONCode
{ "status": 200, "data": { "message": "We have successfully generated the dynamic qris", "id":"QR_XXXX", "referenceId": "test-qris-sandbox", "amount": 10000, "createdAt": "2024-01-16T17:00:00.000+07:00", "expiredAt": "2024-01-17T17:00:00.000+07:00", "qrData": "XXXX" }, "metaData": { "source": "API", "entity": "Payment" }, "error": null }

2. Callback Notification

Brick notifies you when the user has already made the payment via callbacks.

The callback will be received once payment is made by the end user.

JSONCode
{ "data": { "id": "QR_XXXX", "referenceId": "XXXX", "amount": 11000, "status": "PAID", "createdAt": "2024-03-13T16:58:37.000+07:00", "paidAt": "2024-03-13T23:58:58.000+07:00", "qrisType": "DYNAMIC", "merchant": "merchant_name", "merchantNmid": "merchant_Nmid" } }

📘 Setting up your QR Code callback URL

For now setting up callback QR Code need to be done manually. You can contact Brick team to setup your QR Code callback URL.

3. Status Check for QR Codes

Use the status endpoint to retrieve the latest Dynamic QR Code status by passing the transaction referenceId.

Code
curl --location 'https://sandbox.onebrick.io/v2/payments/gs/qris/dynamic/{{referenceId}}' \ --header 'publicAccessToken: Bearer {{publicAccessToken}}'

You will get the response like below

JSONCode
{ "status": 200, "data": { "referenceId": "XXXX", "id": "QR_XXXX", "amount": 10000, "status": "completed", "qrData": "XXXX", "paidAt": "2024-03-09T00:53:07.000+07:00", "type": "DYNAMIC", "merchant": "merchant_name", "merchantNmid": "merchant_Nmid" }, "metaData": { "source": "API", "entity": "Payment" }, "error": null }

QR Code status available are processing, paid, expired, and cancelled.

4. Cancel the QR Codes

Use this endpoint to cancel a Dynamic QR Code so it can no longer be used.

Code
curl --location --request POST 'https://sandbox.onebrick.io/v2/payments/gs/qris/dynamic/{{referenceId}}/cancel' \ --header 'publicAccessToken: Bearer {{publicAccessToken}}'

You will get a response like below.

JSONCode
{ "status": 200, "data": { "message": "We have successfully cancel the qris", "id": "QR_XXXX", "referenceId": "test-qris-sandbox", "cancelledAt": "2024-01-20T17:00:00.000+07:00", }, "metaData": { "source": "API", "entity": "Payment" }, "error": null }
Last modified on