API Get cycle list for plan
Endpoint: /api/v1/subs/plans/{planId}/cycles
Method: GET
Header Params
Param | Required | Type | Description | Note |
---|---|---|---|---|
X-APPOTAPAY-AUTH | required | String | How to generate JWT_TOKEN | |
Content-Type | required | String | Value: application/json | |
X-Request-ID | optional | String | UUIDv4 format. Request ID to check when a problem occurs | max:42 |
Language | optional | String | The value vi or en corresponding to the payment link will be Vietnamese or English, (default: vi) | in:vi,en |
X-Account-Ref-ID | optional | String | Iidentifier of the sub account provided by AppotaPay. Mandatory be passed over when processing payment for transactions of owner-type sub account |
{
"X-APPOTAPAY-AUTH": "JWT_TOKEN",
"Content-Type": "application/json",
"X-Request-ID": "Your_Unique_id",
"Language": "vi",
"X-Account-Ref-ID": "9723f73b-9295-4acb-884b-ab6310c2e653"
}
Request params
Param | Required | Type | Description | Note |
---|---|---|---|---|
page | Optional | Integer | Page you need to get information, default: 1 | |
limit | Optional | Integer | Number of items per page, default:20 |
Response data
Param | Required | Type | Description |
---|---|---|---|
data | Required | Array | Data |
data.*.cycleId | Required | String | Cycle ID |
data.*.cycleNumber | Required | Integer | Cycle number |
data.*.currency | Required | Integer | Currency unit |
data.*.amount | Required | Integer | Amount |
data.*.scheduledAt | Required | String | Schedule timestamp (format ISO-8601) |
data.*.status | Required | String | Cycle status: - SCHEDULED: cycle has been initialized and waiting for execution time - PENDING: recurring payment is in progress (cycle cannot be updated) - RETRYING: cycle needs to charge again - FAILED: all attempts/retries configured for the cycle have failed - SUCCEEDED: cycle is charge successfully - CANCELLED: cycle is canceled due to request from merchant |
data.*.createdAt | Required | String | Creation time (standard format: ISO-8601) |
data.*.updatedAt | Required | String | Last updated time (standard format: ISO-8601) |
meta | Required | Object | Pagination information |
meta.page | Required | Integer | Current page |
meta.limit | Required | Integer | Number of items per page |
meta.total | Required | Integer | Total item |
meta.pages | Required | Integer | Total page |
Success
Http Status Code
200
-OK
{
"data": [
{
"cycleId": "01HRVK1SZ5DTDQNRSBYCE14D81",
"cycleNumber": 4,
"currency": "VND",
"amount": 85000,
"scheduledAt": "2024-01-29T17:20:47+07:00",
"status": "CANCELLED",
"createdAt": "2024-01-26T17:30:30+07:00",
"updatedAt": "2024-01-27T17:45:31+07:00"
},
{
"cycleId": "01HRVK22S1ZA0Y3HYXFPZV23EY",
"cycleNumber": 3,
"currency": "VND",
"amount": 405100,
"scheduledAt": "2024-01-26T17:30:00+07:00",
"status": "FAILED",
"createdAt": "2024-01-26T17:22:18+07:00",
"updatedAt": "2024-01-27T17:41:59+07:00"
},
{
"cycleId": "01HRVK2D64BD35WVBCS65SNH07",
"cycleNumber": 1,
"currency": "VND",
"amount": 85000,
"scheduledAt": "2024-01-26T17:20:47+07:00",
"status": "SUCCEEDED",
"createdAt": "2024-01-26T17:20:51+07:00",
"updatedAt": "2024-01-26T17:20:51+07:00"
},
{
"cycleId": "01HRVK2NEYCHVZYJG3CK3HEQMQ",
"cycleNumber": 2,
"currency": "VND",
"amount": 85000,
"scheduledAt": "2024-01-27T17:20:47+07:00",
"status": "SUCCEEDED",
"createdAt": "2024-01-26T17:20:51+07:00",
"updatedAt": "2024-01-26T17:22:18+07:00"
}
],
"meta": {
"page": 1,
"limit": 10,
"total": 4,
"pages": 1
}
}
Failure
HTTP Status Code !=
200
Error response params
Param | Required | Type | Description |
---|---|---|---|
errorCode | required | Integer | Error code |
message | required | String | Error message |
errors | optional | Array | Detailed error description |
errors.*.field | optional | String | Field data is corrupted |
errors.*.reason | optional | String | Description of the data field in error |
{
"errorCode": 3005,
"message": "Plan không tồn tại"
}
Common error code table
Full error code, please check this error code list
Error code | Description |
---|---|
0 | Success |
1 | Missing or Invalid Params |
11 | Partner is not found |
13 | Partner has been blocked |
14 | API Key is invalid |
15 | API Key is not activated or blocked |
92 | IP is not allowed to access |
99 | Undefined error, please contact AppotaPay for more detailed information |
401 | Unauthorized |
500 | Server error |
3005 | Plan not exist |