Skip to main content

Overview

The recurring payments feature allows you to securely save customer card information and charge subsequent payments without requiring card input. Perfect for subscriptions and recurring billing.
Recurring payments are only available for certain gateways. Please contact us for availability.
If you use your own payment form with Server-to-Server (S2S) payments, you can also save cards by passing token, save_card: true, and customer_id together. See the S2S guide for details.

Recurring Payment Flow

Initial Payment (Save Card)

Save the card by specifying save_card: true and customer_id in the initial payment.

Request

string
required
A unique ID to identify the customer. Use your internal user ID.
boolean
required
Set to true for the initial recurring payment. The card will be saved after payment completion.

Response

payment_type: "initial" indicates this is an initial payment with card saving. The payment_method_id will be provided in the webhook after payment completion.
Redirect the customer to payment_url to complete the payment.

Webhook on Payment Completion

Save the payment_method_id (pmi_xxx format) for subsequent payments.

List Saved Cards

Retrieve the customer’s saved cards.

Response

Execute Recurring Payment

Use the saved payment_method_id to charge without requiring card input.

Request

string
required
The saved payment method ID (pmi_xxx format)

Response

Recurring payments are processed instantly (no payment_url is returned).
payment_type: "recurring" indicates this is a recurring payment using a saved card.

Webhook on Payment Success

Recurring payment webhooks include is_recurring: true.

Webhook on Payment Failure

When a recurring payment fails, a payment.failed event is sent. The error object contains details about the failure.
Use error.recommended_action to determine the appropriate response:

Managing Payment Methods

Block a Card

Block a card if fraud is suspected.

Unblock a Card

Delete a Card (Detach)

Use detach to permanently delete card information upon customer request.

Response

Deleted cards cannot be restored. To use again, the customer must re-register their card.
Block vs Delete:
  • Block: Temporarily disable (fraud prevention). Can be unblocked later
  • Delete (Detach): Permanently remove (GDPR compliance, customer deletion requests). Cannot be restored

Error Handling

Recurring Not Supported

Card Expired

If the card has expired or been declined by the issuer, the customer must register a new card.

Best Practices

1

Manage customer_id uniquely

Map your internal user ID 1:1 with customer_id. Using different customer_id values for the same customer will scatter their card information.
2

Persist payment_method_id

Store the payment_method_id received in the webhook to your database for subsequent payments.
3

Implement retry strategy

Card payments can fail due to temporary issues. Use exponential backoff for retries, and notify the customer after multiple failures.
4

Monitor expiration dates

Track saved card expiration dates and prompt customers to update their cards before expiration.