Skip to main content
Version: Lastest

API Get cycle list for plan

Endpoint: /api/v1/subs/plans/{planId}/cycles

Method: GET

Header Params

ParamRequiredTypeDescriptionNote
X-APPOTAPAY-AUTHrequiredString How to generate JWT_TOKEN
Content-TyperequiredStringValue: application/json
X-Request-IDoptionalStringUUIDv4 format. Request ID to check when a problem occursmax:42
LanguageoptionalStringThe value vi or en corresponding to the payment link will be Vietnamese or English, (default: vi)

in:vi,en

X-Account-Ref-IDoptionalString

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

ParamRequiredTypeDescriptionNote
pageOptionalIntegerPage you need to get information, default: 1
limitOptionalIntegerNumber of items per page, default:20

Response data

ParamRequiredTypeDescription
dataRequiredArrayData
data.*.cycleIdRequiredStringCycle ID
data.*.cycleNumberRequiredIntegerCycle number
data.*.currencyRequiredIntegerCurrency unit
data.*.amountRequiredIntegerAmount
data.*.scheduledAtRequiredStringSchedule timestamp (format ISO-8601)
data.*.statusRequiredString

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.*.createdAtRequiredStringCreation time (standard format: ISO-8601)
data.*.updatedAtRequiredStringLast updated time (standard format: ISO-8601)
metaRequiredObjectPagination information
meta.pageRequiredIntegerCurrent page
meta.limitRequiredIntegerNumber of items per page
meta.totalRequiredIntegerTotal item
meta.pagesRequiredIntegerTotal 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

ParamRequiredTypeDescription
errorCoderequiredIntegerError code
messagerequiredStringError message
errorsoptionalArrayDetailed error description
errors.*.fieldoptionalStringField data is corrupted
errors.*.reasonoptionalStringDescription 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 codeDescription
0Success
1Missing or Invalid Params
11Partner is not found
13Partner has been blocked
14API Key is invalid
15API Key is not activated or blocked
92IP is not allowed to access
99Undefined error, please contact AppotaPay for more detailed information
401Unauthorized
500Server error
3005Plan not exist