Accéder directement au contenu
Créez un compte
ou
connecter-vous
Logo de la documentation Stripe
/
Ask AI
Créez un compte
Connectez-vous
Démarrer
Paiements
Automatisation des opérations financières
Plateformes et places de marché
Gestion de fonds
Outils de développement
Démarrer
Paiements
Automatisation des opérations financières
Démarrer
Paiements
Automatisation des opérations financières
Plateformes et places de marché
Gestion de fonds
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
    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
    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 payment details after payment

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

Copier la 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"

Remarque

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

SDK Reference

  • collectPaymentMethod (iOS)

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

PaymentViewController.swift
Swift
import UIKit import StripeTerminal class PaymentViewController: UIViewController, ReaderDisplayDelegate { // Label for displaying messages from the card reader let readerMessageLabel = UILabel(frame: .zero) var collectCancelable: Cancelable? = nil // ... // Action for a "Subscribe" button func subscribeAction() throws { let params = try PaymentIntentParametersBuilder().setCustomer(
"{{CUSTOMER_ID}}"
).build() Terminal.shared.createPaymentIntent(params) { createResult, createError in if let error = createError { print("createPaymentIntent failed: \(error)") } else if let paymentIntent = createResult { print("createPaymentIntent succeeded") let config = try CollectConfigBuilder().setAllowRedisplay(AllowRedisplay.always).build() self.collectCancelable = Terminal.shared.collectPaymentMethod(paymentIntent, config) { collectResult, collectError in if let error = collectError { print("collectPaymentMethod failed: \(error)") } else if let collectPaymentMethodPaymentIntent = collectResult { print("collectPaymentMethod succeeded") // ... Confirm the PaymentIntent Terminal.shared.confirmPaymentIntent(collectPaymentMethodPaymentIntent) { confirmResult, confirmError in if let error = confirmError { print("confirmPaymentIntent failed: \(error)") } else if let confirmedPaymentIntent = confirmResult { print("confirmPaymentIntent succeeded") } } } } } } }

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.

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