# Set up future Cash App Pay payments Learn how to save Cash App Pay details and charge your customers later. This guide covers how to save a Cash App Pay payment details using [Checkout](https://docs.stripe.com/payments/checkout.md), our fully hosted checkout page. To create recurring payments after saving a payment method in Checkout, see [Set up a subscription with Cash App Pay](https://docs.stripe.com/billing/subscriptions/cash-app-pay.md) for more details. ## Set up Stripe [Server-side] First, you need a Stripe account. [Register now](https://dashboard.stripe.com/register). Use our official libraries for access to the Stripe API from your application: #### Ruby ```bash # Available as a gem sudo gem install stripe ``` ```ruby # If you use bundler, you can add this line to your Gemfile gem 'stripe' ``` ## Create or retrieve a customer [Server-side] To reuse a Cash App Pay payment method for future payments, attach it to an object that represents your customer. > #### Utilisez l’API Accounts v2 pour représenter les clients > > L’API Accounts v2 est désormais accessible à tous les utilisateurs de Connect et disponible en version bêta publique pour les autres utilisateurs de Stripe. Si vous participez à la version bêta d’Accounts v2, vous devez [indiquer une version bêta](https://docs.stripe.com/api-v2-overview.md#sdk-and-api-versioning) dans votre code. > > Pour demander l’accès à la version bêta d’Accounts v2, > > Dans la plupart des cas d’usage, nous vous recommandons de [modéliser vos clients en tant qu’objets Account](https://docs.stripe.com/accounts-v2/use-accounts-as-customers.md) configurés par le client plutôt que d’utiliser des objets [Customer](https://docs.stripe.com/api/customers.md). Create a customer-configured [Account](https://docs.stripe.com/api/v2/core/accounts/create.md#v2_create_accounts-configuration-customer) or [Customer](https://docs.stripe.com/api/customers/create.md) when your customer creates an account with your business, or when saving a payment method. Associate the object’s ID with your own internal representation of a customer. Create a new customer or retrieve an existing one to associate with this payment. #### Accounts v2 ```curl curl -X POST https://api.stripe.com/v2/core/accounts \ -H "Authorization: Bearer <>" \ -H "Stripe-Version: 2026-05-27.preview" \ --json '{ "contact_email": "jenny.rosen@example.com", "display_name": "Jenny Rosen", "configuration": { "customer": {} }, "include": [ "configuration.customer" ] }' ``` #### Customers v1 ```curl curl https://api.stripe.com/v1/customers \ -u "<>:" \ -d "name=Jenny Rosen" \ --data-urlencode "email=jenny.rosen@example.com" ``` ## Create a Checkout Session [Server-side] Your customer must authorize you to use their Cash App account for future payments through Stripe Checkout. This allows you to accept Cash App payments. Add a checkout button to your website that calls a server-side endpoint to create a [Checkout Session](https://docs.stripe.com/api/checkout/sessions.md). ```html Checkout
``` Create a Checkout Session in `setup` mode to collect the required information. After creating the Checkout Session, redirect your customer to the [URL](https://docs.stripe.com/api/checkout/sessions/object.md#checkout_session_object-url) returned in the response. #### Ruby ```ruby client.v1.checkout.sessions.create({ mode: 'setup',payment_method_types: ['card', 'cashapp'], customer: customer.id, success_url: 'https://example.com/success', }) ``` ## Test your integration [Server-side] #### Mobile web app testing To test your integration, choose Cash App Pay as the payment method and tap **Pay**. While testing, this redirects you to a test payment page where you can approve or decline the payment. In live mode, tapping **Pay** redirects you to the Cash App mobile application—you don’t have the option to approve or decline the payment within Cash App. The payment is automatically approved after the redirect. #### Desktop web app testing To test your integration, scan the QR code with a QR code scanning application on your mobile device. While testing, the QR code payload contains a URL that redirects you to a test payment page where you can approve or decline the test payment. In live mode, scanning the QR code redirects you to the Cash App mobile application—you don’t have the option to approve or decline the payment within Cash App. The payment is automatically approved after you scan the QR code. # Direct API > This is a Direct API for when payment-ui is direct-api. View the full page at https://docs.stripe.com/payments/cash-app-pay/set-up-payment?payment-ui=direct-api. You can use the [Setup Intents API](https://docs.stripe.com/payments/setup-intents.md) to collect payment method details in advance, and determine the final amount or payment date later. Use it to: - Save payment methods to a wallet to streamline future purchases - Collect surcharges after fulfilling a service - [Start a free trial for a subscription](https://docs.stripe.com/billing/subscriptions/trials.md) To collect payment method details and charge the saved payment method immediately, use the Payment Intents API. To create recurring payments after saving a payment method in Checkout, see [Set up a subscription with Cash App Pay](https://docs.stripe.com/billing/subscriptions/cash-app-pay.md) for more details. ## Set up Stripe [Server-side] First, you need a Stripe account. [Register now](https://dashboard.stripe.com/register). Use our official libraries for access to the Stripe API from your application: #### Ruby ```bash # Available as a gem sudo gem install stripe ``` ```ruby # If you use bundler, you can add this line to your Gemfile gem 'stripe' ``` ## Create or retrieve a customer [Server-side] To save a Cash App Pay payment method for future payments, attach it to an object that represents your customer. > #### Utilisez l’API Accounts v2 pour représenter les clients > > L’API Accounts v2 est désormais accessible à tous les utilisateurs de Connect et disponible en version bêta publique pour les autres utilisateurs de Stripe. Si vous participez à la version bêta d’Accounts v2, vous devez [indiquer une version bêta](https://docs.stripe.com/api-v2-overview.md#sdk-and-api-versioning) dans votre code. > > Pour demander l’accès à la version bêta d’Accounts v2, > > Dans la plupart des cas d’usage, nous vous recommandons de [modéliser vos clients en tant qu’objets Account](https://docs.stripe.com/accounts-v2/use-accounts-as-customers.md) configurés par le client plutôt que d’utiliser des objets [Customer](https://docs.stripe.com/api/customers.md). Create a customer-configured [Account](https://docs.stripe.com/api/v2/core/accounts/create.md#v2_create_accounts-configuration-customer) or [Customer](https://docs.stripe.com/api/customers/create.md) when your customer creates an account with your business, or when saving a payment method. Associate the object’s ID with your own internal representation of a customer. Create a new customer or retrieve an existing one to associate with this payment. #### Accounts v2 ```curl curl -X POST https://api.stripe.com/v2/core/accounts \ -H "Authorization: Bearer <>" \ -H "Stripe-Version: 2026-05-27.preview" \ --json '{ "contact_email": "jenny.rosen@example.com", "display_name": "Jenny Rosen", "configuration": { "customer": {} }, "include": [ "configuration.customer" ] }' ``` #### Customers v1 ```curl curl https://api.stripe.com/v1/customers \ -u "<>:" \ -d "name=Jenny Rosen" \ --data-urlencode "email=jenny.rosen@example.com" ``` ## Present authorization terms on your payment form [Côté client] Save your customer’s Cash App Pay credentials([$Cashtag](https://cash.app/help/us/en-us/3123-cashtags)) to charge their account for future, *off-session* (A payment is described as off-session if it occurs without the direct involvement of the customer, using previously-collected payment information) payments. Your custom payment form must present a written notice of authorization before confirming the [PaymentIntent](https://docs.stripe.com/api/payment_intents.md) or [SetupIntent](https://docs.stripe.com/api/setup_intents.md). The authorization terms only need to be displayed the first time you save a customer’s $Cashtag. We recommend that you use the following text for your custom payment form: > By continuing, you authorize Rocket Rides to debit your Cash App account for this payment and future payments in accordance with Rocket Rides's terms, until this authorization is revoked. You can change this anytime in your Cash App Settings. #### Save a payment method with the Setup Intents API Use the [Setup Intents API](https://docs.stripe.com/payments/setup-intents.md) to collect payment method details in advance and determine the final amount or payment date at a later point. This is useful for: - Saving payment methods for customers so their later purchases don’t require authentications - Starting a free trial for a *subscription* (A Subscription represents the product details associated with the plan that your customer subscribes to. Allows you to charge the customer on a recurring basis) ## Create a SetupIntent and save a payment method [Server-side] A [SetupIntent](https://docs.stripe.com/api/setup_intents.md) 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. Create a `SetupIntent` on your server: - Add `cashapp` to the [payment_method_types](https://docs.stripe.com/api/setup_intents/create.md#create_setup_intent-payment_method_types) array - Specify the customer’s ID - Set [usage](https://docs.stripe.com/api/setup_intents/create.md#create_setup_intent-usage) to `off_session` or `on_session` #### Accounts v2 ```curl curl https://api.stripe.com/v1/setup_intents \ -u "<>:" \ -d "payment_method_types[]=cashapp" \ -d "payment_method_data[type]=cashapp" \ -d usage=off_session \ -d "customer_account={{CUSTOMERACCOUNT_ID}}" ``` #### Customers v1 ```curl curl https://api.stripe.com/v1/setup_intents \ -u "<>:" \ -d "payment_method_types[]=cashapp" \ -d "payment_method_data[type]=cashapp" \ -d usage=off_session \ -d "customer={{CUSTOMER_ID}}" ``` ### Récupérer la clé secrète du client L’objet SetupIntent comprend une *clé secrète du client* (The client secret is a unique key returned from Stripe as part of a PaymentIntent. This key lets the client access important fields from the PaymentIntent (status, amount, currency) while hiding sensitive ones (metadata, customer)) utilisée côté client pour effectuer le processus de paiement en toute sécurité. Vous pouvez utiliser différentes approches pour transmettre cette clé au côté client. #### Application monopage Récupérez la clé secrète du client à partir d’un point de terminaison sur votre serveur, en utilisant la fonction `fetch` du navigateur. Cette approche est préférable si votre côté client est une application d’une page, en particulier si celle-ci a été créée avec un cadre d’application frontal récent comme React. Créez le point de terminaison du serveur pour récupérer la clé secrète du client : #### Ruby ```ruby get '/secret' do intent = # ... Create or retrieve the SetupIntent {client_secret: intent.client_secret}.to_json end ``` Ensuite, récupérez la clé secrète du client avec JavaScript côté client: ```javascript (async () => { const response = await fetch('/secret'); const {client_secret: clientSecret} = await response.json(); // Render the form using the clientSecret })(); ``` #### Rendu côté serveur Transmettez la clé secrète du client depuis votre serveur. Cette approche fonctionne mieux si votre application génère du contenu statique sur le serveur avant de l’envoyer au navigateur. Ajoutez le champ [client_secret](https://docs.stripe.com/api/setup_intents/object.md#setup_intent_object-client_secret) dans votre formulaire de paiement. Dans le code côté serveur, récupérez la clé secrète du client à partir du SetupIntent : #### Ruby ```erb
``` ```ruby get '/checkout' do @intent = # ... Fetch or create the SetupIntent erb :checkout end ``` Next, you save Cash App Pay on the client with [Stripe.js](https://docs.stripe.com/payments/elements.md). Pour intégrer le script Stripe.js à votre page de paiement, ajoutez-le entre les balises `head` de votre fichier HTML. ```html Checkout ``` Create an instance of Stripe.js with the following JavaScript on your checkout page: ```javascript // Set your publishable key. Remember to change this to your live publishable key in production! // See your keys here: https://dashboard.stripe.com/apikeys const stripe = Stripe('<>'); ``` Use `stripe.confirmCashappSetup` to confirm the setupIntent on the client side, with a [return_url](https://docs.stripe.com/api/setup_intents/create.md#create_setup_intent-return_url) and an optional [mandate_data](https://docs.stripe.com/api/setup_intents/create.md#create_setup_intent-mandate_data). Use the [return_url](https://docs.stripe.com/api/setup_intents/create.md#create_setup_intent-return_url) to redirect customers to a specific page after the SetupIntent succeeds. ```javascript const form = document.getElementById('setup-form'); form.addEventListener('submit', function(event) { event.preventDefault(); // Set the clientSecret here stripe.confirmCashappSetup( clientSecret, { payment_method: { type: 'cashapp', }, return_url: 'https://www.example.com/checkout/done', }, ); }); ``` Customers can authenticate Cash App Pay with mobile or desktop apps. After calling `confirmCashappSetup`, the client the customer uses determines the authentication method such as redirect for mobile or QR code for desktop. The authentication response also includes a payment method ID that you need to use in the next step to make a PaymentIntent. #### Mobile application authentication After calling `confirmCashappSetup`, Stripe redirects your customers to Cash App for authorization. After they authorize the payment, Stripe sends them to the Setup Intent’s `return_url`. Stripe adds `setup_intent`, `setup_intent_client_secret`, `redirect_pm_type`, and `redirect_status` as URL query parameters, along with any existing query parameters in the `return_url`. An authentication session expires after 10 minutes, and the SetupIntent’s status transitions back to `require_payment_method`. After the status transitions, the customer sees an authorization error and must restart the process. #### Desktop web app authentication After calling `confirmCashappSetup`, a QR code displays on the webpage. Your customers can scan the QR code using either their mobile device’s camera or the Cash App mobile application to finish authorization session. A few seconds after authentication successfully, the QR code modal closes automatically. An authentication session expires after 10 minutes. You can refresh the QR code up to 20 times before the SetupIntent’s status transitions back to `require_payment_method`. After the status transitions, the customer sees an authorization error and must restart the process. ## Optional: Handle redirect and authentication manually We recommend using Stripe.js to handle redirects and authentication with `confirmCashappSetup`. However, you can also handle redirects and authentication manually on your server. Specify `handleActions: false` in the `confirmCashappSetup` call. ```javascript const form = document.getElementById('payment-form'); form.addEventListener('submit', function(event) { event.preventDefault(); // Set the clientSecret here you got in Step 2 stripe.confirmCashappSetup( clientSecret, { payment_method: { type: 'cashapp', }, return_url: 'https://www.example.com/checkout/done', }, { handleActions: false }, ).then((result) => { if (result.error) { // Display error to your customer. } else if (result.paymentIntent.status === "requires_action") { const nextAction = result.setupIntent.next_action.cashapp_handle_redirect_or_display_qr_code; const expiresAt = nextAction.qr_code.expires_at; if (IS_MOBILE) { // This URL redirects the customer to Cash App to approve or decline the payment. const mobileAuthUrl = nextAction.mobile_auth_url; } else if (IS_DESKTOP) { // Render the QR code and display it to the customer using the below image source. const imageUrlSvg = nextAction.qr_code.image_url_svg; const imageUrlPng = nextAction.qr_code.image_url_png; } } }); }); ``` The SetupIntent response includes the status `requires_action`, which means your users must perform another action to complete saving the payment method. #### Mobile application authentication If a customer is saving a Cash App Pay payment method on a mobile device: 1. Redirect the customer to the URL set as the `next_action.cashapp_handle_redirect_or_display_qr_code.mobile_auth_url` property from the SetupIntent response. This redirects the customer to Cash App, where they can finish the authentication session. 1. The `mobile_auth_url` expires after 30 seconds. If the customer isn’t redirected to `mobile_auth_url` before expiration, call [stripe.retrieveSetupIntent](https://docs.stripe.com/js/setup_intents/retrieve_setup_intent) to get a new `mobile_auth_url`. #### Desktop web app authentication If a customer is saving a Cash App Pay payment method on a desktop web app: 1. Redirect the customer to the URL set as the `next_action.cashapp_handle_redirect_or_display_qr_code.hosted_instructions_url` property from the SetupIntent response. 1. The customer scans the QR code rendered on this page using either their mobile device’s camera or the Cash App mobile application to finish the authentication session. After a successful in-app authentication, Cash App redirects customers to the `return_url` you set in the request to complete checkout, and the SetupIntent automatically moves to a `succeeded` state. The SetupIntent response also includes a payment method ID that you can reuse with future PaymentIntents. #### Save a payment method with the Payment Intents API Use the [Payment Intents API](https://docs.stripe.com/payments/payment-intents.md) to collect payment method details at checkout and save a payment method to a customer. This is useful for: - Saving payment methods for customers so their later purchases don’t require authentications - Starting a free trial for a *subscription* (A Subscription represents the product details associated with the plan that your customer subscribes to. Allows you to charge the customer on a recurring basis) ## Create a PaymentIntent and save a payment method [Server-side] A [PaymentIntent](https://docs.stripe.com/api/payment_intents.md) is an object that represents your intent to charge a customer. If you don’t provide a saved payment method with the `PaymentIntent` request, a new payment method gets created and attached to a customer before confirming the `PaymentIntent`. Create a `PaymentIntent` on your server: - Add `cashapp` to the [payment_method_types](https://docs.stripe.com/api/payment_intents/create.md#create_payment_intent-payment_method_types) array - Specify the ID of the customer-configured `Account` or `Customer` - Set `confirm` to true - Set [setup_future_usage](https://docs.stripe.com/api/payment_intents/create.md#create_payment_intent-setup_future_usage) to `off_session` or `on_session` - Set the [return_url](https://docs.stripe.com/api/payment_intents/create.md#create_payment_intent-return_url) to the URL of the page you want to return the customer to after the `PaymentIntent` succeeds - If you need to create a mandate, set [mandate_data](https://docs.stripe.com/api/payment_intents/create.md#create_payment_intent-mandate_data) #### Accounts v2 ```curl curl https://api.stripe.com/v1/payment_intents \ -u "<>:" \ -d "payment_method_types[]=cashapp" \ -d "payment_method_data[type]=cashapp" \ -d "mandate_data[customer_acceptance][type]=online" \ -d "mandate_data[customer_acceptance][online][ip_address]=127.0.0.0" \ -d "mandate_data[customer_acceptance][online][user_agent]=device" \ --data-urlencode "return_url=https://www.stripe.com" \ -d "customer_account={{CUSTOMERACCOUNT_ID}}" \ -d setup_future_usage=off_session \ -d amount=1000 \ -d currency=usd \ -d statement_descriptor=test_statement \ -d capture_method=automatic \ -d confirm=true ``` #### Customers v1 ```curl curl https://api.stripe.com/v1/payment_intents \ -u "<>:" \ -d "payment_method_types[]=cashapp" \ -d "payment_method_data[type]=cashapp" \ -d "mandate_data[customer_acceptance][type]=online" \ -d "mandate_data[customer_acceptance][online][ip_address]=127.0.0.0" \ -d "mandate_data[customer_acceptance][online][user_agent]=device" \ --data-urlencode "return_url=https://www.stripe.com" \ -d "customer={{CUSTOMER_ID}}" \ -d setup_future_usage=off_session \ -d amount=1000 \ -d currency=usd \ -d statement_descriptor=test_statement \ -d capture_method=automatic \ -d confirm=true ``` The returned PaymentIntent includes a *client secret* (The client secret is a unique key returned from Stripe as part of a PaymentIntent. This key lets the client access important fields from the PaymentIntent (status, amount, currency) while hiding sensitive ones (metadata, customer)), which the client-side uses to securely complete the payment instead of passing the entire PaymentIntent object. Pass the client secret to the client-side application to continue with the payment process. The PaymentIntent response includes the status `requires_action`, which requires your users to perform another action to complete the PaymentIntent. Use the `next_action.cashapp_handle_redirect_or_display_qr_code.hosted_instructions_url` object from the same PaymentIntent response to redirect your customers to a page to help them open the Cash App mobile application to finish the authentication session. After a successful in-app authentication, Cash App redirects customers to the `return_url` you set in the request, the payment gets confirmed, and the PaymentIntent automatically moves to a `succeeded` state. The PaymentIntent response also includes a payment method ID that you can re-use with future PaymentIntents. ## Create a PaymentIntent using a saved payment method [Server-side] After you create a [PaymentMethod](https://docs.stripe.com/api/payment_methods.md), you can accept future Cash App Pay payments by creating and confirming a [PaymentIntent](https://docs.stripe.com/api/payment_intents.md). When confirming a `PaymentIntent`, use the ID of the `PaymentMethod` you created. The `off_session` value must also be set to true if the customer isn’t in a checkout flow for this `PaymentIntent`. #### Accounts v2 ```curl curl https://api.stripe.com/v1/payment_intents \ -u "<>:" \ -d "payment_method_types[]=cashapp" \ -d "payment_method={{PAYMENTMETHOD_ID}}" \ -d amount=1000 \ -d currency=usd \ -d "customer_account={{CUSTOMERACCOUNT_ID}}" \ -d statement_descriptor=test_statement \ -d capture_method=automatic \ -d confirm=true \ -d off_session=true ``` #### Customers v1 ```curl curl https://api.stripe.com/v1/payment_intents \ -u "<>:" \ -d "payment_method_types[]=cashapp" \ -d payment_method={{PAYMENT_METHOD_ID}} \ -d amount=1000 \ -d currency=usd \ -d "customer={{CUSTOMER_ID}}" \ -d statement_descriptor=test_statement \ -d capture_method=automatic \ -d confirm=true \ -d off_session=true ``` ## Gérer la révocation des moyens de paiement réutilisables There are two ways to revoke a reusable payment method: - A customer can deactivate a reusable payment method in the Cash App mobile application. In this case, Stripe sends a [mandate.updated](https://docs.stripe.com/api/events/types.md#event_types-mandate.updated) event. Subscribe to [webhook](https://docs.stripe.com/webhooks.md) events, and call [detach PaymentMethod](https://docs.stripe.com/api/payment_methods/detach.md) to deactivate it. - A customer can also deactivate a reusable payment method on your UI, if supported. In this case, your server can call [detach PaymentMethod](https://docs.stripe.com/api/payment_methods/detach.md) to deactivate it. In both cases, after you call the [detach PaymentMethod](https://docs.stripe.com/api/payment_methods/detach.md), a [payment_method.detached](https://docs.stripe.com/api/events/types.md#event_types-payment_method.detached) event is sent to you. # iOS > This is a iOS for when payment-ui is mobile and platform is ios. View the full page at https://docs.stripe.com/payments/cash-app-pay/set-up-payment?payment-ui=mobile&platform=ios. You can use the [Setup Intents API](https://docs.stripe.com/payments/setup-intents.md) to collect payment method details in advance, and determine the final amount or payment date later. Use it to: - Save payment methods to a wallet to streamline future purchases - Collect surcharges after fulfilling a service - [Start a free trial for a subscription](https://docs.stripe.com/billing/subscriptions/trials.md) This guide covers how to first save payment method details using the Setup Intents API, and how to use the Payment Intents API to charge the saved payment method later. ## Configurez votre compte Stripe [Côté serveur] [Côté client] Tout d’abord, il vous faut un compte Stripe. [Inscrivez-vous](https://dashboard.stripe.com/register). ### Côté serveur Pour cette intégration, votre serveur doit être doté de points de terminaison qui communiquent avec l’API Stripe. Utilisez les bibliothèques officielles pour accéder à l’API Stripe depuis votre serveur : #### Ruby ```bash # Available as a gem sudo gem install stripe ``` ```ruby # If you use bundler, you can add this line to your Gemfile gem 'stripe' ``` ### Côté client La [trousse SDK iOS de Stripe](https://github.com/stripe/stripe-ios) est à code source libre et [possède une documentation complète](https://stripe.dev/stripe-ios/index.html). Il est également compatible avec les applications prenant en charge iOS 13 et les versions ultérieures. #### Swift Package Manager Pour installer la trousse SDK, suivez les étapes ci-après : 1. Dans Xcode, sélectionnez **File** (Fichier) > **Add Package Dependencies…** (Ajouter des dépendances de paquet…), puis saisissez `https://github.com/stripe/stripe-ios-spm` comme URL du référentiel. 1. Sélectionnez la dernière version dans notre [page des versions](https://github.com/stripe/stripe-ios/releases). 1. Ajoutez le produit **StripePaymentsUI** à la [cible de votre application](https://developer.apple.com/documentation/swift_packages/adding_package_dependencies_to_your_app). #### CocoaPods 1. Si vous ne l’avez pas encore fait, installez la version la plus récente de [CocoaPods](https://guides.cocoapods.org/using/getting-started.html). 1. Si vous n’avez pas de fichier [Podfile](https://guides.cocoapods.org/syntax/podfile.html), exécutez la commande suivante pour en créer un : ```bash pod init ``` 1. Ajoutez cette ligne à votre `Podfile` : ```podfile pod 'StripePaymentsUI' ``` 1. Exécutez la commande suivante : ```bash pod install ``` 1. À partir de maintenant, n’oubliez pas d’utiliser le fichier `.xcworkspace`, au lieu de `.xcodeproj`, pour ouvrir votre projet dans Xcode. 1. Pour mettre à jour ultérieurement la trousse SDK vers la version la plus récente, il vous suffit d’exécuter : ```bash pod update StripePaymentsUI ``` #### Carthage 1. Si vous ne l’avez pas encore fait, installez la version la plus récente de [Carthage](https://github.com/Carthage/Carthage#installing-carthage). 1. Ajoutez cette ligne à votre `Cartfile`: ```cartfile github "stripe/stripe-ios" ``` 1. Suivez les [instructions d’installation de Carthage](https://github.com/Carthage/Carthage#if-youre-building-for-ios-tvos-or-watchos). Veillez à intégrer tous les cadres requis listés [ici](https://github.com/stripe/stripe-ios/tree/master/StripePaymentsUI/README.md#manual-linking). 1. Pour mettre à jour ultérieurement la trousse SDK vers la version la plus récente, exécutez la commande suivante ; ```bash carthage update stripe-ios --platform ios ``` #### Cadre manuel 1. Accédez à notre [page des versions GitHub](https://github.com/stripe/stripe-ios/releases/latest), puis téléchargez et décompressez **Stripe.xcframework.zip**. 1. Faites glisser **StripePaymentsUI.xcframework** vers la section **Embedded Binaries (Fichiers binaires incorporés)** des paramètres **General (Général)** de votre projet Xcode. Veillez à sélectionner **Copy items if needed (Copier les éléments si nécessaire)**. 1. Répétez l’étape 2 pour tous les cadres requis listés [ici](https://github.com/stripe/stripe-ios/tree/master/StripePaymentsUI/README.md#manual-linking). 1. À l’avenir, pour mettre à jour vers la version la plus récente de notre trousse SDK, répétez les étapes 1 à 3. > Pour plus de détails sur la version la plus récente de la trousse SDK et ses versions antérieures, consultez la page des [versions](https://github.com/stripe/stripe-ios/releases) sur GitHub. Pour recevoir des notifications lors de la publication d’une nouvelle version, [suivez les versions](https://help.github.com/en/articles/watching-and-unwatching-releases-for-a-repository#watching-releases-for-a-repository) du référentiel. Configurez la trousse SDK avec votre [clé publique](https://dashboard.stripe.com/test/apikeys) Stripe au démarrage de l’application. Cela permet à votre application d’envoyer des requêtes à l’API Stripe. #### Swift ```swift import UIKitimportStripePaymentsUI @main class AppDelegate: UIResponder, UIApplicationDelegate { func application(_ application: UIApplication, didFinishLaunchingWithOptions launchOptions: [UIApplication.LaunchOptionsKey: Any]?) -> Bool {StripeAPI.defaultPublishableKey = "<>" // do any other necessary launch configuration return true } } ``` > Utilisez vos [clés de test](https://docs.stripe.com/keys.md#obtain-api-keys) lors de vos activités de test et de développement et vos clés de [production](https://docs.stripe.com/keys.md#test-live-modes) pour la publication de votre application. ## Create or retrieve a customer [Côté serveur] To save a Cash App Pay payment method for future payments, attach it to an object that represents your customer. > #### Utilisez l’API Accounts v2 pour représenter les clients > > L’API Accounts v2 est désormais accessible à tous les utilisateurs de Connect et disponible en version bêta publique pour les autres utilisateurs de Stripe. Si vous participez à la version bêta d’Accounts v2, vous devez [indiquer une version bêta](https://docs.stripe.com/api-v2-overview.md#sdk-and-api-versioning) dans votre code. > > Pour demander l’accès à la version bêta d’Accounts v2, > > Dans la plupart des cas d’usage, nous vous recommandons de [modéliser vos clients en tant qu’objets Account](https://docs.stripe.com/accounts-v2/use-accounts-as-customers.md) configurés par le client plutôt que d’utiliser des objets [Customer](https://docs.stripe.com/api/customers.md). Create a customer-configured [Account](https://docs.stripe.com/api/v2/core/accounts/create.md#v2_create_accounts-configuration-customer) or [Customer](https://docs.stripe.com/api/customers/create.md) when your customer creates an account with your business, or when saving a payment method. Associate the object’s ID with your own internal representation of a customer. Create a new customer or retrieve an existing one to associate with this payment. #### Accounts v2 ```curl curl -X POST https://api.stripe.com/v2/core/accounts \ -H "Authorization: Bearer <>" \ -H "Stripe-Version: 2026-05-27.preview" \ --json '{ "contact_email": "jenny.rosen@example.com", "display_name": "Jenny Rosen", "configuration": { "customer": {} }, "include": [ "configuration.customer" ] }' ``` #### Customers v1 ```curl curl https://api.stripe.com/v1/customers \ -u "<>:" \ -d "name=Jenny Rosen" \ --data-urlencode "email=jenny.rosen@example.com" ``` ## Créer un SetupIntent [Côté serveur] A [SetupIntent](https://docs.stripe.com/api/setup_intents.md) 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. Create a `SetupIntent` on your server: - Add `cashapp` to the [payment_method_types](https://docs.stripe.com/api/setup_intents/create.md#create_setup_intent-payment_method_types) array - Specify the customer’s ID - Set [usage](https://docs.stripe.com/api/setup_intents/create.md#create_setup_intent-usage) to `off_session` or `on_session` #### Accounts v2 ```curl curl https://api.stripe.com/v1/setup_intents \ -u "<>:" \ -d "payment_method_types[]=cashapp" \ -d "payment_method_data[type]=cashapp" \ -d usage=off_session \ -d "customer_account={{CUSTOMERACCOUNT_ID}}" ``` #### Customers v1 ```curl curl https://api.stripe.com/v1/setup_intents \ -u "<>:" \ -d "payment_method_types[]=cashapp" \ -d "payment_method_data[type]=cashapp" \ -d usage=off_session \ -d "customer={{CUSTOMER_ID}}" ``` ## Présenter les conditions d'autorisation sur votre formulaire de paiement [Côté client] Save your customer’s Cash App Pay credentials([$Cashtag](https://cash.app/help/us/en-us/3123-cashtags)) to charge their account for future, *off-session* (A payment is described as off-session if it occurs without the direct involvement of the customer, using previously-collected payment information) payments. Your custom payment form must present a written notice of authorization before confirming the [PaymentIntent](https://docs.stripe.com/api/payment_intents.md) or [SetupIntent](https://docs.stripe.com/api/setup_intents.md). The authorization terms only need to be displayed the first time you save a customer’s $Cashtag. Nous vous recommandons d’utiliser le texte suivant pour votre formulaire de paiement personnalisé : > By continuing, you authorize Rocket Rides to debit your Cash App account for this payment and future payments in accordance with Rocket Rides's terms, until this authorization is revoked. You can change this anytime in your Cash App Settings. ## Collecter les informations sur le moyen de paiement [Côté client] #### Swift ```swift // Cash App Pay does not require additional parameters so we only need to pass the initialized // STPPaymentMethodCashAppParams instance to STPPaymentMethodParams let cashApp = STPPaymentMethodCashAppParams() let paymentMethodParams = STPPaymentMethodParams(cashApp: cashApp, billingDetails: nil, metadata: nil) ``` ## Envoyer le paiement à Stripe [Côté client] Retrieve the client secret from the SetupIntent you created and call [STPPaymentHandler confirmSetupIntent](https://stripe.dev/stripe-ios/stripe-payments/Classes/STPPaymentHandler.html#/c:objc\(cs\)STPPaymentHandler\(im\)confirmSetupIntent:withAuthenticationContext:completion:). This presents a webview where the customer can complete the payment in Cash App. Afterwards, the completion block is called with the result of the payment. #### Swift ```swift let setupIntentParams = STPSetupIntentConfirmParams(clientSecret: setupIntentClientSecret) setupIntentParams.paymentMethodParams = paymentMethodParams setupIntentParams.returnURL = "payments-example://stripe-redirect" STPPaymentHandler.shared().confirmSetupIntent(withParams: setupIntentParams, authenticationContext: self) { (handlerStatus, setupIntent, error) in switch handlerStatus { case .succeeded: // Setup succeeded case .canceled: // Setup was canceled case .failed: // Setup failed @unknown default: fatalError() } } ``` ## Create a PaymentIntent using a saved payment method [Côté serveur] After you create a [PaymentMethod](https://docs.stripe.com/api/payment_methods.md), you can accept future Cash App Pay payments by creating and confirming a [PaymentIntent](https://docs.stripe.com/api/payment_intents.md). When confirming a `PaymentIntent`, use the ID of the `PaymentMethod` you created. The `off_session` value must also be set to true if the customer isn’t in a checkout flow for this `PaymentIntent`. #### Accounts v2 ```curl curl https://api.stripe.com/v1/payment_intents \ -u "<>:" \ -d "payment_method_types[]=cashapp" \ -d "payment_method={{PAYMENTMETHOD_ID}}" \ -d amount=1000 \ -d currency=usd \ -d "customer_account={{CUSTOMERACCOUNT_ID}}" \ -d statement_descriptor=test_statement \ -d capture_method=automatic \ -d confirm=true \ -d off_session=true ``` #### Customers v1 ```curl curl https://api.stripe.com/v1/payment_intents \ -u "<>:" \ -d "payment_method_types[]=cashapp" \ -d "payment_method={{PAYMENTMETHOD_ID}}" \ -d amount=1000 \ -d currency=usd \ -d "customer={{CUSTOMER_ID}}" \ -d statement_descriptor=test_statement \ -d capture_method=automatic \ -d confirm=true \ -d off_session=true ``` ## Gérer la révocation des moyens de paiement réutilisables There are two ways to revoke a reusable payment method: - A customer can deactivate a reusable payment method in the Cash App mobile application. In this case, Stripe sends a [mandate.updated](https://docs.stripe.com/api/events/types.md#event_types-mandate.updated) event. Subscribe to [webhook](https://docs.stripe.com/webhooks.md) events, and call [detach PaymentMethod](https://docs.stripe.com/api/payment_methods/detach.md) to deactivate it. - A customer can also deactivate a reusable payment method on your UI, if supported. In this case, your server can call [detach PaymentMethod](https://docs.stripe.com/api/payment_methods/detach.md) to deactivate it. In both cases, after you call the [detach PaymentMethod](https://docs.stripe.com/api/payment_methods/detach.md), a [payment_method.detached](https://docs.stripe.com/api/events/types.md#event_types-payment_method.detached) event is sent to you. # Android > This is a Android for when payment-ui is mobile and platform is android. View the full page at https://docs.stripe.com/payments/cash-app-pay/set-up-payment?payment-ui=mobile&platform=android. Available in: US You can use the [Setup Intents API](https://docs.stripe.com/payments/setup-intents.md) or the [Payment Intents API](https://docs.stripe.com/payments/payment-intents.md) to save Cash App Pay details for future payments. ## Configurez votre compte Stripe [Côté serveur] [Côté client] Tout d’abord, il vous faut un compte Stripe. [Inscrivez-vous](https://dashboard.stripe.com/register). ### Côté serveur Pour cette intégration, votre serveur doit être doté de points de terminaison qui communiquent avec l’API Stripe. Utilisez les bibliothèques officielles pour accéder à l’API Stripe depuis votre serveur : #### Ruby ```bash # Available as a gem sudo gem install stripe ``` ```ruby # If you use bundler, you can add this line to your Gemfile gem 'stripe' ``` ### Côté client La [trousse SDK Stripe Android](https://github.com/stripe/stripe-android) est à code source libre et [possède une documentation complète](https://stripe.dev/stripe-android/). Pour installer la trousse SDK, ajoutez `stripe-android` au bloc `dependencies` de votre fichier [app/build.gradle](https://developer.android.com/studio/build/dependencies) : #### Kotlin ```kotlin plugins { id("com.android.application") } android { ... } dependencies { // ... // Stripe Android SDK implementation("com.stripe:stripe-android:23.9.1") // Include the financial connections SDK to support US bank account as a payment method implementation("com.stripe:financial-connections:23.9.1") } ``` > Pour obtenir de plus amples informations sur la version la plus récente de la trousse SDK et ses versions antérieures, consultez la page des [versions](https://github.com/stripe/stripe-android/releases) sur GitHub. Pour savoir quand une nouvelle version est disponible, [surveillez les versions du référentiel](https://docs.github.com/en/github/managing-subscriptions-and-notifications-on-github/configuring-notifications#configuring-your-watch-settings-for-an-individual-repository). Configurez la trousse SDK avec votre [clé publique](https://dashboard.stripe.com/apikeys) Stripe de façon à ce qu’elle puisse envoyer des requêtes à l’API Stripe, par exemple à la sous-classe `Application` : #### Kotlin ```kotlin import com.stripe.android.PaymentConfiguration class MyApp : Application() { override fun onCreate() { super.onCreate() PaymentConfiguration.init( applicationContext, "<>" ) } } ``` > Utilisez vos [clés de test](https://docs.stripe.com/keys.md#obtain-api-keys) lors de vos activités de test et de développement et vos clés de [production](https://docs.stripe.com/keys.md#test-live-modes) pour la publication de votre application. Les échantillons de code de Stripe utilisent également [OkHttp](https://github.com/square/okhttp) et [GSON](https://github.com/google/gson) pour envoyer des requêtes HTTP à un serveur. ## Create or retrieve a customer [Côté serveur] To save a Cash App Pay payment method for future payments, attach it to an object that represents your customer. > #### Utilisez l’API Accounts v2 pour représenter les clients > > L’API Accounts v2 est désormais accessible à tous les utilisateurs de Connect et disponible en version bêta publique pour les autres utilisateurs de Stripe. Si vous participez à la version bêta d’Accounts v2, vous devez [indiquer une version bêta](https://docs.stripe.com/api-v2-overview.md#sdk-and-api-versioning) dans votre code. > > Pour demander l’accès à la version bêta d’Accounts v2, > > Dans la plupart des cas d’usage, nous vous recommandons de [modéliser vos clients en tant qu’objets Account](https://docs.stripe.com/accounts-v2/use-accounts-as-customers.md) configurés par le client plutôt que d’utiliser des objets [Customer](https://docs.stripe.com/api/customers.md). Create a customer-configured [Account](https://docs.stripe.com/api/v2/core/accounts/create.md#v2_create_accounts-configuration-customer) or [Customer](https://docs.stripe.com/api/customers/create.md) when your customer creates an account with your business, or when saving a payment method. Associate the object’s ID with your own internal representation of a customer. Create a new customer or retrieve an existing one to associate with this payment. #### Accounts v2 ```curl curl -X POST https://api.stripe.com/v2/core/accounts \ -H "Authorization: Bearer <>" \ -H "Stripe-Version: 2026-05-27.preview" \ --json '{ "contact_email": "jenny.rosen@example.com", "display_name": "Jenny Rosen", "configuration": { "customer": {} }, "include": [ "configuration.customer" ] }' ``` #### Customers v1 ```curl curl https://api.stripe.com/v1/customers \ -u "<>:" \ -d "name=Jenny Rosen" \ --data-urlencode "email=jenny.rosen@example.com" ``` ## Créer un SetupIntent [Côté serveur] A [SetupIntent](https://docs.stripe.com/api/setup_intents.md) 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. Create a `SetupIntent` on your server: - Add `cashapp` to the [payment_method_types](https://docs.stripe.com/api/setup_intents/create.md#create_setup_intent-payment_method_types) array - Specify the customer’s ID - Set [usage](https://docs.stripe.com/api/setup_intents/create.md#create_setup_intent-usage) to `off_session` or `on_session` #### Accounts v2 ```curl curl https://api.stripe.com/v1/setup_intents \ -u "<>:" \ -d "payment_method_types[]=cashapp" \ -d "payment_method_data[type]=cashapp" \ -d usage=off_session \ -d "customer_account={{CUSTOMERACCOUNT_ID}}" ``` #### Customers v1 ```curl curl https://api.stripe.com/v1/setup_intents \ -u "<>:" \ -d "payment_method_types[]=cashapp" \ -d "payment_method_data[type]=cashapp" \ -d usage=off_session \ -d "customer={{CUSTOMER_ID}}" ``` ## Present authorization terms on your payment form [Côté client] Save your customer’s Cash App Pay credentials([$Cashtag](https://cash.app/help/us/en-us/3123-cashtags)) to charge their account for future, *off-session* (A payment is described as off-session if it occurs without the direct involvement of the customer, using previously-collected payment information) payments. Your custom payment form must present a written notice of authorization before confirming the [PaymentIntent](https://docs.stripe.com/api/payment_intents.md) or [SetupIntent](https://docs.stripe.com/api/setup_intents.md). The authorization terms only need to be displayed the first time you save a customer’s $Cashtag. We recommend that you use the following text for your custom payment form: > By continuing, you authorize Rocket Rides to debit your Cash App account for this payment and future payments in accordance with Rocket Rides's terms, until this authorization is revoked. You can change this anytime in your Cash App Settings. ## Envoyer les informations du moyen de paiement à Stripe [Côté client] Retrieve the client secret from the SetupIntent you created and call [PaymentLauncher confirm](https://stripe.dev/stripe-android/payments-core/com.stripe.android.payments.paymentlauncher/-payment-launcher/confirm.html). This presents a webview where the customer can complete the setup with Cash App Pay. Upon completion, the provided `PaymentResultCallback` is called with the result of the payment. #### Kotlin ```kotlin class CashAppPaySetupActivity : AppCompatActivity() { // ... private val paymentLauncher: PaymentLauncher by lazy { val paymentConfiguration = PaymentConfiguration.getInstance(applicationContext) PaymentLauncher.create( activity = this, publishableKey = paymentConfiguration.publishableKey, stripeAccountId = paymentConfiguration.stripeAccountId, callback = ::onPaymentResult, ) } override fun onCreate(savedInstanceState: Bundle?) { // … startCheckout() } private fun startCheckout() { // Create a SetupIntent on your backend and return the client_secret here val setupIntentClientSecret = // … val cashAppPayParams = PaymentMethodCreateParams.createCashAppPay() val confirmParams = ConfirmSetupIntentParams.create( paymentMethodCreateParams = cashAppPayParams, clientSecret = setupIntentClientSecret, // Add a mandate ID or MandateDataParams… ) paymentLauncher.confirm(confirmParams) } private fun onPaymentResult(paymentResult: PaymentResult) { // Handle the setup result… } } ``` ## Create a PaymentIntent using a saved payment method [Côté serveur] After you create a [PaymentMethod](https://docs.stripe.com/api/payment_methods.md), you can accept future Cash App Pay payments by creating and confirming a [PaymentIntent](https://docs.stripe.com/api/payment_intents.md). When confirming a `PaymentIntent`, use the ID of the `PaymentMethod` you created. The `off_session` value must also be set to true if the customer isn’t in a checkout flow for this `PaymentIntent`. #### Accounts v2 ```curl curl https://api.stripe.com/v1/payment_intents \ -u "<>:" \ -d "payment_method_types[]=cashapp" \ -d "payment_method={{PAYMENTMETHOD_ID}}" \ -d amount=1000 \ -d currency=usd \ -d "customer_account={{CUSTOMERACCOUNT_ID}}" \ -d statement_descriptor=test_statement \ -d capture_method=automatic \ -d confirm=true \ -d off_session=true ``` #### Customers v1 ```curl curl https://api.stripe.com/v1/payment_intents \ -u "<>:" \ -d "payment_method_types[]=cashapp" \ -d payment_method={{PAYMENT_METHOD_ID}} \ -d amount=1000 \ -d currency=usd \ -d "customer={{CUSTOMER_ID}}" \ -d statement_descriptor=test_statement \ -d capture_method=automatic \ -d confirm=true \ -d off_session=true ``` ## Gérer la révocation des moyens de paiement réutilisables There are two ways to revoke a reusable payment method: - A customer can deactivate a reusable payment method in the Cash App mobile application. In this case, Stripe sends a [mandate.updated](https://docs.stripe.com/api/events/types.md#event_types-mandate.updated) event. Subscribe to [webhook](https://docs.stripe.com/webhooks.md) events, and call [detach PaymentMethod](https://docs.stripe.com/api/payment_methods/detach.md) to deactivate it. - A customer can also deactivate a reusable payment method on your UI, if supported. In this case, your server can call [detach PaymentMethod](https://docs.stripe.com/api/payment_methods/detach.md) to deactivate it. In both cases, after you call the [detach PaymentMethod](https://docs.stripe.com/api/payment_methods/detach.md), a [payment_method.detached](https://docs.stripe.com/api/events/types.md#event_types-payment_method.detached) event is sent to you.