Skip to content
Create account
or
Sign in
The Stripe Docs logo
/
Ask AI
Create account
Sign in
Get started
Payments
Finance automation
Platforms and marketplaces
Money management
Developer tools
Get started
Payments
Finance automation
Get started
Payments
Finance automation
Platforms and marketplaces
Money management
Overview
About Stripe payments
Upgrade your integration
Payments analytics
Online payments
OverviewFind your use caseManaged Payments
Use Payment Links
Build a checkout page
Build an advanced integration
Build an in-app integration
Payment methods
Add payment methods
Manage payment methods
Faster checkout with Link
Payment interfaces
Payment Links
Checkout
Web Elements
In-app Elements
Payment scenarios
Custom payment flows
Flexible acquiring
Orchestration
In-person payments
Terminal
    Overview
    Accept in-person payments
    Integration design
    Select your reader
    Design an integration
    Quickstart
    Example applications
    Terminal setup
    Set up your integration
    Connect to a reader
    Accepting a payment
    Collect card payments
    Accept offline payments
    Mail order and telephone order payments
    Regional considerations
    During checkout
    Collect tips
    Collect and save payment details for future use
      Save directly without charging
      Save after payment
    Flexible authorizations
    After checkout
    Refund transactions
    Provide receipts
    Customize checkout
    Cart display
    Collect on-screen inputs
    Collect swiped data
    Apps on devices
    Manage readers
    Order, return, replace readers
    Register readers
    Manage locations and zones
    Configure readers
    Encryption
    References
    API references
    Mobile readers
    Smart readers
    SDK migration guide
    Testing
    Deployment checklist
    Stripe Terminal reader product sheets
Other Stripe products
Financial Connections
Crypto
Climate
HomePaymentsTerminalCollect and save payment details for future use

Save payment details after payment

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

Copy page

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.

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_card are card-not-present online transactions, without the liability shift.

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.

Command Line
cURL
curl https://api.stripe.com/v1/customers \ -u "
sk_test_BQokikJOvBiI2HlWgH4olfQ2
:"
\ -d name="Jenny Rosen" \ --data-urlencode email="jennyrosen@example.com"

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

API Reference

  • 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
curl
curl https://api.stripe.com/v1/payment_intents \ -u
sk_test_BQokikJOvBiI2HlWgH4olfQ2
:
\ -d "setup_future_usage"="off_session" \ -d "customer"="{{CUSTOMER_ID}}" \ -d "amount"=1000 \ -d "currency"="usd" \ -d "payment_method_types[]"="card_present"

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

API Reference

  • process_payment_intent

API Reference

  • collect_payment_method

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_methodPreview call. The value indicates the degree to which a payment method can be shown in a customer checkout flow.

Command Line
cURL
curl https://api.stripe.com/v1/terminal/readers/{{READER_ID}}/process_payment_intent \ -u "
sk_test_BQokikJOvBiI2HlWgH4olfQ2
:"
\ -d payment_intent={{PAYMENT_INTENT_ID}} \ -d "process_config[allow_redisplay]"=always
Command Line
cURL
curl https://api.stripe.com/v1/terminal/readers/{{READER_ID}}/collect_payment_method \ -u "
sk_test_BQokikJOvBiI2HlWgH4olfQ2
:"
\ -d payment_intent={{PAYMENT_INTENT_ID}} \ -d "collect_config[allow_redisplay]"=always

API Reference

  • confirm_payment_intent

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
cURL
curl https://api.stripe.com/v1/terminal/readers/{{READER_ID}}/confirm_payment_intent \ -u "
sk_test_BQokikJOvBiI2HlWgH4olfQ2
:"
\ -d payment_intent={{PAYMENT_INTENT_ID}}

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 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_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

Saved mobile wallets is only for off_session payments such as future subscription or other payments you initiate on behalf of your customer. 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 pass off_session=true during PaymentIntent confirmation. If the customer is present in your checkout flow, you will need to instead use the Apple Pay and Google Pay integrations to re-prompt for payment method presentment.

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.

Was this page helpful?
YesNo
Need help? Contact Support.
Join our early access program.
Check out our changelog.
Questions? Contact Sales.
LLM? Read llms.txt.
Powered by Markdoc