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β
Parameter | Type | Description |
---|---|---|
Authorization | string | token with bearer |
Request Parametersβ
Name | Type | Required | Location | Description |
---|---|---|---|---|
integer | Y | path | Shop registered App ID | |
integer | Y | path | Shop ID | |
string | Y | query | History start date, YYYY-MM-DD | |
string | Y | query | History end date, YYYY-MM-DD | |
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β
Parameter | Type | Description |
---|---|---|
Authorization | string | token with bearer |
Request Parametersβ
Name | Type | Required | Location | Description |
---|---|---|---|---|
integer | Y | path | Shop registered App ID | |
integer | Y | path | Shop ID | |
string | Y | query | Key from Request Asynchronous Export |
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β
Status | Description |
---|---|
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β
Parameter | Type | Description |
---|---|---|
Authorization | string | token with bearer |
Request Parametersβ
Name | Type | Required | Location | Description |
---|---|---|---|---|
integer | Y | path | Shop registered App ID | |
integer | Y | path | Shop ID | |
string | Y | query | Key from Request Asynchronous Export |
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
}