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
partnerRefIdStringUnique reference code of partner
planIdStringPlan ID
customerIdStringCustomer ID
currencyStringCurrency unit
amountIntegerPayment amount
paymentMethodsArrayPayment method list
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

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

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
createdAtStringCreation time (standard format: ISO-8601)
updatedAtStringLast updated time (standard format: ISO-8601)

Example

{
"partnerRefId": "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"
}