Skip to main content
Version: Lastest

Plan callback

After creating the plan, the AppotaPay system calls back the results to the partner's system

Note
  • 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 the signature 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.

{
"Content-Type": "applicaton/json"
}

Request params

Method: POST

ParamTypeDescription
dataStringTransaction information is encode with base64encode & json_encode format
signatureStringSignature to check data

signature = HMAC_SHA256(data, secretKey)

timeStringResponse time

Decode

  1. Partners use the Base64Decode function to decode data in string form.
  2. Use the JSON_Decode function to decode the data a second time in json form.
ParamRequiredTypeDescription
eventRequiredString

Event:

- subscription.plan.activated: plan is activated

- subscription.plan.inactivated: plan is inactivated

dataRequiredObjectData
data.planRefIdRequiredString

Unique reference code of partner.

Partner-provided identifier for the plan.

data.planIdRequiredStringAppotaPay-generated subscription plan ID
data.customerIdRequiredStringCustomer ID
data.currencyRequiredStringCurrency unit
data.amountRequiredIntegerPayment amount
data.paymentMethodsRequiredArray

Payment method list

(Only show if the integration model is Merchant hosted)

data.paymentMethods.*.paymentMethodIdRequiredStringPayment method ID
data.paymentMethods.*.rankRequiredIntegerIndicate the order which payments methods will be attempted for a payment cycle instance. Available values - 1 to 5
data.immediateActionTypeOptionalString

Charge immediately when successfully creating the plan, null: charge at anchorDate time

- FULL_AMOUNT: charge when successfully initializing the plan

data.failedCycleActionRequiredString

Action of plan when the payment cycle fails

- STOP: Stop the plan

- RESUME: Skip the failed cycle and proceed to the next cycle

data.serviceNameOptionalString

Service name of subscription plan

(Only show if the integration model is Checkout Page)

data.statusRequiredString

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.actionsOptionalArrayIf status is REQUIRES_ACTION, the object has specific information to perform the next action to activate the payment method
data.actions.*.urlOptionalStringURL to perform action
data.actions.*.actionOptionalString

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.*.methodOptionalString

HTTP method for calling the url.

- GET

- POST

data.scheduleRequiredObjectObject containing the configurations of how Subscriptions cycles will be scheduled
data.schedule.intervalRequiredStringThe type of interval between consecutive Subscriptions cycles.
data.schedule.intervalCountRequiredStringThe number of units of interval between consecutive Subscriptions cycles
data.schedule.totalRecurrenceOptionalInteger

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.anchorDateOptionalString

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.retryIntervalOptionalStringThe type of interval between failed attempt and retries.
data.schedule.retryIntervalCountOptionalIntegerThe number of units of retryInterval between consecutive retries
data.notificationConfig.[subscription.cycle.retrying]OptionalArray

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]OptionalArray

Specify which channel you want to notify your customer through when the cycle is successfully completed

Accepted value ["EMAIL"]

data.notificationConfig.[subscription.cycle.failed]OptionalArray

Specify which channel you want to notify your customer through when the cycle failed

Accepted value ["EMAIL"]

data.notificationConfig.[subscription.plan.activated]OptionalArray

Specify which channel you want to notify your customer through when the subscription plan is activated

Accepted value ["EMAIL"]

data.notificationConfig.[subscription.plan.inactivated]OptionalArray

Specify which channel you want to notify your customer through when the subscription plan is inactivated

Accepted value ["EMAIL"]

data.createdAtRequiredStringPlan creation time (standard format: ISO-8601)
data.updatedAtRequiredStringLast updated time (standard format: ISO-8601)
paymentLinkUrlOptionalStringUrl 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