Ledger API

Ledger API helps company to retrieve all transactions within a specific interval & the history of transactions can be used to do real time transaction reconciliation.

If you have not created the Brick account till now, Please feel to create a new account from here.

Retrieve Specific Interval Transaction History From Ledger API

1. Generate a JWT bearer token (Public Access Token)

Use your Sandbox API keys: ClientId & ClientSecret with the payment public token API generation to get a JWT (JSON Web Token).This JWT or what we call a public access token is needed to call all payment-related APIs. Please note that the public access token is valid for 5 minutes and can be used for one time only.

curl --request GET \
     --url https://sandbox.onebrick.io/v2/payments/auth/token \
     --header 'Accept: application/json' \
     -u "clientId:clientSecret"

2. Access Transaction History via Ledger API

With The token that you get from step 1, you can use the token to access the ledger APi

curl --location --request GET 'https://sandbox.onebrick.io/v2/payments/gs/ledger?page=1&size=2000&startDate=2022-08-01&endDate=2022-10-20' \
--header 'publicAccessToken: Bearer {publicAccessToken}'

Following are the example of the responses you would get:

{
  "status": 200,
  "data": {
    "message": "We are successfully able to get the data",
    "transactions": [
      {
        "refId": "ref-1",
        "date": "2022-10-03T15:17:44.000+07:00",
        "accountHolderName": "test-123",
        "accountNumber": "12345678",
        "bankName": "Bank Artos Indonesia",
        "description": "Demo-1",
        "amount": 20000,
        "fees": 4500,
        "status": "completed"
      },
      {
        "refId": "ref-id123",
        "date": "2022-11-03T15:17:44.000+07:00",
        "accountHolderName": "test-123",
        "accountNumber": "12345678",
        "bankName": "Bank Artos Indonesia",
        "description": "Demo-2",
        "amount": 20000,
        "fees": 4500,
        "status": "completed"
      }
    ]
  },
  "metaData": {
    "source": "API",
    "entity": "Payment"
  },
  "error": null
}
{
  "status": 401,
  "error": {
    "code": "invalid_parameters_in_headers",
    "message": "Please use valid Public_access_token in headers",
    "action": "Please generate valid public access token via /v2/payments/auth/token APIs or contact to Brick sales team",
    "reason": "Invalid public_access_token in headers"
  },
  "metaData": {
    "source": "API",
    "entity": "Payment"
  },
  "data": null
}

Disbursement Statuses

Payment status changes based on various scenarios, such as whether the payment succeeds or fails.

Learn about the different statuses, and what to do at each stage of a payment's life cycle here.

Pending

  • A Disbursement has been created successfully.
  • Brick will send instructions to make the fund transfers to the specified destination.

Processing

  • Brick has sent instructions to make the fund transfers, awaiting confirmation that the fund transfers are complete.

Failed

Reasons

Disbursements can fail for various reasons.
Requested fund transfers can sometimes be declined by the payment network, or a congested payment network may not respond successfully.
Other reasons could be errors made during the disbursement request.

Completed

The disbursement has successfully completed.

📘

Ledger API Reference

You can check the API reference click here