Skip to Content
Docs

Set up recurring payments

Store the underlying card from a Google Pay transaction and use it for recurring charges or subscriptions.

When Pay.com processes a Google Pay transaction, it stores the underlying card as a standard payment method (pm_card_...). This stored card behaves identically to any other saved card on Pay.com and can be used for both merchant-initiated charges and subscription billing.

To use the stored card for merchant-initiated charges, ask to save it on the initial Google Pay payment. Set setup_future_usage: "off_session" on the payment session (Universal or Headless checkout), or source_data.setup_future_usage: "off_session" on the charge (server-to-server). The SDK includes paymentMethod in the onSuccess payload only when the session sets setup_future_usage.

Retrieve the stored payment method ID

How you retrieve the pm_card_... ID depends on the integration path used for the initial Google Pay payment.

Create the payment session with "setup_future_usage": "off_session" so the card is stored for merchant-initiated use:

    {
      "amount": 1000,
      "currency": "usd",
      "customer_reference_id": "cust-001",
      "payment_method_types": ["googlepay"],
      "setup_future_usage": "off_session"
    }

1000 is $10.00 (amounts are in minor units). Then retrieve the pm_card_... ID from the onSuccess callback after the customer completes the initial Google Pay payment. The SDK returns response keys in camelCase, so the ID is in payment.paymentMethod:

    const checkout = pay.checkout({
      clientSecret: '{client_secret}',
      onSuccess: (payment) => {
        const paymentMethodId = payment.paymentMethod
        // Store paymentMethodId against the customer in your database
      },
      onFailure: (error) => {
        console.error(error.message)
      },
    })

Create recurring charges or subscriptions

Once you have the pm_card_... ID, you can use it to charge the customer without them being present. There are two paths depending on your billing model:

  • Recurring charges: trigger each charge manually using the stored pm_card_... ID with "off_session": true. See the recurring charges guide for the full request format, all targeting methods, response handling, and webhook events.

  • Subscriptions: attach the stored pm_card_... ID to a subscription package and let Pay.com manage the billing schedule automatically. See the subscriptions guide for the full setup instructions.

Google Pay generates a new payment token on every transaction. Recurring charges are made against the underlying card that Pay.com extracts during the initial payment, not against the Google Pay wallet itself.

Was this page helpful?