Skip to content
Create account
or
Sign in
The Stripe Docs logo
/
Ask AI
Create account
Sign in
Get started
Payments
Finance automation
Platforms and marketplaces
Money management
Developer tools
Get started
Payments
Finance automation
Get started
Payments
Finance automation
Platforms and marketplaces
Money management
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
    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
Custom payment flows
Flexible acquiring
Orchestration
In-person payments
Terminal
Other Stripe products
Financial Connections
Crypto
Climate
HomePaymentsAdd payment methodsWalletsCash App Pay

Cash App Pay payments

Add support for Cash App Pay to your integration.

Copy page

We recommend that you implement the custom payment flow integration. The custom payment flow allows you to add Cash App Pay and other payment methods to your integration with the least amount of effort. Accepting Cash App Pay using a Direct API integration consists of:

  • Creating a PaymentIntent object to track a payment.
  • Submitting the payment to Stripe for processing.
  • Authenticating the payment (through a mobile application redirect or QR code).
  • Handling post-payment events to redirect the customer after an order succeeds or fails.

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 a PaymentIntent
Server-side

A PaymentIntent is an object that represents your intent to collect payment from a customer and tracks the lifecycle of the payment process through each stage.

To create a PaymentIntent on your server:

  • Specify the amount to collect and the currency.
  • Add cashapp to the list of payment method types for your PaymentIntent. Make sure Cash App Pay is enabled in the Dashboard.
Command Line
cURL
curl https://api.stripe.com/v1/payment_intents \ -u "
sk_test_BQokikJOvBiI2HlWgH4olfQ2
:"
\ -d amount=6000 \ -d currency=usd \ -d "payment_method_types[]"=cashapp

Retrieve the client secret

The PaymentIntent 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 PaymentIntent {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 })();

Submit the payment to Stripe and authenticate transactions client-side

In this step, you’ll complete Cash App Pay payments on the client with Stripe.js. To authenticate a transaction, you must redirect the customer to Cash App.

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/v3/"></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.confirmCashappPayment to confirm the PaymentIntent on the client side.

client.js
const form = document.getElementById('payment-form'); form.addEventListener('submit', function(event) { event.preventDefault(); // Pass the clientSecret obtained from the server in step 2 as the first argument stripe.confirmCashappPayment( clientSecret, { payment_method: { type: 'cashapp', }, return_url: 'https://www.example.com/checkout/done', }, ); });

Caution

confirmCashappPayment only redirects mobile browsers to your return_url, it doesn’t redirect desktop browsers. You can manually redirect customers using desktop browsers to your return URL after the returned promise resolves.

Customers can authenticate Cash App Pay transactions with mobile or desktop apps. The client the customer is using determines the authentication method after calling confirmCashappPayment.

After calling confirmCashappPayment, the customers are redirected to Cash App to approve or decline the payment. After the customers authorize the payment, they’re redirected to the Payment Intent’s return_url. Stripe adds payment_intent, payment_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 60 minutes, and the PaymentIntent’s status transitions back to require_payment_method. After the status transitions, the customer sees a payment error and must restart the payment process.

OptionalHandle redirect and authentication manually

OptionalSeparate authorization and capture

OptionalHandle post-payment events

Test your integration

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.

Failed payments

Cash App Pay uses multiple data points to decide when to decline a transaction (for example, their AI model detected high consumer fraud risk for the transaction, or the consumer has revoked your permission to charge them in Cash App).

In these cases, the PaymentMethod is detached and the PaymentIntent object’s status automatically transitions to requires_payment_method.

Other than a payment being declined, for a Cash App Pay PaymentIntent with a status of requires_action, customers must complete the payment within 10 minutes after they’re redirected to Cash App. If no action is taken after 10 minutes, the PaymentMethod is detached and the PaymentIntent object’s status automatically transitions to requires_payment_method.

When this happens, the Payment Element renders error messages and instructs your customer to retry using a different payment method.

Error codes

The following table details common error codes and recommended actions:

Error CodeRecommended Action
payment_intent_invalid_currencyEnter the appropriate currency. Cash App Pay only supports usd.
missing_required_parameterCheck the error message for more information about the required parameter.
payment_intent_payment_attempt_failedThis code can appear in the last_payment_error.code field of a PaymentIntent. Check the error message for a detailed failure reason and suggestion on error handling.
payment_intent_redirect_confirmation_without_return_urlProvide a return_url when confirming a PaymentIntent with Cash App Pay.
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