Before you start:
- Make sure that you check [Prepare Yourself to Use API] guide.
- Access our Postman collection here.
Step to create your first payment out:
For quick start purposes, we will use regular disbursement method. However, Brick provides two kind of disbursement method: Regular method and BI-Fast method.
1. Generate public access token - API reference here
Public access token is authentication token that will be used in further API call in payment out and accept payment APIs. This public access token generated using your API credential Client ID
and Client Secret
that you get from preparation section.
Limitation of public access token
This API gives you a public access token that is only valid to be used 1 time and only for the next 5 minutes. If expired, you need to generate new public access token.
2. Verify recipient account - API reference here
The process to verify the recipient account needed to make sure payment out to be seamless without error due to invalid account data such as invalid bank account code or bank account number. It also help you to make sure that the owner of the recipient account is the right person you are sending the money to.
List Bank Account Destination
If you need to check list of bank that is covered by Brick system, you can check it in this link. For now Brick only able to verify payment out destination to bank account and not e-wallet account.
3. Create disbursement - API reference here
This API is the process to finally send money to the recipient account. You need to generate new public access token like in step 1. After that use the new public access token to call this payment out API.
You need to provide data for the payment data and recipient data, but for example you can follow the API call below :
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"
}
}
'
If process of payment out valid, you will see the response below that showing the payment out status as processing.
{
"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
}
Payment system is process that is dependent to the bank system and we will send the updated status once completed to your callback URL that you have setup before in the step 4.
4. Getting the callback status
Usually process of payment out will take few seconds until it is received in recipient bank account balance. Once the money is received and we got confirmation from bank system that transfer status completed, we will forward the updated status to your callback URL like this :
{
"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"
}
}
}
}
{
"data": {
"id": "9cb8ba6c8aa644ff9a433ace9",
"type": "disbursement",
"attributes": {
"referenceId": "ps-123456",
"description": "Good Luck",
"amount": "10000",
"status": "failed",
"settlementStatus": null,
"createdAt": "2025-02-12T16:25:11.000+07:00",
"errorCode": "5000100",
"errorReason": "General Error",
"errorDetail": {
"code": "general_error",
"message": "General Error",
"action": "Please try again later or contact support if the issue persists.",
"reason": "A general error occurred while processing the request. This may be due to a temporary issue on our end."
},
"disbursementMethod": {
"type": "bank_transfer",
"bankAccountNo": "010800041187",
"bankShortCode": "BCA",
"bankAccountHolderName": "Bambang Subambang",
"bankName": "BCA"
}
}
}
}
You can handle the behavior later for status completed or also check how to handling errors case.
5. Going live to production
If you have complete everything in the development and want to deploy the integration to the production, now you can check the production checklist in this section.