Stripe | Financial Infrastructure to Grow Your Revenue

Stripe | Financial Infrastructure to Grow Your Revenue

4466 articles

Save payment details after payment


Save payment details after payment

Accept an in-person payment and save payment details to use later, when the customer is not present.

Accounts v2 API support

The Terminal SDK doesn’t support customer-configured Accounts. It only supports Customer objects. You can use Terminal with the Accounts v2 API if all of your customer code is on the server side and doesn’t use the SDK.

You can use Stripe Terminal to save payment details from an in-store purchase. A successful card_present payment returns a reusable card PaymentMethod in the generated_card attribute. There are several use cases:

  • A gym customer pays in person for an initial session and a membership subscription. The transaction sets up a generated _ card to use for future automatic membership renewals.
  • A customer at a clothing store provides their email address when making a purchase at the checkout counter. The transaction creates a customer record and an associated saved generated _ card . That allows the customer to log into the store’s website later and place an order using the same card.

Warning

The initial, in-person payment is a card-present transaction. All subsequent charges made using the generated_card are card-not-present (CNP) transactions, and features available to card-present transactions (such as liability shifts and pricing) don’t apply to these subsequent charges.

Create a customer

To set up a payment method for future payments, you must attach it to an object that represents your customer. When your customer creates an account or has their first transaction with your business, create either a customer-configured Account object with the Accounts v2 API or a Customer object with the Customers API.

Command Line

Select a language

cURL

Stripe CLI

Ruby

Python

PHP

Java

Node.js

Go

.NET

No results

Successful creation returns the customer-configured Account object. Inspect the object for the customer’s id and store the value in your database for later retrieval.

You can find these customers in the Customers page in the Dashboard.

Create a PaymentIntent

Request a generated_card when you create a PaymentIntent by specifying a value for setup_future_usage. If you intend to only reuse the payment method when the customer is present in the checkout flow, use on_session. Otherwise, use off_session.

Command Line

Select a language

cURL

Stripe CLI

Ruby

Python

PHP

Java

Node.js

Go

.NET

No results

Note

Visa, Mastercard, American Express, Discover, co-branded eftpos, co-branded Interac, and co-branded girocard cards are supported as card_present payment methods that can be saved as type card.

Collect and process a payment method

Note

This feature requires your API requests to include Stripe-Version: 2024-09-30.acacia or later. For guidance, see the changelog entry.

When the customer is ready to pay and has consented to their payment method details being saved, pass allow_redisplay as always or limited into the process_payment_intent or collect_payment_method Preview call. The value indicates the degree to which a payment method can be shown in a customer checkout flow.

Command Line

Select a language

cURL

Stripe CLI

Ruby

Python

PHP

Java

Node.js

Go

.NET

No results

Command Line

Select a language

cURL

Stripe CLI

Ruby

Python

PHP

Java

Node.js

Go

.NET

No results

If you use the collect_payment_method flow, which allows access to useful data like card brand and funding from the PaymentMethod before confirming it, you must also separately confirm the PaymentIntent.

Command Line

Select a language

cURL

Stripe CLI

Ruby

Python

PHP

Java

Node.js

Go

.NET

No results

Access the generated_card

A successful payment with a method that supports future use returns a PaymentIntent in the requires_capture or succeeded state. You can retrieve the generated_card payment method by expanding the PaymentIntent ’s latest_charge property and viewing payment_method_details.card_present. If you passed the customer’s ID when creating the PaymentIntent, the reusable PaymentMethod is automatically attached to the customer. Otherwise, you can manually attach it in a separate call.

Always verify that the PaymentIntent.latest_charge contains a generated_card value. Some payments, such as digital wallet payments and single-branded Interac, eftpos, or girocard card payments, might not create a generated card. If that happens, and you require a reusable payment method, you have two options:

  • Prompt the customer to save a different payment method using the flow to save a payment method without taking a payment .
  • Refund the in-person payment, indicate that the transaction failed, and instruct the customer to use a different payment method.

Mobile wallets considerations

You can only use saved mobile wallets for off_session payments that you initiate on behalf of your customer, such as recurring subscription payments. When you save a digital wallet payment method, the generated_card has allow_redisplay=limited, to indicate its specific usage considerations.

When you attempt to charge a mobile wallet, make sure to set off_session to true when confirming the PaymentIntent. If the customer is present in your checkout flow, you need to instead use the appropriate mobile wallet integration to prompt them for their payment method.

Compliance

You’re responsible for your compliance with all applicable laws, regulations, and network rules when saving a customer’s payment details. For example, the European Data Protection Board has issued guidance regarding saving payment details. These requirements generally apply if you want to save your customer’s payment method for future use. This applies in situations such as presenting a customer’s payment method to them in the checkout flow for a future purchase, or charging them when they’re not actively using your website or app, placing a the related setting order, or in your store.

Add terms to your checkout flow that state how you plan to save payment method details and allow customers to opt in. If you plan to charge the customer while they’re not actively checking out, make sure (at a minimum) that your terms also cover the following:

  • The customer’s agreement to your initiating a payment or a series of payments on their behalf for specified transactions.
  • The anticipated timing and frequency of payments (for instance, whether charges are for scheduled installment or subscription payments, or for unscheduled top-ups).
  • How the payment amount is determined.
  • Your cancellation policy, if you’re setting up the payment method for a subscription service.

Make sure you keep a record of your customer’s written agreement to these terms.

When you save a payment method, you can only use it for the specific purpose that you included in your terms. If you want to charge customers when they’re not actively checking out and also save the customer’s payment method to present to them as a saved payment method for future purchases, you must explicitly collect consent from the customer. One way to do so is with a “Save my payment method for future use” checkbox.

Last verified 2026-09-24

Is this helpful?