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. - 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.
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.
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. Use a unique idempotency key per charge attempt to avoid duplicates if you need to retry the request.
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.
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. - 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.

