Plan callback
After creating the plan, the AppotaPay system calls back the results to the partner's system
- Using the
signature
parameter to check the integrity of the received data, the partner creates a signature from the data received by AppotaPay and then compares it with thesignature
parameter 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 plan.
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
Base64Decode
function to decode data in string form. - Use the
JSON_Decode
function to decode the data a second time in json form.
Param | Required | Type | Description |
---|---|---|---|
event | Required | String | Event: - subscription.plan.activated: plan is activated - subscription.plan.inactivated: plan is inactivated |
data | Required | Object | Data |
data.planRefId | Required | String | Unique reference code of partner. Partner-provided identifier for the plan. |
data.planId | Required | String | AppotaPay-generated subscription plan ID |
data.customerId | Required | String | Customer ID |
data.currency | Required | String | Currency unit |
data.amount | Required | Integer | Payment amount |
data.paymentMethods | Required | Array | Payment method list (Only show if the integration model is Merchant hosted) |
data.paymentMethods.*.paymentMethodId | Required | String | Payment method ID |
data.paymentMethods.*.rank | Required | Integer | Indicate the order which payments methods will be attempted for a payment cycle instance. Available values - 1 to 5 |
data.immediateActionType | Optional | String | Charge immediately when successfully creating the plan, null: charge at anchorDate time - FULL_AMOUNT: charge when successfully initializing the plan |
data.failedCycleAction | Required | String | Action of plan when the payment cycle fails - STOP: Stop the plan - RESUME: Skip the failed cycle and proceed to the next cycle |
data.serviceName | Optional | String | Service name of subscription plan (Only show if the integration model is Checkout Page) |
data.status | Required | String | Status of plan: - PENDING: request to initiate plan has been sent, wait exact status from AppotaPay - REQUIRES_ACITON: additional actions need to be performed to activate plan - ACTIVE: plan is activated to perform recurring payment with specific schedule - INACTIVE: plan is inactivated or created unsuccessfully |
data.actions | Optional | Array | If status is REQUIRES_ACTION, the object has specific information to perform the next action to activate the payment method |
data.actions.*.url | Optional | String | URL to perform action |
data.actions.*.action | Optional | String | The purpose the corresponding action - AUTH: Trigger this action in order to authorize linking or payment - RESEND_AUTH: Trigger this action in order to resend the authorization code to the end-customer |
data.actions.*.method | Optional | String | HTTP method for calling the url. - GET - POST |
data.schedule | Required | Object | Object containing the configurations of how Subscriptions cycles will be scheduled |
data.schedule.interval | Required | String | The type of interval between consecutive Subscriptions cycles. |
data.schedule.intervalCount | Required | String | The number of units of interval between consecutive Subscriptions cycles |
data.schedule.totalRecurrence | Optional | Integer | The total number of times the end user will be charged If the parameter is not used, Subscriptions plan will run on indefinitely |
data.schedule.anchorDate | Optional | String | Time to make recurring payments Default: the date of schedule creation Supported values: Timestamps between 1st to 28th of a month Lưu ý: nếu anchorDate: null và thời điểm khởi tạo plan là ngày 29/30/31 của tháng, anchorDate mặc định sẽ lấy value là ngày 1 của tháng tiếp theo |
data.schedule.retryInterval | Optional | String | The type of interval between failed attempt and retries. |
data.schedule.retryIntervalCount | Optional | Integer | The number of units of retryInterval between consecutive retries |
data.notificationConfig.[subscription.cycle.retrying] | Optional | Array | Specify which channel you want to notify your customer through when the cycle is unsuccessful, so it's necessary to attempt the next time Accepted value ["EMAIL"] |
data.notificationConfig.[subscription.cycle.succeeded] | Optional | Array | Specify which channel you want to notify your customer through when the cycle is successfully completed Accepted value ["EMAIL"] |
data.notificationConfig.[subscription.cycle.failed] | Optional | Array | Specify which channel you want to notify your customer through when the cycle failed Accepted value ["EMAIL"] |
data.notificationConfig.[subscription.plan.activated] | Optional | Array | Specify which channel you want to notify your customer through when the subscription plan is activated Accepted value ["EMAIL"] |
data.notificationConfig.[subscription.plan.inactivated] | Optional | Array | Specify which channel you want to notify your customer through when the subscription plan is inactivated Accepted value ["EMAIL"] |
data.createdAt | Required | String | Plan creation time (standard format: ISO-8601) |
data.updatedAt | Required | String | Last updated time (standard format: ISO-8601) |
paymentLinkUrl | Optional | String | Url for users to pay for RETRYING status |
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