Accéder directement au contenu
Créez un compte
ou
connectez-vous
Le logo de la documentation Stripe
/
Demander à l’IA
Créer un compte
Connectez-vous
Commencer
Paiements
Revenus
Plateformes et places de marché
Gestion des fonds
Ressources de développement
Aperçu
À propos des paiements Stripe
Mettre votre intégration à niveau
Analyses des paiements
Paiements en ligne
AperçuTrouver 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
Ajout de moyens de paiement
Gérer les moyens de paiement
Payer plus rapidement avec Link
Interfaces de paiement
Payment Links
Paiement
Web Elements
Elements dans l'application
Scénarios de paiement
Gérez plusieurs devises
Flux de paiement personnalisés
Acquisition flexible
Orchestration
Paiements en personne
Terminal
    Aperçu
    Accepter les paiements en personne
    Conception d'intégrations
    Choisir votre lecteur
    Créer une intégration
    Démarrage rapide
    Applications d'exemple
    Test
    Configuration de Terminal
    Configurer votre intégration
    Me 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 correspondance/téléphone
    Spécificités régionales
    Lors du paiement
    Collecter des pourboires
    Collecter et enregistrer des informations de paiement pour une utilisation ultérieure
    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, remplacer des lecteurs
    Enregistrer des lecteurs
    Gérer les emplacements et les zones
    Configurer des lecteurs
    Contrôler les lecteurs
    Chiffrement
    Références
    Documentation sur les API
    Lecteurs mobiles
    Lecteurs intelligents
    Guide de migration du SDK
    Liste de vérification pour le déploiement
    Fiches produit du lecteur Stripe Terminal
Au-delà des paiements
Constituer son entreprise
Cryptomonnaie
Financial Connections
Climate
Comprendre la fraude
Radar pour la protection contre la fraude
Gérer les litiges
Vérifier l'identité
AccueilPaiementsTerminal

Set up your integration

Set up a Stripe Terminal SDK or server-driven integration to accept in-person payments.

SDK Reference

If you’re looking for a more detailed reference with all available methods, objects, and errors, consult our full SDK reference.

Getting started with the iOS SDK requires four steps:

  1. Install the SDK in your app.
  2. Configure your app.
  3. Set up the connection token endpoint in your app and backend.
  4. Initialize the SDK in your app.

Install the SDK
Client-side

The Stripe Terminal iOS SDK is compatible with apps that:

  • Support iOS 13 and above
  • Are installed with CocoaPods, Swift Package Manager, or by manually integrating the framework
  1. If you haven’t already done so, install a recent version of CocoaPods.

  2. If you don’t have an existing Podfile, run the following command to create one:

    Command Line
    pod init
  3. Add this line to your Podfile:

    Podfile
    pod 'StripeTerminal', '~> 4.0'
  4. Run the following command:

    Command Line
    pod install
  5. From now on, use the .xcworkspace file to open your project in Xcode, instead of the .xcodeproj file.

Remarques

For details on the latest SDK release and past versions, see the Releases page on GitHub. To receive notifications when a new release is published, watch releases for the repository or subscribe to the Github Releases RSS feed.

For information on migrating from previous versions of the iOS SDK, see the Stripe Terminal SDK Migration Guide.

Configure your app
Client-side

To prepare your app to work with the Stripe Terminal SDK, make a few changes to your Info.plist file in Xcode.

  1. Enable location services with the following key-value pair.

    Privacy – Location When In Use Usage Description
    KeyNSLocationWhenInUseUsageDescription
    ValueLocation access is required to accept payments.

    To reduce fraud risks associated with payments, and to minimize disputes, Stripe must know where payments occur. If the SDK can’t determine the location of the iOS device, payments are disabled until location access is restored.

  2. Make sure that your app runs in the background and remains connected to Bluetooth readers.

    Required background modes for Bluetooth readers
    KeyUIBackgroundModes
    Valuebluetooth-central (Uses Bluetooth LE accessories)

    Setting the bluetooth-central background mode lets the reader remain in standby mode when your app is running in the background, or when the iOS device is locked. Without this value, standby fails. When your app is running in the background, the reader can turn off automatically to conserve power.

  3. Allow your app to display a Bluetooth permission dialog. The app store requires including this, even if your app doesn’t support connecting to Bluetooth readers.

    Privacy - Bluetooth Always Usage Description
    KeyNSBluetoothAlwaysUsageDescription
    ValueThis app uses Bluetooth to connect to supported card readers.

    iOS 13 introduced more specific permissions concerning an app’s use of Bluetooth peripherals. Apps that link with Core Bluetooth must include this key in their Info.plist file to prevent the app from crashing on its first launch.

  4. Pass app validation checks when you submit it to the App Store. As of SDK version 3.4.0, this permission requirement is removed.

    Privacy – Bluetooth Peripheral Usage Description
    KeyNSBluetoothPeripheralUsageDescription
    ValueConnecting to supported card readers requires Bluetooth access.

    This is an example—you can rephrase the prompt for user permission in your app.

Save your app’s Info.plist. Now it’s configured correctly and ready for use with the Stripe Terminal SDK.

Set up the ConnectionToken endpoint
Server-side
Client-side

Server-side

To connect to a reader, your backend needs to give the SDK permission to use the reader with your Stripe account, by providing it with the secret from a ConnectionToken. Your backend needs to only create connection tokens for clients that it trusts.

Command Line
curl
Ruby
Python
PHP
Java
Node
Go
.NET
No results
curl https://api.stripe.com/v1/terminal/connection_tokens \ -u
sk_test_BQokikJOvBiI2HlWgH4olfQ2
:
\ -X "POST"

Obtain the secret from the ConnectionToken on your server and pass it to the client side.

Ruby
Python
PHP
Java
Node
Go
.NET
No results
post '/connection_token' do token = # ... Create or retrieve the ConnectionToken {secret: token.secret}.to_json end

Avertissement

The secret from the ConnectionToken lets you connect to any Stripe Terminal reader and take payments with your Stripe account. Be sure to authenticate the endpoint for creating connection tokens and protect it from cross-site request forgery (CSRF).

Client-side

To give the SDK access to this endpoint, implement the ConnectionTokenProvider protocol in your app, which defines a single function that requests a ConnectionToken from your backend.

APIClient.swift
Swift
Objective-C
No results
import StripeTerminal // Example API client class for communicating with your backend class APIClient: ConnectionTokenProvider { // For simplicity, this example class is a singleton static let shared = APIClient() // Fetches a ConnectionToken from your backend func fetchConnectionToken(_ completion: @escaping ConnectionTokenCompletionBlock) { let config = URLSessionConfiguration.default let session = URLSession(configuration: config) guard let url = URL(string: "https://{{YOUR_BACKEND_URL}}/connection_token") else { fatalError("Invalid backend URL") } var request = URLRequest(url: url) request.httpMethod = "POST" let task = session.dataTask(with: request) { (data, response, error) in if let data = data { do { // Warning: casting using `as? [String: String]` looks simpler, but isn't safe: let json = try JSONSerialization.jsonObject(with: data, options: []) as? [String: Any] if let secret = json?["secret"] as? String { completion(secret, nil) } else { let error = NSError(domain: "com.stripe-terminal-ios.example", code: 2000, userInfo: [NSLocalizedDescriptionKey: "Missing `secret` in ConnectionToken JSON response"]) completion(nil, error) } } catch { completion(nil, error) } } else { let error = NSError(domain: "com.stripe-terminal-ios.example", code: 1000, userInfo: [NSLocalizedDescriptionKey: "No data in response from ConnectionToken endpoint"]) completion(nil, error) } } task.resume() } }

This function is called whenever the SDK needs to authenticate with Stripe or the Reader. It’s also called when a new connection token is needed to connect to a reader (for example, when your app disconnects from a reader). If the SDK can’t retrieve a new connection token from your backend, connecting to a reader fails with the error from your server.

Avertissement

Do not cache or hardcode the connection token. The SDK manages the connection token’s lifecycle.

Certificate pinning

In most cases, you shouldn’t configure your application with certificate pinning. If your application does require it, see the certificate pinning docs.

Initialize the SDK
Client-side

The Terminal class made available by the Stripe Terminal SDK exposes a generic interface for discovering readers, connecting to a reader, and performing operations on the reader, such as displaying cart details, collecting payments, and saving cards for future use.

To get started, provide your ConnectionTokenProvider implemented in Step 3. You can only call setTokenProvider once in your app, and must call it before accessing Terminal.shared. We recommend calling setTokenProvider in your AppDelegate’s application:didFinishLaunchingWithOptions method. Alternatively, you can use dispatch_once in Objective-C, or a static constructor in Swift.

AppDelegate.swift
Swift
Objective-C
No results
import UIKit import StripeTerminal @UIApplicationMain class AppDelegate: UIResponder, UIApplicationDelegate { func application(_ application: UIApplication, didFinishLaunchingWithOptions launchOptions: [UIApplication.LaunchOptionsKey : Any]? = nil) -> Bool { Terminal.setTokenProvider(APIClient.shared) // ... return true } // ... }

SDK updates

Stripe periodically releases updates which can include new functionality, bug fixes, and security updates. Update your SDK as soon as a new version is available. The currently available SDKs are:

  • Stripe Terminal Android SDK
  • Stripe Terminal iOS SDK
  • Stripe Terminal JavaScript SDK
  • Stripe Terminal React Native SDK

Next steps

  • Connect to a reader
Cette page vous a-t-elle été utile?
OuiNon
  • Besoin d'aide? Contactez le service d'assistance.
  • Rejoignez notre programme d'accès anticipé.
  • Consultez notre journal des modifications.
  • Des questions? Contactez l'équipe commerciale.
  • GML? Lire llms.txt.
  • Optimisé par Markdoc