Billing
Get billing statement
This endpoint retrieves an account statement for a specified period, with an option to download as PDF.
Request
Method: GET
URL: https://api.sandbox.bobpay.co.za/v2/billing/statements
Query parameters
| Key | Description | Type | Required |
|---|---|---|---|
| Boolean flag to return a PDF download link for the statement instead of the statement data. | boolean | No | |
| start_date | The start date for the statement period (format: YYYY-MM-DD HH:MM:SS). | string (date/time) | No |
| end_date | The end date for the statement period (format: YYYY-MM-DD HH:MM:SS). | string (date/time) | No |
| account_id | The unique identifier of the account whose statement is being requested. | integer | Yes |
Note: Very large statements cannot be returned directly as a PDF. In that case, the PDF is generated in the background and emailed to the authenticated user, and the response is {"queued": "true", "email": "<your email address>"} instead of a download link.
Response
Status code: 200 OK Content-Type: application/json
Response body (PDF download URL)
{
"download_url": {
"url": "https://payments-backend-dev-infra-billing.s3.af-south-1.amazonaws.com/pdfs/statement_335.pdf?...",
"filename": "pdfs/statement_335.pdf",
"bucket": "payments-backend-dev-infra-billing",
"file_size": 45600
}
}
Response fields
| Key | Description | Type |
|---|---|---|
| statement | Object containing the statement data for the specified period. | object |
| from_date | The start date of the statement period. | string (datetime) |
| to_date | The end date of the statement period. | string (datetime) |
| pending | The amount of pending transactions. | float |
| closing_balance | The closing balance at the end of the period. | float |
| issuer_details | Object with the issuer's details (name, address, contact info, etc.). | object |
| account | Object with account details. | object |
| account_billing_info | Object with account billing details. | object |
| balance_brought_forward | Object describing the balance carried over into the period. | object |
| transactions | Array of statement transactions (may be null if no transactions). | array of objects |
| download_url | Object containing PDF download info if pdf=true is used. | object |
Note: When pdf=true is used, the response will contain a download_url object instead of statement details.