π³Stripe billing
Easily add payment plans to your web app with our Stripe integration (v1.7.0 onwards).
Easily add payment plans to your web app with our Stripe integration (v1.7.0 onwards).
To help understand subscriptions, it's useful to know how Stripe structures its data.
As we can see, a Subscription comprises several SubscriptionItems, which each match to a Price. This allows you a large amount of flexibility in constructing your subscription plans. Think of a plan in terms of a collection of Prices.
Thus, when you want to define plans for your users to buy, you:
Create a Product in Stripe
For that product, you create any number of prices - usually a monthly and yearly price
You copy the Price IDs and add them to your Petal Pro config as items
:
Usually, you will only have one "item" in there. But sometimes you may want to add two - eg. you might have a once-off price as well as a monthly price.
Quantity will also mostly stay the same - 1. If your plans have a number of seats - then quantitiy
would represent that variable.
The other info in the config is mainly for your front-end UI. The Stripe Prices are the main thing you want to copy across from Stripe.
Explain what a checkout session is, how our items are passed in as line items and how it generates a hosted checkout page Stripe
Explain how webhooks work and how we use Oban
These docs are a work in progress. Expect more soon! For now follow the "Adding a subscription" guide.