Skip to content
Create account
or
Sign in
The Stripe Docs logo
/
Ask AI
Create account
Sign in
Get started
Payments
Revenue
Platforms and marketplaces
Money management
Developer resources
Overview
About Stripe payments
Upgrade your integration
Payments analytics
Online payments
OverviewFind your use caseManaged Payments
Use Payment Links
Build a checkout page
Build an advanced integration
Build an in-app integration
Payment methods
Add payment methods
    Overview
    Payment method integration options
    Manage default payment methods in the Dashboard
    Payment method types
    Cards
    Pay with Stripe balance
    Crypto
    Bank debits
    Bank redirects
    Bank transfers
    Credit transfers (Sources)
    Buy now, pay later
    Real-time payments
    Vouchers
    Wallets
      Alipay
      Amazon Pay
      Apple Pay
      Cash App Pay
        Accept a payment
        Save payment details
      Google Pay
      GrabPay
      Link
      MB WAY
      MobilePay
      PayPal
      PayPay
      Revolut Pay
      Satispay
      Secure Remote Commerce
      Vipps
      WeChat Pay
    Enable local payment methods by country
    Custom payment methods
Manage payment methods
Faster checkout with Link
Payment interfaces
Payment Links
Checkout
Web Elements
In-app Elements
Payment scenarios
Handle multiple currencies
Custom payment flows
Flexible acquiring
Orchestration
In-person payments
Terminal
Beyond payments
Incorporate your company
Crypto
Financial Connections
Climate
HomePaymentsAdd payment methodsWalletsCash App Pay

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 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

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 for more details.

Set up Stripe
Server-side

First, you need a Stripe account. Register now.

Use our official libraries for access to the Stripe API from your application:

Command Line
Ruby
# Available as a gem sudo gem install stripe
Gemfile
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, 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.

Command Line
cURL
curl https://api.stripe.com/v1/customers \ -u "
sk_test_BQokikJOvBiI2HlWgH4olfQ2
:"
\ --data-urlencode description="My First Test Customer (created for API docs)"

Present authorization terms on your payment form
Client-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.

Use the Setup Intents API 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

Create a SetupIntent and save a payment method
Server-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_session.

Command Line
cURL
curl https://api.stripe.com/v1/setup_intents \ -u "
sk_test_BQokikJOvBiI2HlWgH4olfQ2
:"
\ -d "payment_method_types[]"=cashapp \ -d "payment_method_data[type]"=cashapp \ -d usage=off_session \ -d customer={{CUSTOMER_ID}}

Retrieve the client secret

The SetupIntent includes a client secret that the client side uses to securely complete the payment process. You can use different approaches to pass the client secret to the client side.

Retrieve the client secret from an endpoint on your server, using the browser’s fetch function. This approach is best if your client side is a single-page application, particularly one built with a modern frontend framework like React. Create the server endpoint that serves the client secret:

main.rb
Ruby
get '/secret' do intent = # ... Create or retrieve the SetupIntent {client_secret: intent.client_secret}.to_json end

And then fetch the client secret with JavaScript on the client side:

(async () => { const response = await fetch('/secret'); const {client_secret: clientSecret} = await response.json(); // Render the form using the clientSecret })();

Next, you save Cash App Pay on the client with Stripe.js.

Include the Stripe.js script on your checkout page by adding it to the head of your HTML file.

checkout.html
<head> <title>Checkout</title> <script src="https://js.stripe.com/basil/stripe.js"></script> </head>

Create an instance of Stripe.js with the following JavaScript on your checkout page:

client.js
// 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(
'pk_test_TYooMQauvdEDq54NiTphI7jx'
);

Use stripe.confirmCashappSetup to confirm the setupIntent on the client side, with a return_url and an optional mandate_data. Use the return_url to redirect customers to a specific page after the SetupIntent succeeds.

client.js
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.

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.

OptionalHandle redirect and authentication manually

Create a PaymentIntent using a saved payment method
Server-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_session value must also be set to true if the customer isn’t in a checkout flow for this PaymentIntent.

Command Line
cURL
curl https://api.stripe.com/v1/payment_intents \ -u "
sk_test_BQokikJOvBiI2HlWgH4olfQ2
:"
\ -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

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.

Was this page helpful?
YesNo
Need help? Contact Support.
Join our early access program.
Check out our changelog.
Questions? Contact Sales.
LLM? Read llms.txt.
Powered by Markdoc