Prerequisites
- A connected customer (via
client.getConnection()orclient.connect()). @moonpay/platform-sdk-webor@moonpay/platform-sdk-react-native1.35.0 or later.- A UI surface where you can render the Buy Button frame. For a Cash App quote, it renders the Cash App button.
- In a native app or a desktop browser, code that handles the Cash App link when the frame asks for it. See Native apps and Desktop browsers.
Flow overview
The first time, the customer links Cash App on the button. After that, the same button pays.Linking on each platform
The customer approves the link in Cash App. What differs is who opens it. The frame works out where it’s running and picks the flow.
In every flow the frame keeps checking until the customer approves, saves the account, and sends a
resolved event. If the customer cancels in the frame, it sends cancelled. Close any QR code on resolved, cancelled, or an error.
The button
The buy button moves through these states. You don’t build or style them.
If Cash App has no
$cashtag for the customer, the linked button reads Pay with Cash App.
The button never shows an error message. When something goes wrong, it goes back to Connect Cash App, and the frame sends an error event so your app decides what to tell the customer:
When the saved account can no longer pay, the button goes back to Connect Cash App and the frame sends no event.
Display payment methods
Cash App appears inpaymentMethodConfigs with its availability. After the customer links it, the account also appears in paymentMethods. Use the SDK or API to list what’s available right now.
cashtag is absent when Cash App doesn’t return one. The linked account has no availability of its own. Use the one on the cash_app entry in paymentMethodConfigs.
Which features a customer can use depends on their country and on the capabilities enabled for your partner account. Availability also shifts over time with MoonPay's compliance decisions. The
capabilities object on the connection gives the live answer; the regions and payment methods named on a docs page are for planning, not a contract. Gate each feature on its capability being present instead of keeping your own region list.Get quotes
Request a quote with thecash_app payment method. The quote is executable before the customer links Cash App. The buy button won’t take a payment until Cash App is linked, so the customer can link and pay without you requesting a new quote.
See the quotes API reference for the fields required to receive executable: true.
Get quote
Execute the transaction
Callclient.setupBuyButton() with your cash_app quote. The buy button renders the Cash App button. Don’t pass headless: true. Headless mode accepts card and SEPA bank transfer quotes only, and rejects a cash_app quote with an error event, code unsupportedPaymentMethod. For the frame URL, size, permissions, and events, see the Buy Button frame reference.
Cash App
link_payment_method challenge as described below.
Web iframes
On a phone’s browser, the frame opens the Cash App app link in a new tab when the customer taps. If your iframe uses thesandbox attribute, include allow-popups and allow-popups-to-escape-sandbox, so the tab can open and Cash App loads without the sandbox. See Permissions.
Desktop browsers
On a desktop, the frame doesn’t open Cash App. It sends achallenge event whose payload.kind is link_payment_method, with a QR code the customer scans with their phone.
Native apps
In a native app, the frame can’t open another app from inside a WebView. It sends your app achallenge event whose payload.kind is link_payment_method, and your app opens url. See Cash App Pay link challenge for the message and a checklist.
With the React Native SDK, the buy button passes this to your onEvent handler:
@moonpay/platform-sdk-react-native 1.35.0 or later. If your app doesn’t open the link, the button stays on Connecting to Cash App… until the customer cancels or the link times out.
Offer Cash App only when your app handles this event. See the <MoonPayBuyButton> reference.
Delete a Cash App account
A customer can remove their saved Cash App account. Useclient.deletePaymentMethod() or the Delete payment method API with the account’s id. The next purchase asks the customer to link Cash App again.
The call returns a conflict while a payment with that account is pending. Deleting an ID that doesn’t exist also succeeds.
Transaction statuses
Transactions have the following statuses:- Pending: The transaction has been initiated and the payment accepted. The assets are being transferred.
- Complete: The transaction is finalized. The payment is complete and the assets have been delivered to their destination.
- Failed: The transaction has failed. The payment was not executed and funds were not transferred.