# 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* (A Subscription represents the product details associated with the plan that your customer subscribes to. Allows you to charge the customer on a recurring basis) using [Cash App Pay](https://docs.stripe.com/payments/cash-app-pay.md) as a payment method.

# Stripe-hosted page


You can use the [Checkout API](https://docs.stripe.com/api/checkout/sessions.md) to create and confirm a subscription with a prebuilt checkout page.

## Create a product and price [Dashboard]

[Products](https://docs.stripe.com/api/products.md) represent the item or service you’re selling. [Prices](https://docs.stripe.com/api/prices.md) 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:

1. Go to the [Products](https://dashboard.stripe.com/products?active=true) page and click **Create product**.
2. Enter a **Name** for the product. You can optionally add a **Description** and upload an image of the product.
3. Select a **Product tax code**. Learn more about [product tax codes](https://docs.stripe.com/tax/tax-codes.md).
4. Select **Recurring**. Then enter **15** for the price and select **USD** as the currency.
5. Choose whether to **Include tax in price**. You can either use the default value from your [tax settings](https://dashboard.stripe.com/test/settings/tax) or set the value manually. In this example, select **Auto**.
6. Select **Monthly** for the **Billing period**.
7. Click **More pricing options**. Then select **Flat rate** as the pricing model for this example. Learn more about [flat rate](https://docs.stripe.com/products-prices/pricing-models.md#flat-rate) and other [pricing models](https://docs.stripe.com/products-prices/pricing-models.md).
8. Add an internal **Price description** and [Lookup key](https://docs.stripe.com/products-prices/manage-prices.md#lookup-keys) to organize, query, and update specific prices in the future.
9. Click **Next**. Then click **Add 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_G0FvDp6vZvdwRZ`.

## Create a Checkout Session [Server-side]

Your customer must authorize you to use their Cash App account for future payments through Stripe Checkout. This allows you to accept Cash App payments. Add a checkout button to your website that calls a server-side endpoint to create a [Checkout Session](https://docs.stripe.com/api/checkout/sessions.md).

```html
<html>
  <head>
    <title>Checkout</title>
  </head>
  <body>
    <form action="/create-checkout-session" method="POST">
      <button type="submit">Checkout</button>
    </form>
  </body>
</html>
```

Create a Checkout Session in `subscription` mode to collect the required information. After creating the Checkout Session, redirect your customer to the [URL](https://docs.stripe.com/api/checkout/sessions/object.md#checkout_session_object-url) returned in the response.

```curl
curl https://api.stripe.com/v1/checkout/sessions \
  -u "<<YOUR_SECRET_KEY>>:" \
  --data-urlencode "success_url=https://example.com/success" \
  -d "line_items[0][price]={{RECURRING_PRICE_ID}}" \
  -d "line_items[0][quantity]=1" \
  -d mode=subscription
```

## Test your integration [Server-side]

#### Mobile web app authentication

Select **Cash App Pay** as the payment method and tap **Subscribe**. While testing, this redirects you to a test page where you can approve or decline the setup.

In live mode, tapping **Subscribe** redirects you to Cash App. As a best practice, test in live mode with a real Cash App account before releasing it to your customers. In live mode, you don’t have the option to approve or decline the setup within Cash App. It’s automatically approved after your customer is redirected to Cash App.

#### Desktop web app authentication

While testing, scan the QR code with a QR code scanning application on your mobile device. The QR code payload contains a URL that redirects you to a test payment page. You can approve or decline the test setup.

In live mode, scan the QR code with the Cash App mobile application. As a best practice, test in live mode with a real Cash App account before releasing it to your customers. In live mode, you don’t have the option to approve or decline the setup within Cash App. It’s automatically approved after you scan the QR code.

