Stripe subscriptions enable customers to make recurring payments for access to products or services, complete with a comprehensive API toolkit for managing the lifecycle and billing of these subscriptions.
Stripe provides a mechanism for businesses to facilitate recurring payments through subscriptions, requiring more customer information retention than one-time purchases. The core API resources essential for managing subscriptions include the Product, which defines what the business offers, and the Price, indicating the cost and charge frequency. Customer objects track multiple charges per customer, and the PaymentMethod details how the customer pays. The Subscription resource links product details to the recurring charge, and Invoices track payment amounts and statuses.
Landing Page: Initially, the customer provides an email or other details which are sent to the backend to create a Customer object while moving the user to a Pricing page. Pricing Page: This page displays subscription options derived from pre-created products and prices, allowing the customer to select the preferred option. Payment: A hosted form (Stripe Checkout) collects card details and performs the subscription creation, invoice generation, and payment collection, ensuring PCI compliance.
In the case of failed payments or the need for authentication (e.g., 3D Secure), Stripe uses PaymentIntents to track the lifecycle of the payment and Subscription objects to reflect the current status. If the payment is incomplete or action is required, notifications for authentication or payment method updates are needed.
Stripe automates the invoicing and payment attempts for each billing cycle. Dunning (attempts to recover overdue payments) can involve sending reminder emails or using the Smart Retries feature to optimize retry timing.
For non-payment invoices such as free trials, off-session payments can be managed using SetupIntents, allowing future charges without requiring customer re-authentication.
The subscription workflow entails creating the subscription, generating and paying the first invoice, and subsequently ensuring the subscription remains either active, past_due, or moves to other states like unpaid or canceled based on outcomes of payment attempts or business rules.
Stripe recommends the use of webhooks to handle subscription events effectively, like successful or failed payments, changes to subscriptions, or cancellations.
Businesses can control settings for Smart Retries, emails, manual payments, and handling of 3D Secure payments. Altering subscriptions without cancelation is feasible, supporting use cases like upgrades or pauses.