---
agentTools:
  projectIndex: https://onebrick.readme.io/llms.txt
---

# Dynamic QRIS

Dynamic QRIS Merchant creation Clients need to create main merchant first to use QRIS products, You can get the step-by-step process here to generate the merchant.

## Dynamic QRIS

### Merchant creation

Clients need to create main merchant first to use QRIS products, You can get the step-by-step process [here](https://onebrick.readme.io/reference/registering-for-qris) to generate the merchant. Once the merchant is verified, 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:

```curl
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:

```json
{
    "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.

```json Callback Response - Paid
{
  "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 QRIS callback URL
>
> For now setting up callback QRIS need to be done manually. You can contact Brick team to setup your QRIS callback URL.

### 3. Status check for QR Codes

This APIs will help clients to initialize the status update from their side. They have to pass on the transactions referenceId and gets the update.

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

You will get the response like below

```json
{
    "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
}
```

QRIS status available are processing, paid, expired, and cancelled.

### 4. Cancel the QR Codes

This APIs will help to cancel the QRIS so that it can't be use.

```curl
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.

```json
{
    "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
}
```