Cycle callback
The AppotaPay system calls back the results of the cycle to the partner's system
- Using the
signatureparameter to check the integrity of the received data, the partner creates a signature from the data received by AppotaPay and then compares it with thesignatureparameter sent by AppotaPay.
Web callback
AppotaPay will send the results via the API URL of the partner sending AppotaPay for configuration, the partner server checks the data integrity through the signature parameter then updates the status of cycle.
Header
{
"Content-Type": "applicaton/json"
}
Request params
Method: POST
| Param | Type | Description |
|---|---|---|
| data | String | Transaction information is encode with base64encode & json_encode format |
| signature | String | Signature to check data signature = |
| time | String | Response time |
Decode
- Partners use the
Base64Decodefunction to decode data in string form. - Use the
JSON_Decodefunction to decode the data a second time in json form.
| Param | Required | Type | Description |
|---|---|---|---|
| event | Required | String | Event: - subscription.cycle.created: create cycle successfully - subscription.cycle.succeeded: charge for the cycle successfully - subscription.cycle.retrying: charge for the cycle unsuccessfully, so it's necessary to attempt the next time - subscription.cycle.failed: charge for the cycle unsuccessfully - subscription.cycle.force_attempt_failed: force cycle attempt unsuccessfully |
| data | Required | Object | Data |
| data.cycleId | Required | String | Cycle ID |
| data.planId | Required | String | Plan ID |
| data.cycleNumber | Required | Integer | Cycle number |
| data.currency | Required | Integer | Currency unit |
| data.amount | Required | Integer | Amount |
| data.attemptCount | Required | Integer | Number of times the recurring action has been attempted for this recurring cycle object. |
| attemptDetails | Required | Array | Detailed information of each action attempts |
| attemptDetails.*.attemptNumber | Required | Integer | A numbering that tracks the order of cycle attempts. The first attempt will be 1 and subsequent attempts are dependent on retry configuration |
| attemptDetails.*.createdAt | Required | String | ISO 8601 timestamp for attempted actions |
| attemptDetails.*.attemptId | Required | Integer | Attempt ID |
| attemptDetails.*.type | Required | String | Type of attempt - INITIAL: the first attempt with each cycle - RETRY: attempt with type INITIAL failed, then subsequent retry is set - PAYMENT_LINK: if you use paymentLinkForFailedAttempt while creating a plan, attempts using payment link will have this type - FORCED: if you perform a force cycle through the API we provide |
| attemptDetails.*.status | Required | String | Attempt status: - PENDING: payment cycle is in progress - SUCCESS: attempt cycle successfully - FAILED: attempt cycle unsuccessfully |
| attemptDetails.*.nextRetryTime | Required | String | ISO 8601 Estimated timestamp for next retry |
| data.scheduledAt | Required | String | Schedule timestampt (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 | Cycle creation time (standard format: ISO-8601) |
| data.updatedAt | Required | String | Last updated time (standard format: ISO-8601) |
Response format
- The partner needs to respond to AppotaPay to confirm that they have received the result
- The response is considered successful when HTTP code = 200