Skip to main content

Export Balance History

A solution to cater high-order-traffic partner requests for balance history.

Directions:

  • Partner calls API 1 to make an export balance history request. Partner will receive a request key if the request succeeds.
  • Partner checks request_key status using API 2. See status mapper for detailed information.
  • If status is Ready, partner may export the balance history using API 3.

API 1: Request Asynchronous Export​

Path​

get

{host}/v2/fs/:fs_id/shop/:shop_id/saldo-history

Constraint​

It is suggested that the request time period (date_from - date_to) is no more than 7 days.

Request Header​

ParameterTypeDescription
Authorization
string
token with bearer

Request Parameters​

NameTypeRequiredLocationDescription
fs_id
integer
Y
path
Shop registered App ID
shop_id
integer
Y
path
Shop ID
date_from
string
Y
query
History start date, YYYY-MM-DD
date_to
string
Y
query
History end date, YYYY-MM-DD
saldo_type
integer
Y
query
0 = refund, 1 = penghasilan, 2 = both

Example Request​

curl -X GET 'https://fs.tokopedia.net/v2/fs/13138/shop/6549744/saldo-history?from_date=2020-12-01&to_date=2021-01-01&saldo_type=1' -H 'Authorization: Bearer EUqcir9oRCqNr_9OuvZgkg'

Success Response Example​

{
"header": {
"process_time": 0.016533477,
"messages": "Your request has been processed successfully"
},
"data": {
"request_key": "SHD-123"
}
}

Error Response Example​

{
"header": {
"process_time": 0.00002147,
"messages": "We could not process your request due to malformed request, please check again",
"reason": "Date format is not valid",
"error_code": "SHP_DLV_005"
},
"data": null
}

API 2: Check Asynchronous Export Request​

Path​

get

{host}/v2/fs/:fs_id/shop/:shop_id/saldo-history/status

Constraint​

It is suggested that the request time period (date_from - date_to) is no more than 7 days.

Request Header​

ParameterTypeDescription
Authorization
string
token with bearer

Request Parameters​

NameTypeRequiredLocationDescription
fs_id
integer
Y
path
Shop registered App ID
shop_id
integer
Y
path
Shop ID
request_key
string
Y
query

Example Request​

curl -X GET 'https://fs.tokopedia.net/v2/fs/13138/shop/6549744/saldo-history?request_key=SHD321' -H 'Authorization: Bearer EUqcir9oRCqNr_9OuvZgkg'

Success Response Example​

{
"header": {
"process_time": 0.016533477,
"messages": "Your request has been processed successfully"
},
"data": {
"status": 1,
"status_definition": "Ready",
"request_key": "abcdef",
"created_time": "2021-08-31 18:05:02"
}
}

Error Response Example​

{
"header": {
"process_time": 0.00002147,
"messages": "We could not process your request due to malformed request, please check again",
"reason": "Date format is not valid",
"error_code": "SHP_DLV_005"
},
"data": null
}

Status Mapper​

StatusDescription
0
In Progress: the balance history is being processed, not ready to be downloaded/exported
1
Ready: the balance history is ready to be exported
2
Downloaded: the balance history has been downloaded
3
Failed: the balance history processing has failed. In this case, you may try to request for another request_key (API 1) to have it processed again
4
Expired: your request key has expired. This key can’t be used to export the balance history. In this case, you may try to request for another request_key (API 1) to have it processed again

API 3: Export Balance History​

Path​

get

{host}/v2/fs/:fs_id/shop/:shop_id/saldo-history/download

Constraint​

It is suggested that the request time period (date_from - date_to) is no more than 7 days.

Request Header​

ParameterTypeDescription
Authorization
string
token with bearer

Request Parameters​

NameTypeRequiredLocationDescription
fs_id
integer
Y
path
Shop registered App ID
shop_id
integer
Y
path
Shop ID
request_key
string
Y
query

Example Request​

curl -X GET 'https://fs.tokopedia.net/v2/fs/13138/shop/6549744/saldo-history/download?request_key=SHD321' -H 'Authorization: Bearer EUqcir9oRCqNr_9OuvZgkg'

Success Response Example​

*Returns File* .xlsx

Error Response Example​

{
"header": {
"process_time": 0.00002147,
"messages": "We could not process your request due to malformed request, please check again",
"reason": "Date format is not valid",
"error_code": "SHP_DLV_005"
},
"data": null
}

Have a feedback?