Set up future Cash App Pay payments
Learn how to save Cash App Pay details and charge your customers later.
You can use the Setup Intents API or the Payment Intents API to save Cash App Pay details for future payments.
Set up StripeServer-sideClient-side
First, you need a Stripe account. Register now.
Server-side 
This integration requires endpoints on your server that talk to the Stripe API. Use the official libraries for access to the Stripe API from your server:
Client-side 
The Stripe Android SDK is open source and fully documented.
To install the SDK, add stripe-android
to the dependencies
block of your app/build.gradle file:
Note
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.
Configure the SDK with your Stripe publishable key so that it can make requests to the Stripe API, such as in your Application
subclass:
Note
Stripe samples also use OkHttp and GSON to make HTTP requests to a server.
Create or retrieve a CustomerServer-side
To save a Cash App Pay payment method for future payments, you must attach it to a Customer.
Create a Customer object when your customer creates an account with your business. Associate the ID of the Customer object with your own internal representation of a customer. Alternatively, you can create the Customer object before you save a payment method for future payments.
Include the following code on your server to create a new Customer.
Create a SetupIntentServer-side
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 set-up process. Create a SetupIntent on your server with payment_method_types set to cashapp
and specify the Customer’s ID and usage=off_session or usage=on_
.
Present authorization terms on your payment formClient-side
Save your customer’s Cash App Pay credentials($Cashtag) to charge their account for future, off-session payments. Your custom payment form must present a written notice of authorization before confirming the PaymentIntent or SetupIntent.
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.
Submit the payment method details to StripeClient-side
Retrieve the client secret from the SetupIntent you created and call PaymentLauncher confirm. 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.
Create a PaymentIntent using a saved payment methodServer-side
After you create a PaymentMethod, you can accept future Cash App Pay payments by creating and confirming a PaymentIntent. When confirming a PaymentIntent, use the same payment method ID from the previous SetupIntent or PaymentIntent object. The off_
value must also be set to true if the customer isn’t in a checkout flow for this PaymentIntent.
Handle reusable payment method revocation 
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 event. Subscribe to webhook events, and call detach PaymentMethod 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 to deactivate it.
In both cases, after you call the detach PaymentMethod, a payment_method.detached event is sent to you.