Send Money

Our new version of APIs(v2) is callback-based APIs, So if you have not set up a callback URL till now, Please set itDisbursement callback URL from brick dashboard.

This endpoint helps you to send money to the desired account, We suggest following this step after Step 2 because Step 2 can help you to reduce the risk of sending money to the wrong account.

You can use JWT / public access token that was generated in Step 1 to do the disbursement.

curl --request POST \
     --url https://sandbox.onebrick.io/v2/payments/gs/disbursements \
     --header 'accept: application/json' \
     --header 'content-type: application/json' \
     --header 'publicAccessToken: Bearer {{publicAccessToken}}' \
     --data '
{
     "referenceId": "test-disbursement-1",
     "description": "test-disbursement-1",
     "amount": 10000,
     "disbursementMethod": {
          "type": "bank_transfer",
          "bankShortCode": "MANDIRI",
          "bankAccountNo": "12345678",
          "bankAccountHolderName": "PROD ONLY"
     }
}
'

This API is Async API, You will get response that we have received the request as below.

{
  "status": 200,
  "data": {
    "message": "We have received your request and are processing it, please check your callback URL for transaction status",
    "id": "asdasd123123asdasdasd",
    "type": "disbursement",
    "attributes": {
      "referenceId": "test-disbursement-1",
      "description": "test-disbursement-1",
      "amount": "10000",
      "status": "processing",
      "createdAt": "2022-07-21T13:49:39.752+07:00",
      "disbursementMethod": {
        "type": "bank_transfer",
        "bankAccountNo": "12345678",
        "bankShortCode": "BCA",
        "bankAccountHolderName": "PROD ONLY"
      }
    }
  },
  "metaData": {
    "source": "API",
    "entity": "Payment"
  },
  "error": null
}

Also, We will send the final response to your callback URL, Request body of callback request will look almost similar as first response with final/Updated status values.

{
  "data": {
    "id": "asdasd123123asdasdasd",
    "type": "disbursement",
    "attributes": {
      "referenceId": "test-disbursement-1",
      "description": "test-disbursement-1",
      "amount": "10000",
      "status": "completed",
      "createdAt": "2022-07-21T13:49:39.752+07:00",
      "disbursementMethod": {
        "type": "bank_transfer",
        "bankAccountNo": "12345678",
        "bankShortCode": "BCA",
        "bankAccountHolderName": "PROD ONLY",
        "bankName" : "Bank Central Asia"
      }
    }
  }
}