Create Recurring Plan
Use this interface to create a new recycling plan
- If there are identical reference_numbers when creating a recycling plan, you will be informed: “plan has been created”
Header Parameters
random 16 bytes alphanumerics
Please follow the OpenAPI authentication section
Please follow the OpenAPI authentication section
Request Body
- This is name of the recurring plan (ex: Plan A)
- This field is to generate the reference number for the connecting orders created by the recurring plan
- Every new order created under this recurring plan will have the same “reference number” with incremental suffix
- Any description to remark about this record
- Array [
- This is for the system to know the billing date of a cycle, once the cycle has started
- If the user changes the recurring plan of a customer (upgrade/downgrade etc.), then the
- This is name of the cycle (ex: trial period/discounted period)
- Any description to remark about this record
-
This is to count how long will the recurring cycle run for. For example if the recurring_billing_configs.billing_interval = monthly , with recurring_billing_configs.billing_interval_count = 1 , and interval_counts = 3 , then it means this recurring_cycles record will run for 3 months (with each invoice to be billed every 1 month)
-
For example if the recurring_billing_configs.billing_interval = monthly , with recurring_billing_configs.billing_interval_count = 6 , and interval_counts = 3 , then it means this recurring_cycles record will run for 18 months (with each invoice to be billed every 3 months)
-
If data is null, then consider this recurring_cycles record will run forerver. For example if the recurring_billing_configs.billing_interval = yearly , with recurring_billing_configs.billing_interval_count = 1 , and interval_counts = NULL , then it means this recurring_cycles record will run with no ending (with each invoice to be billed every 1 year)
-
This is to determine the status of a particular subscription/recurring billing cycle. The difference between this status with general orders record is that it will have status specific to the current state of a recurring cycle.
-
Single option: [not_started], [started], [completed], [cancelled], [retrying_payment], [uncollectible]
-
[not_started] - it means that the cycle has not started, and do the billing
-
[started] - it means that the cycle has started, and do the billing
-
[completed] - it means that the cycle has completed
-
[cancelled] - (i) merchant/customer decides to end/cancel the subscription (ii) if the cycle is cancelled/unpaid for long time
-
[retrying_payment] - When the system is trying payments again after first initial payment has failed (only applicable for default_collection_method = charge_automatically ).
-
[uncollectible] - When the unpaid order of this cycle has reached its grace period grace_period
-
recurring_cycles.state = not_started (no recurring_orders record to be generated)
-
recurring_cycles.state = started equals recurring_orders.state = invoiced
-
recurring_cycles.state = started equals recurring_orders.state = async_pending
-
recurring_cycles.state = completed equals recurring_orders.state = completed
-
recurring_cycles.state = cancelled equals recurring_orders.state = voided
-
recurring_cycles.state = retrying_payment equals recurring_orders.state = invoiced
-
recurring_cycles.state = uncollectible equals recurring_orders.state = invoiced
-
recurring_cycles.state = uncollectible equals recurring_orders.state = voided
- ]
plan object required
recurring_cycles object[] required
- 200
Response Headers
Schema
- Array [
- Array [
- ]
- ]
data object required
plan object required
recurring_cycles object[] required
recurring_billing_config object required
recurring_items object[] required
customer object required
{
"code": 0,
"message": "string",
"data": {
"plan": {
"id": "string",
"name": "string",
"reference_number": "string",
"customer_uuid": "string",
"p_business_id": "string",
"default_payment_token": "string",
"default_collection_method": "string",
"description": "string",
"created_at": "string",
"updated_at": "string",
"deleted_at": "string",
"recurring_cycles": [
{
"id": "string",
"name": "string",
"state": "string",
"p_business_id": "string",
"recurring_plan_id": "string",
"interval_counts": 0,
"recurring_billing_config": {
"id": "string",
"p_business_id": "string",
"billing_interval_counts": 0,
"billing_interval": "string",
"billing_config_settings": "string",
"billing_month": 0,
"billing_day_of_month": 0,
"billing_proration_enabled": true,
"description": "string",
"created_at": "string",
"updated_at": "string"
},
"recurring_items": [
{
"id": "string",
"label": "string",
"p_business_id": "string",
"price": 0,
"quantity": 0,
"currency": "string",
"reference_id": "string",
"description": "string",
"created_at": "string",
"updated_at": "string",
"deleted_at": "string"
}
],
"billing_amount": 0,
"discount_amount": 0,
"discount_type": "string",
"default_payment_token": "string",
"default_collection_method": "string",
"payment_retry_day_period": 0,
"payment_retry_count": 0,
"grace_period": 0,
"previous_cycle": "string",
"next_cycle": "string",
"estimated_start_date": "string",
"start_date": "string",
"estimated_end_date": "string",
"end_date": "string",
"next_execute_time": "string",
"description": "string",
"created_at": "string",
"updated_at": "string",
"deleted_at ": "string"
}
],
"customer": {
"name": "string",
"email": "string",
"phone": "string",
"reference_number": "string",
"default_payment_method": "string",
"uuid": "string"
}
}
}
}