The create payment plan can be created using the create plan API. A plan Id is mandatory before a customer payment subscription can be created.

A plan can be created with different billing cycles and pricing tiers to accommodate the merchants products and services.

A plan is a template containing a set of payment setting (amount and frequency) which can be standardise to customer payment subscription being created.

post/billing/plans

Request

  • Base URL
    https://api-sandbox.ezypay.com/v2
  • URL
    https://api-sandbox.ezypay.com/v2/billing/plans
  • Auth
    OAuth 2
    Client credentials
    Token URL: https://identity-sandbox.ezypay.com/token

Headers

merchantstring required

Merchant ID

Request body

namestring required

Plan name. Max of 50 characters.

memostring

Brief memo of the plan. Max of 50 characters.

accountingCodestring

Specify an accounting code to categorise revenue collected from the plan's subscription payment. Max of 50 characters.

intervalUnitstring

Specifies frequency of billing. Valid values are day, week or month. If no value is provided, the default value is week.

intervalinteger

Number to be specified as interval to manipulate billing frequency. For example interval=2 and intervalUnit=week would means billing every 2 weeks. If no value is provided, the default value is 1.

billingStartstring

Specifies the default day the billing schedule starts for customers subscribed to the plan. Supported values are: immediate - Default value. Subscriptions will start on the same day. day_of_week - Subscriptions will start on a specific day as defined in billingStartValue. day_of_month - Subscriptions will start on specific day in the month as defined in billingStartValue.

billingEndstring

Specifies the rules to automate when a subscription ends. Supported values are: ongoing - Default value. Subscriptions created from this plan will have no end date and continue billing on an ongoing basis (until instructions are given to stop billing). amount_collected - Subscriptions will end when a specified amount is collected as defined in billingEndValue. billing_cycles - Subscriptions will end after a specified number of billing cycles as defined in billingEndValue. end_date - Subscriptions will end on specific date. Specify this date when you create a subscription in billingEndValue.

firstBillingstring

Specifies the rules to auto-calculate the billing charges for the first scheduled billing. Supported values are: full_amount - Default value. The first billing will charge the full amount on the subscription as defined in the plan's amount. prorate - Prorate will be auto-calculated for the first billing in the subscription for the pro-rated period, with full recurring billing amount starting from the next billing cycle.

metadataobject

Store additional data about the customer object using key/value pairs format.

Response

200

idstring
statusstring
namestring
memounknown
accountingCodestring
setupPaymentsunknown
intervalUnitstring
intervalinteger
billingStartstring
billingStartValuestring
billingEndstring
billingEndValueunknown
firstBillingstring
recurringBillingDayunknown
metadataunknown
createdOnstring

Example response

{
  "id": "8ff2e3ea-aaa9-4978-8e2a-319d67e8f302",
  "status": "ACTIVE",
  "name": "high_st_monthly_plan",
  "accountingCode": "customer_plan",
  "amount": {
    "currency": "NZD",
    "value": 200
  },
  "intervalUnit": "MONTH",
  "interval": 1,
  "billingStart": "DAY_OF_MONTH",
  "billingStartValue": "1",
  "billingEnd": "ONGOING",
  "firstBilling": "FULL_AMOUNT",
  "failedPaymentHandling": {
    "initialAction": "STOP",
    "autoRetry": true,
    "retryInDays": 3,
    "maximumFailedAttempts": 4
  },
  "createdOn": "2019-03-11T09:10:53.771"
}

Changes