Skip to Content
Docs

Create recurring charges

Charge customers off-session using a stored payment method token and the Pay.com API.

Use the Pay.com API to charge a customer's stored payment method without them being present. This approach gives you full control over when each charge fires, the amount, and retry logic.

If you want Pay.com to manage the billing schedule automatically, see create a subscription instead.

Requirements

Before you charge a stored card off-session, make sure you have the following:

When you created the initial charge with "setup_future_usage": "off_session", the response included two values you need for future recurring charges:

  • payment_method: the stored card ID (pm_card_...)
  • underlying_network_id: the network transaction ID that links all charges in this recurring sequence

See create a charge for the initial charge flow. Add "setup_future_usage": "off_session" to source_data to enable card storage.

Charge the stored card

Create the charge with "off_session": true, then handle its result in your backend.

  1. 1

    Create the recurring charge

    Send a POST request to /v1/charges with "off_session": true. Amounts are in minor units (the smallest currency unit). For example, 5000 equals $50.00 USD.

    There are four ways to target the stored card. Choose the one that fits how your system stores customer data.

    Pass the pm_card_... ID in source. Pay.com looks up the underlying_network_id automatically. Use this when you store the payment method ID in your own database.

    {
      "amount": 5000,
      "currency": "usd",
      "source": "pm_card_687080745486778368",
      "off_session": true,
      "description": "Monthly subscription renewal",
      "reference": "sub-renewal-pm-001"
    }
  2. 2

    Handle the response

    Because recurring charges happen in the background, your system must handle each response status programmatically.

    • succeeded: The charge was approved and the funds captured. Settlement to your account happens later (see paid).
    • pending: Used for payment methods that require bank confirmation, such as SEPA or ACH.

    A declined charge doesn't return a status. The API returns HTTP 400 with error.type: "payment_method_error", the charge ID in error.charge, and a decline_code, often for insufficient funds or an expired card. Trigger a retry or prompt the customer to update their payment method. See decline codes.

Listen for webhooks

Because the customer is not present during recurring billing, subscribe to the following events to automate fulfillment and recovery logic on your backend:

  • charge.succeeded: The payment was confirmed. Use this to keep the subscription active.
  • charge.failed: The charge was declined. Use this to send recovery emails or retry the payment.

Verify each event's signature with the Pay-Signature header and your endpoint's signing secret (HMAC SHA-256) before you act on it. See verify webhook signatures.

Next steps

  • Create a subscription: set up automated recurring billing with Pay.com managing the schedule.
  • Manage subscriptions: handle renewals, failed charges, retries, payment method updates, and cancellations.
  • Webhooks: set up your endpoint and verify signatures.
  • Refund a charge: process full or partial returns for settled recurring charges.
Was this page helpful?