Set up a subscription with Cash App Pay
Learn how to create and charge for a subscription with Cash App Pay.
Use this guide to set up a subscription using Cash App Pay as a payment method.
Create and confirm a Subscription using two API calls. The first API call sends customer and product information to the Subscriptions API to create a Subscription and PaymentIntent in one call. The response includes a PaymentIntent ID that you must use in a Payment Intents API call to confirm a payment.
Create a product and priceDashboard
Products represent the item or service you’re selling. Prices define how much and how frequently you charge for a product. This includes how much the product costs, what currency you accept, and whether it’s a one-time or recurring charge. If you only have a few products and prices, create and manage them in the Dashboard.
This guide uses a stock photo service as an example and charges customers a 15 USD monthly subscription. To model this:
- Navigate to the Add a product page.
- Enter a Name for the product.
- Enter 15 for the price.
- Select USD as the currency.
- Click Save product.
After you create the product and the price, record the price ID so you can use it in subsequent steps. The pricing page displays the ID and it looks similar to this: price_
.
Create a subscriptionServer-side
Create a subscription that has a price and customer with status of incomplete
by providing the payment_behavior parameter with a value of default_
. Set the payment_
parameter to save a payment method when a subscription is activated.
The response includes the subscription’s first Invoice. This contains the invoice’s payments, which includes a default PaymentIntent that Stripe generated for this invoice and the confirmation secret which you can use on the client side to securely complete the payment process instead of passing the entire PaymentIntent object. Return the latest_
to the front end to complete payment.
Get the PaymentIntent ID that you must use to confirm a payment from latest_
.
Note
To create a subscription with a free trial period, see Subscription trials.
Confirm a paymentServer-side
Confirm a payment with PaymentIntents using the PaymentIntent ID from the Subscriptions response.
Add the PaymentIntent ID to the URL path and set the value of the payment_
parameter to cashapp
.
The PaymentIntent response includes the status requires_
, which means your users must perform another action to complete the PaymentIntent. Use the next_
object from the PaymentIntent response to redirect your users to a Stripe hosted page that displays the QR code, or render the QR code directly. To authenticate users, follow the instructions for redirect and authenticate transactions. After they authenticate, the Cash App mobile application redirects users to the return_
on their mobile device, and the PaymentIntent moves to a succeeded
state.
After a successful payment, the subscription becomes active and saves the payment method as the default payment method.