Save card details after payment
Take an in-person payment and save card details to use later, when the cardholder is not physically present.
You can use Stripe Terminal to save payment details from an in-store card purchase. A successful card_
payment returns a reusable card
PaymentMethod in the generated_
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_
to use for future automatic membership renewals.card - 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_
. That allows the customer to log into the store’s website later and place an order using the same card.card
The initial, in-person payment benefits from liability shift and, in certain markets, lower pricing for standard Terminal payments. However, subsequent payments using the generated_
are card-not-present online transactions, without the liability shift.
Notiz
Digital wallet payments such as Apple Pay or Google Pay can’t be saved and don’t create a generated_
. However, for businesses in certain verticals, Stripe offers a limited private beta feature that allows you to save digital wallet payment methods. To request access, contact stripe-terminal-betas@stripe.com.
Create a customer
To set a card up for future payments, you must attach it to a Customer. Create a Customer object when your customer creates an account with your business. Customer objects allow for reusing payment methods and tracking across multiple payments.
Successful creation returns the Customer object. You can inspect the object for the customer 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_
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_
. Otherwise, use off_
.
Notiz
Visa, Mastercard, American Express, Discover, and co-branded eftpos cards are supported as card_
payment methods that can be saved as type card
.
Collect and process a payment method
When the customer is ready to pay and has consented to their card details being saved, pass allow_redisplay as always
or limited
into the process_
or collect_
beta call. The value indicates the degree to which a payment method can be shown in a customer checkout flow.
If you use the collect_
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.
Access the generated_card
A successful payment with a card that supports future use returns a PaymentIntent in the requires_
or succeeded
state, with a generated_
attribute containing the reusable PaymentMethod. If you passed the customer ID into the PaymentIntent creation call, the reusable PaymentMethod is automatically attached to the Customer object. Otherwise, you can manually attach it in a separate call.
Always verify that the PaymentIntent.latest_charge contains a generated_
value. Digital wallet payments might not create a generated card. If that happens, and you require a reusable payment method, you have two options:
- Prompt the cardholder to save a different card using the flow to save a card without taking a payment.
- Refund the in-person payment, indicate that the transaction failed, and instruct the cardholder to use a different card.
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, 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.
Add terms to your website or app 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 offline, then at a minimum, make sure 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, it can only be used for the specific usage that you included in your terms. If you want to charge customers when they’re offline 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.
Saving digital walletsBetaversion
If your MCC is in one of the following ranges, you might be eligible to participate in a limited beta for saving digital wallet payment methods. For more details, contact stripe-terminal-betas@stripe.com.
- Car Rental Agencies (3351 - 3500)
- Lodging – Hotels, Motels, Resorts (3501 - 3999)
- Steamship and Cruise Lines (4411)
- Boat Rentals and Leasing (4457)
- Lodging - Hotels, Motels, Resorts, Central Reservations Services (Not Elsewhere Classified) (7011)
- Trailer Parks and Campgrounds (7033)
- Equipment, Tool, Furniture, and Appliance Rental and Leasing (7394)
- Car Rental Agencies (Not Elsewhere Classified) (7512)
- Truck and Utility Trailer Rentals (7513)
- Motor Home and Recreational Vehicle Rentals (7519)
When you save a digital wallet payment method, the generated_
has allow_
, because checkout flows are prohibited from presenting saved digital wallets as a payment option. You can only charge saved digital wallet payment methods for off_session payments.