Payment API Migration from v1 to v2

This document helps our clients to migrate payment APIs from the v1 version to v2.

In Brick, We have launched our new API version(v2). Our v2 version has

  • More reliable and secure
  • Faster response
  • Highly scalable
  • Better response structure

Our APIs(v2) are callback-based APIs, So if you have not set up a callback URL till now, Please set it from brick dashboard.

So, In v2(Callback-based APIs), Once you hit any Brick API, You will get two responses.

  • Sync(Real-time response) - Once you call any API then, In real-time Brick will send an accepted response. So it means that your request is accepted. parameters. Structure of success and error cases are below.
{
  "status": 200,
  "data": {
    "message": "We have received your request and are processing it, please check your callback URL for transaction status",
    "otherFields":"XXXX"
  },
  "metaData": {
    "source": "API",
    "entity": "Payment"
  },
  "error": null
}
{ 
           "status" : XXX,        
           “error”:{
                    "code": {{brick_unique_error_code}}, 
                    "message": {{description_of_error}}, 
                    "action": {{further_action}},
                    "reason": {{Actual_reason_for_error}}
          }, 
          “metaData”:{
                    "source": {{API/Widget/Dashboard/SDK/Portal}}, 
                    "entity": "Payment"
         },
         "data":null 
 }
  • Async(Callback-based response) - Once Brick has completed the requested transaction, Brick will send the transaction completion as response over the callback URL. Structure of success and error cases are below.
{
  "status": 200,
  "data": {
    "message": "We have received your request and are processing it, please check your callback URL for transaction status",
    "id": "asdasd123123asdasd",
    "type": "disbursement",
    "attributes": {
      "referenceId": "referenceId-1",
      "description": "decription-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"
      }
    }
  },
  "metaData": {
    "source": "API",
    "entity": "Payment"
  },
  "error": null
}
{
  "status": 200,
  "data": {
    "message": "We have received your request and are processing it, please check your callback URL for transaction status",
    "id": "asdasd123123asdasd",
    "type": "disbursement",
    "attributes": {
      "referenceId": "referenceId-1",
      "description": "decription-1",
      "amount": "10000",
      "status": "failed",
      "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
}
{ 
           "status" : XXX,        
           “error”:{
                   "code": {{brick_unique_error_code}}, 
                   “job_id”:”11111111eeeee3e3”
                   "message": {{description_of_error}}, 
                   "action": {{further_action}},
                   "reason": {{Actual_reason_for_error}}
          }, 
          “metaData”:{
                   "source": {{API/Widget/Dashboard/SDK/Portal}}, 
                   "entity": "Payment"
         },
         "data":null 
 }

API Mapping from v1 to v2

Auth APIs

V1Method in v1V2Method in v2
/v1/auth/tokenGet/v2/payments/auth/tokenGet

Account Verification

V1Method in v1V2Method in v2
/v1.1/payments/bank-account-validationPost/v2/payments/gs/bank-account-validationGet

Disbursement APIs

V1Method in V1V2Method in V2
/v1.1/payments/disbursementsPost/v2/payments/gs/disbursementsPost
/v1.1/payments/disbursements/Get/v2/payments/gs/disbursementsGet

VA APIs(Coming Soon)

V1Method in V1V2Method in V2
/v1/payments/open-vaPost/v2/payments/gs/va/openPost
/v1/payments/open-va/retrieve/Get/v2/payments/gs/va/openGet
v1/payments/open-va/status/Get/v2/payments/gs/va/open/statusPost
/v1/payments/close-vaPost/v2/payments/gs/va/closePost
/v1/payments/close-va/retrieveGet/v2/payments/gs/va/closeGet
/v1/payments/close-va/status/Get/v2/payments/gs/va/close/statusPost