Set up a subscription with stablecoin paymentsPrivate preview
Learn how to create and charge for a subscription with stablecoins.
Use this guide to set up a subscription that withdraws recurring stablecoin payments from a customer’s crypto wallet.
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:
- 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 USD 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_
.
Your customer must authorize you to use their crypto wallet for future payments through Stripe.
Add a checkout button to your website that calls a server-side endpoint to create a Checkout Session.
<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 that the response returns.
When your customer completes a payment, Stripe redirects them to the URL that you specified in the success_
parameter. Typically, this is a page on your website that informs your customer that their payment was successful.
However, crypto is a delayed notification payment method, which means that funds aren’t immediately available. Because of this, delay order fulfillment until the funds are available. After the payment succeeds, the underlying PaymentIntent status changes from processing
to succeeded
.
A crypto payment typically takes a few minutes to make the funds available.
You can confirm the payment is successful in several ways:
Test your crypto payment integration by opening the payment redirect page using your test API keys. You can test a successful payment flow at no cost using testnet assets.
- In a sandbox, create a new transaction using your chosen integration method, and open its redirect URL.
- Connect your preferred wallet and payment network.
- Complete the payment, and validate that you’re redirected to the expected URL.
Test payments with testnet assets
Most cryptocurrencies offer testnet assets, or tokens that have no monetary value, that you can use to test blockchain transactions. Stripe recommends the MetaMask wallet, Polygon Amoy testnet, and Circle faucet for testing, but you can use your own preferred services.
Install a wallet
- Download the MetaMask extension for your web browser.
- Create a new wallet or import an existing one.
Enable a testnet
- In your MetaMask wallet, select Networks from the main menu.
- Click Add custom network.
- Enter the following details:
- Network name:
Polygon Amoy
- Default RPC URL:
https://rpc-amoy.
polygon. technology/ - Chain ID:
80002
- Currency symbol:
POL
- Block explorer URL:
https://amoy.
polygonscan. com/
- Network name:
- Click Save.
Import a token
- In your MetaMask wallet, under Tokens, select Polygon Amoy from the network dropdown.
- Click the overflow menu (), and select Import tokens.
- Click Select a network > Polygon Amoy.
- Under Token contract address, paste the Polygon Amoy testnet contract address:The Token symbol field automatically updates with
0x41E94Eb019C0762f9Bfcf9Fb1E58725BfB0e7582
USDC
and the Decimals field with6
. - Click Next.
- Verify that you’re importing the
USDC
token, and then click Import.
Your MetaMask wallet now shows Polygon Amoy and USDC in the tokens list.
Get testnet assets
- Open faucet.circle.com
- Click USDC.
- Under Network, select Polygon PoS Amoy.
- Under Send to, paste your wallet address.
- Click Send 10 USDC.
In addition to USDC for making payments, you need POL to pay transaction costs:
- Open faucet.polygon.technology.
- Under Select Chain & Token, select Polygon Amoy and POL.
- Under Verify your identity, click the third-party platform you want to authenticate with, and complete the login process.
- Under Enter Wallet Address, paste your wallet address.
- Click Claim.
Testnet transactions can take a few minutes to complete. Check your wallet to confirm that the USDC and POL has transferred.
More testnet faucets
Check these faucet services for more testing token options: