Save and reuse payment methods
Use this flow when you need to save a customer’s card and charge it later without asking them to enter card details again. It works well for variable monthly billing, usage-based charges, add-ons to a subscription, or renewals controlled by your system.
The customer always enters their card on a Recurrente-hosted checkout. Your system stores only the payment_method_id returned by Recurrente and uses it to create future charges.
Before saving a card, make sure the customer accepts clear terms for future charges: frequency, how the amount is calculated, when charges happen, and how they can cancel or update their payment method.
Flow overview
- Create or identify the customer in Recurrente.
- Create a checkout with
mode: "setup"to tokenize the card without charging it. - Send the
checkout_urlto the customer. - When the customer completes the checkout, store the
payment_method.id, or look it up whenever you need it in the customer’s list of saved methods. - Use
POST /api/one_time_paymentsto charge that saved method when you know the final amount.
Step 1: Create or identify the customer
If you already have a Recurrente customer, pass their customer_id when creating the tokenization checkout. If you only have the user_id, you can pass that instead.
The response includes the customer id:
Step 2: Create a tokenization checkout
Create a checkout with mode: "setup". This checkout does not charge anything; it only saves the card for future use.
When saving a new card, Recurrente verifies the account with a zero-amount authorization, without capturing funds. An approved authorization with a permanent token generates setup_intent.succeeded; a decline or failed verification generates setup_intent.cancelled, and the card is not enabled for charges. Saving a card does not guarantee that future charges will succeed or replace authentication that a later payment may require.
Recurrente returns a hosted URL:
Redirect the customer to checkout_url, or send it by email, WhatsApp, or inside your app.
Step 3: Store the payment_method_id
When the customer completes the checkout, Recurrente emits setup_intent.succeeded. The saved method is inside data.checkout.payment_method.
Store data.checkout.payment_method.id. This is the token you will use for future charges.
If you do not receive webhooks, retrieve the checkout after the customer returns to your success_url: GET /api/checkouts/{id}. Once the checkout is complete, the response includes payment_method.id.
List a customer’s saved payment methods
You don’t need to store card details in your system to show a customer their cards. List the methods they saved on your account, newest first, and charge the id of the one they pick:
typefilters by type (cardincludes cards in Apple Pay).limit(oritems) andpagepaginate.- The same card saved twice is listed twice, each with its own
id. Voided methods are left out. Today the methods that get saved are cards, including cards in Apple Pay. limitandpageanswer with thelink,current-page,total-pagesandtotal-countheaders, like every other list.- To check that a
payment_method_idbelongs to a customer, read it under that customer:GET /api/customers/{customer_id}/payment_methods/{id}answers404(code: payment_method_not_found) when it isn’t saved on them. GET /api/payment_methods/{id}returns a method by itsid, withcustomer_idnaming the customer it is saved on.GET /api/payment_methods?customer_id=is the same list as above.- If you run a platform, send
X-ACCOUNT-IDto read a connected account’s customers. - A card in Apple Pay (
card.wallet: "apple_pay") is saved again on every payment, so the same card can show up more than once.
Step 4: Charge later with a variable amount
When your system knows the amount to charge, create a one-time payment with the saved payment_method_id and the customer’s customer_id. With customer_id, Recurrente only accepts a method saved on that customer and books the charge to them, even when someone else’s card paid for it. Use a unique idempotency key per charge attempt to avoid duplicates if you need to retry the request.
Apple Pay is not offered in a mode: "setup" checkout; the method is saved when the customer pays an Apple Pay-compatible checkout. You can also use a method saved through Apple Pay (card.wallet: "apple_pay") with the customer’s agreement to future charges. It does not require a subscription authorization: it is processed as an independent charge using the stored token. A revoked permission or missing token prevents the charge; the bank can decline it even when the token exists. Cancelling the subscription that granted the permission also revokes it and blocks later independent charges using that method.
Successful response:
If the bank declines the charge, Recurrente returns an error and you should not reuse the same Idempotency-Key for a new charge attempt. Create a new attempt with a different key when the customer confirms they want to retry or updates their payment method.
Variable charges tied to a subscription
If the customer already has a subscription and you want to add variable charges, you have two options.
For Apple Pay, this subscription_id variant does not support mode: "now". Use mode: "next_cycle"; if the invoice exceeds the authorized amount, the customer must pay through the renewal link. This differs from the independent payment_method_id and items charge described above.
To immediately charge the subscription’s saved payment method:
To add the charge to the next subscription cycle:
mode: "next_cycle" creates a pending invoice_item. It also supports negative amounts for credits.
Update the saved card
When the customer needs to change cards, create another mode: "setup" checkout. After completion, store the new payment_method.id.
If the method belongs to a subscription, update it with:
If you only use variable charges with POST /api/one_time_payments, store the new payment_method_id in your system and use it for future charges.
Considerations
POST /api/one_time_paymentsrequires one-time payments to be enabled for your account.- The
payment_method_idmust belong to a customer in your account. Check it withGET /api/customers/{customer_id}/payment_methods/{id}. - Future charges can fail even if tokenization succeeded. Handle bank errors and let the customer update their card.
- Real webhooks are only sent for production events. To validate the complete tokenization flow, use a LIVE key; the
setupcheckout does not charge an amount. - Never collect or store raw card numbers directly. Always use the Recurrente-hosted checkout.

