You are able to export transaction data for payments and refunds in a sent
state. This data is provided as a zipped collection of CSVs for any date in the past. This page describes how to export transaction data using the API.
Retrieve the transaction data
1. Initiate the data export
To initiate a data export, send a GET
request to the /data_exports
endpoint and specify a date
and mode
as query parameters.
The cURL request below shows and example:
curl --location --request GET 'https://api.banked.com/partner/v1/data_exports?date=2021-07-10&mode=test' \ --header 'Authorization: Bearer YOUR_TOKEN'
The response includes an id
and some additional information:
Response: { id: 'EXPORT_ID' date: '2021-07-01', mode: 'test', status: 'processing' }
2. Wait until the data is ready
The status
parameter you see on the API response will change from processing
to complete
. Poll the endpoint GET https://api.banked.com/partner/v1/data_exports
until the data is ready for download.
3. Download the data
When the data is ready for download, you may download it from https://api.banked.com/partner/v1/data_exports/EXPORT_ID
. The data will be streamed back to you, so you will need to save the response.
curl --location --request GET 'https://api.banked.com/partner/v1/data_exports/EXPORT_ID' \ --header 'Authorization: Bearer YOUR_TOKEN' \ --header 'Accept: application/octet-stream' > download.zip
Data format
Data will be provided as a zipped folder containing two data types: payments and refunds. The data is segmented by businesses and business applications. There will be one folder for every business within each data type folder with data for the given day. Within that, there will be one folder for every business application, containing the CSV data files. Each CSV will contain up to 1000 rows. The data export will be split into multiple, sequentially numbered files if required:
/payment_sessions /{business_id} /{business_application_id} 1.csv 2.csv ... /refunds /{business_id} /{business_application_id} 1.csv 2.csv ...
The example below shows the CSV file format for payments:
payment_session_id,timestamp,amount_cents,currency,event,reference,end_to_end_id,business_id,business_application_id abcdef,2021-08-01 00:00:00 UTC,10000,GBP,sent,flared jeans,123456abcdef,business_id_1,business_application_id_1
And for refunds:
refund_payment_session_id,timestamp,amount_cents,currency,event,reference,end_to_end_id,refund_id,payment_session_id,business_id,business_application_id abcdefgh,2021-08-09 00:00:00 UTC,10000,GBP,sent,flared jeans,abcdefg123456789,abcdefg1234567,abcdef,business_id_1,busi