Skip to main content
Version: Lastest

Plan Object

Subscriptions plan object will take in the customer object, schedule object to set up the subscription payments behaviour for a particular end user.

Each object has the following structure:

ParamTypeDescription
planRefIdString

Unique reference code of partner.

Partner-provided identifier for the plan.

planIdStringAppotaPay-generated subscription plan ID
customerIdStringCustomer ID
currencyStringCurrency unit
amountIntegerPayment amount
paymentMethodsArray

Payment method list

(Only show if the integration model is Merchant hosted)

paymentMethods.*.paymentMethodIdStringPayment method ID
paymentMethods.*.rankIntegerIndicate the order which payments methods will be attempted for a payment cycle instance. Available values - 1 to 5
immediateActionTypeString

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

- FULL_AMOUNT: charge when successfully initializing the plan

failedCycleActionString

Action of plan when the payment cycle fails

- STOP: Stop the plan

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

serviceNameString

Service name of subscription plan

(Only show if the integration model is Checkout Page)

statusString

Status:

- 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

actionsArrayIf status is REQUIRES_ACTION, the object has specific information to perform the next action to activate the payment method
actions.*.urlStringURL to perform action
actions.*.actionString

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

- **PAY **: Trigger this action in order to input payment information and make a payment (this action is only show with the Checkout Page model)

actions.*.methodString

HTTP method for calling the url.

- GET

- POST

scheduleObjectObject containing the configurations of how Subscriptions cycles will be scheduled
schedule.intervalStringThe type of interval between consecutive Subscriptions cycles
schedule.intervalCountStringThe number of units of interval between consecutive Subscriptions cycles
schedule.totalRecurrenceInteger

The total number of times the end user will be charged

If the parameter is not used, Subscriptions plan will run on indefinitely

schedule.anchorDateString

Time to make recurring payments

Default: the date of schedule creation

Supported values: Timestamps between 1st to 28th of a month

Note: if anchorDate is null or date of schedule creation falls on 29/30/31, anchor date will be defaulted to 1st of next month

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

notificationConfig.[subscription.cycle.succeeded]Array

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

Accepted value ["EMAIL"]

notificationConfig.[subscription.cycle.failed]Array

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

Accepted value ["EMAIL"]

notificationConfig.[subscription.plan.activated]Array

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

Accepted value ["EMAIL"]

notificationConfig.[subscription.plan.inactivated]Array

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

Accepted value ["EMAIL"]

currencyExchangeObject
currencyExchange.amountNumber

Exchange amount

Supports 2 decimals, eg: 12.02

currencyExchange.currencyString

Currency unit

Support: USD

createdAtStringCreation time (standard format: ISO-8601)
updatedAtStringLast updated time (standard format: ISO-8601)

Example

{
"planRefId": "ASKJLKALK299",
"planId": "01HRVJZV0W9NK63SDDXHW04T9H",
"customerId": "01HRVM5AA6JCKZJ8ERZ6MKKFJZ",
"currency": "VND",
"amount": 85000,
"paymentMethods": [
{
"paymentMethodId": "01HRVM7BFCP1QH7R6MFPASVH0W",
"rank": 1
}
],
"immediateActionType": "FULL_AMOUNT",
"failedCycleAction": "STOP",
"status": "PENDING",
"actions": [],
"schedule": {
"interval": "DAY",
"intervalCount": 1,
"totalRecurrence": 3,
"anchorDate": "2024-01-13T15:23:40+07:00",
"retryInterval": "DAY",
"retryIntervalCount": 1
},
"createdAt": "2024-01-29T11:36:02+07:00",
"updatedAt": "2024-01-29T11:36:04+07:00"
}