To create a subscription through the API, you'll need to make a POST request to the /subscriptions endpoint.
You can customise the following parameters when creating a subscription;
- Amount - the amount needs to be sent in pence, or cents, and cannot contain any special characters
- Currency - currently only GBP and EUR are supported.
- Name - Optional name for the subscription, which will also set the description of each payment.
- Interval_unit - the unit of time between charge dates, either weekly, monthly or yearly.
- Interval - the number of interval_units between each charge date. This must result in at least one charge per year, and will default to 1 if not provided.
- Count - the total number of payments to be taken by the subscription.
- Day_of_month - the day of the month (1-28) you’d like your customer to be charged on. You can also use -1 to indicate the last day of the month.
- Month - the name of the month in which to charge a customer.
- Start_date - the date on which the first payment should be charged. This date must be within a year of the subscription being created, and on or after the mandate’s next_possible_charge_date. If this parameter isn’t included, the first payment will be charged as soon as possible.
- Payment_reference - This parameter is restricted to Pro accounts only. An optional payment reference that will be set for all payments and will appear on your customer’s bank statement.
For example, to create a subscription that charges
- on 5th of each month
- starting from 01/02/2018
- for 12 months
you'd need send the following POST request to the /subscriptions endpoint, linking the mandate ID you wish to charge: