Set up repeat payments
An AI skill is available for this guide, get it on the Skills Marketplace (GitHub).
Repeat payments are payments that a merchant takes from a customer on a regular schedule. For example, a merchant can offer a monthly product such as a magazine subscription or a merchant can allow customers to split large payments into smaller regular payments.
To schedule repeat payments, you need to complete the following steps:
- Save the customer’s payment details to use instead of their raw payment details.
- Create a payment plan to indicate how a merchant takes payments from their customer. It defines the frequency, amount, length, and collection method for each payment.
- Use a subscription to assign a customer to a payment plan. A merchant can personalize a subscription for a specific customer, for example, add a discount or collect a one-off setup fee.
How it works
- The customer submits their card details on the Hosted Payment Page (HPP) tokenization page. Our gateway stores the payment details and returns a CARDREFERENCE.
- You create a payment plan with our API. Our gateway returns a
paymentPlanId. - You create a subscription with our API to assign the customer to the payment plan. In your request, send the CARDREFERENCE and the
paymentPlanId. - Our gateway collects payments automatically according to the plan schedule. If the payment plan uses manual collection, use the
subscriptionIdto collect each payment.
Integration journey
- Integrate with the Hosted Payment Page to save a customer’s payment details.
- Integrate with our API to:
- Create a payment plan.
- Assign a customer to a payment plan.
- (Optional) Manually collect a payment from a customer.
Before you begin
Authenticate your requests before making API calls. If your request fails, see Errors.
Step 1. Save a customer’s payment details
Before you can schedule repeat payments, you need to save the customer’s payment details using the Hosted Payment Page. The Hosted Payment Page captures the card details and stores them in our vault. Our gateway returns a value for the CARDREFERENCE parameter, which is a secure token that represents the customer’s payment details. Store the CARDREFERENCE and use it when you create a subscription.
To integrate with the Hosted Payment Page to save a customer’s payment details, go to Save a customer’s payment details.
Step 2. Create a payment plan
To create a payment plan, send a POST request to our Payment Plans endpoint.
Note: To allow merchants to add their own information to the payment plan, use custom fields. For more information about how to add custom fields, go to Add custom fields to your integration.
Request parameters
To create the body of your request, use the following parameters:
Request
Example request
Response fields
If your request is successful, we create the payment plan and return a response. Store the paymentPlanId and send it when you create the subscription. The response contains the following fields:
Response
Example response
Step 3. Create a subscription
To assign a customer to a payment plan, send a POST request to our Subscriptions endpoint. Send the CARDREFERENCE from Step 1 in the token parameter. You can also use this request to personalize the payment plan for each customer, for example, apply a discount on each payment or add a one-off setup fee.
Request parameters
To create the body of your request, use the following parameters:
Request
Example request
Response fields
If your request is successful, we assign the customer to the payment plan and return a response. Store the subscriptionId. The response contains the following fields:
Response
Example response
Step 4. (Optional) Manually collect a payment
Our gateway can automatically collect payments, or the merchant can manually collect payments.
- If the payment plan has a value of
automaticfor thetypeparameter, our gateway automatically collects payments from the customer. - If the payment plan has a value of
manualfor thetypeparameter, send a POST request to the Subscriptions endpoint to collect a payment from a customer.
Request parameters
To create the body of your request, use the following parameters:
Request
Example request
Response fields
If your request is successful, we take the payment from the customer and return a response. The response contains the following fields: