Accéder directement au contenu
Créez un compte
ou
connecter-vous
Logo de la documentation Stripe
/
Demander à l'assistant IA
Créez un compte
Connectez-vous
Démarrer
Paiements
Revenus
Plateformes et places de marché
Gestion de fonds
Outils de développement
Aperçu
À propos des paiements Stripe
Mettre votre intégration à niveau
Analyses des paiements
Paiements en ligne
PrésentationTrouver votre cas d'usageManaged Payments
Utiliser Payment Links
Créer une page de paiement
Développer une intégration avancée
Développer une intégration dans l'application
Moyens de paiement
Ajouter des moyens de paiement
Gérer les moyens de paiement
Paiement accéléré avec Link
Interfaces de paiement
Payment Links
Checkout
Web Elements
Elements intégrés à l'application
Scénarios de paiement
Tunnels de paiement personnalisés
Acquisition flexible
Orchestration
Paiements par TPE
Terminal
    Présentation
    Accepter les paiements par TPE
    Conception d'intégration
    Choisir votre lecteur
    Concevoir une intégration
    Démarrage rapide
    Exemples d'applications
    Tests
    Configuration de Terminal
    Configurer votre intégration
    Se connecter à un lecteur
    Acceptation d'un paiement
    Encaisser des paiements par carte
    Autres moyens de paiement
    Accepter les paiements hors ligne
    Paiement des commande par courrier/par téléphone
    Spécificités régionales
    Lors du règlement
    Collecter des pourboires
    Collecter et enregistrer des informations de paiement pour une utilisation ultérieure
      Enregistrer la carte avant achat
      Enregistrer la carte après le paiement
    Autorisations flexibles
    Après le paiement
    Rembourser des transactions
    Fournir des reçus
    Personnalisez Checkout
    Affichage du panier
    Collecter les données saisies à l'écran
    Collecter les données des lectures de la piste magnétique
    Collecter les données des paiements NFC sans contact
    Applications sur des appareils
    Gérer les lecteurs
    Commander, renvoyer ou remplacer des lecteurs
    Enregistrer des lecteurs
    Gérer les emplacements et les zones
    Configurer des lecteurs
    Suivre les lecteurs
    Chiffrement
    Références
    Documentation de l'API
    Lecteurs mobiles
    Lecteurs intelligents
    Guide de migration du SDK
    Liste de contrôle pour le déploiement
    Fiches produit du lecteur Stripe Terminal
Autres produits Stripe
Financial Connections
Cryptomonnaies
Climate
AccueilPaiementsTerminalCollect and save payment details for future use

Remarque

Cette page n'est pas encore disponible dans cette langue. Nous faisons tout notre possible pour proposer notre documentation dans davantage de langues et nous vous fournirons la version traduite dès qu'elle sera disponible.

Save directly without charging

Collect details of a present card and save them for online use.

Copier la page

Use SetupIntents to collect card or mobile wallet details without charging the card. A SetupIntent can’t save a card_present PaymentMethod directly, but in most cases you can create a reusable generated_card PaymentMethod that represents the same card. From your customer’s perspective, they’re the same payment method.

You can use SetupIntents to collect card details on Visa, Mastercard, American Express, Discover, and co-branded Interac, eftpos, and girocard cards. SetupIntents don’t support single-branded Interac, eftpos, and girocard cards.

Saving cards with Stripe Terminal using SetupIntents requires you to:

  1. Create or retrieve a Customer object.
  2. Create a SetupIntent object to track the process.
  3. Collect a payment method after collecting the customer’s consent.
  4. Submit the payment method details to Stripe.

Remarque

We’ve changed the customer consent model of this feature to require the allow_redisplay parameter instead of the legacy customer_consent_collected parameter. If your integration uses customer_consent_collected, you must update your integration to use allow_redisplay. This update became mandatory on March 31, 2025 for non-React Native users, and is mandatory for React Native users on September 30, 2025. For guidance, see the changelog entry.

Remarque

Your applications must be on version 2.x of the SDK to use SetupIntents. View our migration guide to learn more.

Create or retrieve a customer

To charge a card saved with Stripe, you must attach it to a Customer.

When you include a customer in your SetupIntent before confirming, Stripe automatically attaches the generated card payment method to the Customer object you provide.

Include the following code on your server to create a new Customer.

Command Line
cURL
curl -X POST https://api.stripe.com/v1/customers \ -u "
sk_test_BQokikJOvBiI2HlWgH4olfQ2
:"

Create a SetupIntent

Remarque

We recommend providing a customer ID while creating a SetupIntent—doing so attaches the card payment method to the Customer upon successful setup. If you don’t provide a customer ID, you must attach the payment method in a separate call.

A SetupIntent is an object that represents your intent to set up a customer’s payment method for future payments. The SetupIntent tracks the steps of this setup process. For Terminal, this includes collecting and recording cardholder consent.

SDK Reference

  • SetupIntentParameters (Android)

You can create a SetupIntent providing the customer, onBehalfOf (Connect only), and usage parameters.

PaymentActivity.kt
Kotlin
val params = SetupIntentParameters.Builder() .setCustomer(
"{{CUSTOMER_ID}}"
) .build() Terminal.getInstance().createSetupIntent( params, object : SetupIntentCallback { override fun onSuccess(setupIntent: SetupIntent) { // Placeholder for handling successful operation } override fun onFailure(e: TerminalException) { // Placeholder for handling exception } } )

If the information required to start a payment isn’t readily available in your app, you can create the SetupIntent on your server. Use the client secret to call retrieveSetupIntent, and, then use the retrieved SetupIntent to call collectSetupIntentPaymentMethod.

SDK Reference

  • retrieveSetupIntent (Android)

Collect a payment method for saving

SDK Reference

  • collectSetupIntentPaymentMethod (Android)

After you create a SetupIntent, you need to collect a payment method using the SDK and collect customer consent. Pass allowRedisplay as always or limited, indicating the degree to which a payment method can be shown in a customer checkout flow.

After you create a SetupIntent, you need to collect a payment method with the SDK and collect customer consent. If the customer provides the required form of agreement or consent, set the customerConsentCollected Boolean to true.

Remarque

Collect customer consent verbally or with a checkbox in your application. You must comply with all applicable laws, rules, and regulations in your region.

To collect a payment method, make sure that you’re connected to a reader. The connected reader waits for a card after your app calls collectSetupIntentPaymentMethod .

PaymentActivity.kt
Kotlin
val cancelable = Terminal.getInstance().collectSetupIntentPaymentMethod( setupIntent, AllowRedisplay.ALWAYS, callback = object : SetupIntentCallback { override fun onSuccess(setupIntent: SetupIntent) { // Placeholder for handling successful operation } override fun onFailure(e: TerminalException) { // Placeholder for handling exception } } )

This method collects encrypted payment method data using the connected card reader, and associates the encrypted data with the SetupIntent.

Mise en garde

Collecting a payment method happens locally and requires no authorization or updates to the SetupIntent object until the next step.

Cancel collection

Programmatic cancellation

You can cancel collecting a payment method by using the Cancelable object returned by the SDK.

Customer-initiated cancellation

When you set setEnableCustomerCancellation to true for a transaction, smart reader users see a cancel button. Tapping the cancel button cancels the active transaction.

PaymentActivity.kt
Kotlin
Terminal.getInstance().collectSetupIntentPaymentMethod( setupIntent, AllowRedisplay.ALWAYS, SetupIntentConfiguration.Builder() .setEnableCustomerCancellation(true) .build(), object : SetupIntentCallback { override fun onSuccess(setupIntent: SetupIntent) { // Placeholder for handling successful operation } override fun onFailure(e: TerminalException) { // Placeholder for handling exception } } )

Submit the payment method details to Stripe

SDK Reference

  • confirmSetupIntent (Android)

Use confirmSetupIntent to complete the setup.

A successful setup returns a succeeded value for the SetupIntent’s status property, along with a SetupAttempt.payment_method_details.card_present.generated_card, which is a reusable card payment method you can use for online payments.

Remarque

The SetupIntent.payment_method is a card_present PaymentMethod that represents the tokenization of the physically present card and isn’t chargeable online. Future payments use the generated card instead. From the customer’s perspective, they’re the same payment method.

The generated_card payment method automatically attaches to the customer you provided during SetupIntent creation. You can retrieve the generated_card payment method by expanding the SetupIntent’s latest_attempt property. Always check for a generated_card value, because for payment methods that don’t allow generated cards, the value is empty.

Command Line
cURL
curl -G https://api.stripe.com/v1/setup_intents/
{{SETUP_INTENT_ID}}
\ -u "
sk_test_BQokikJOvBiI2HlWgH4olfQ2
:"
\ -d "expand[]"=latest_attempt

Alternatively, you can retrieve the attached payment method by fetching the list of payment methods that gets attached to the customer.

Command Line
cURL
curl -G https://api.stripe.com/v1/customers/
{{CUSTOMER_ID}}
/payment_methods
\ -u "
sk_test_BQokikJOvBiI2HlWgH4olfQ2
:"
\ -d type=card

If you didn’t provide a customer during SetupIntent creation, you can attach the generated_card to a Customer object in a separate call.

Command Line
cURL
curl https://api.stripe.com/v1/payment_methods/
{{PAYMENT_METHOD_ID}}
/attach
\ -u "
sk_test_BQokikJOvBiI2HlWgH4olfQ2
:"
\ -d customer=
{{CUSTOMER_ID}}

If the setup isn’t successful, inspect the returned error to determine the cause. For example, failing to collect and notify Stripe of customer consent results in an error.

PaymentActivity.kt
Kotlin
val cancelable = Terminal.getInstance().confirmSetupIntent(setupIntent, object : SetupIntentCallback { override fun onSuccess(setupIntent: SetupIntent) { // Placeholder for handling successful operation } override fun onFailure(e: TerminalException) { // Placeholder for handling exception } } )

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.

Cette page vous a-t-elle été utile ?
OuiNon
Besoin d'aide ? Contactez le service Support.
Rejoignez notre programme d'accès anticipé.
Consultez notre log des modifications.
Des questions ? Contactez l'équipe commerciale.
LLM ? Lire llms.txt.
Propulsé par Markdoc