Set up a subscription with the related setting
Learn how to create and charge for a subscription with the related setting.
Use this guide to set up a subscription using the related setting as a payment method.
You can use the Checkout API to create and confirm a subscription with a prebuilt checkout page.
Create a product and price Dashboard
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 CHF monthly subscription. To model this:
- Go to the Products page and click Create product .
- Enter a Name for the product. You can optionally add a Description and upload an image of the product.
- Select a Product tax code . Learn more about product tax codes .
- Select Recurring . Then enter 15 for the price and select CHF as the currency.
- Choose whether to Include tax in price . You can either use the default value from your tax settings or set the value manually. In this example, select Auto .
- Select Monthly for the Billing period .
- Click More pricing options . Then select Flat rate as the pricing model for this example. Learn more about flat rate and other pricing models .
- Add an internal Price description and Lookup key to organize, query, and update specific prices in the future.
- 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 the related setting account for future payments through Stripe Checkout. This allows you to accept the related setting payments.
Add a checkout button to your website that calls a server-side endpoint to create a Checkout Session.
index.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 returned in the response.
Command Line
Select a language
cURL
Stripe CLI
Ruby
Python
PHP
Java
Node.js
Go
.NET
No results
Test your integration Server-side
Test your the related setting integration with your test API keys by viewing the redirect page. If you authorize the mandate on the redirect page, the SetupIntent transitions from requires_action to succeeded. If you decline the mandate on the redirect page, the SetupIntent transitions from requires_action to requires_payment_method.
