Customer billing support will be provided via Stripe Billing setup separately for each application. Stripe will generally store all the information related to subscriptions tiers, offering configuration pricing and handling the payments associated with subscriptions. The result is the the stock application essentially need to implement two things to support payments:
Pricing Table / Pricing Page
Each application will provide a Pricing page that embeds a Stripe Pricing Table specific to the application.
- The code for the pricing table is embedded using a simple SCRIPT tag
- The look and feel of the pricing page is defined in the wrapping code and further configured in price
- The content of the page itself is automatically created and delivered via Stripe
- Activating a “Subscribe” button for any of the options will take the user to a hosted Stripe Checkout page
- The pricing page will setup the pricing table with the following information:
- Provide the mapped “Customer” object for the relevant customer
- A Checkout Session related to this Customer object
- We’d create a customer session for the user we’ve already authenticated server-side and return the client_secret to the client
- Set the customer e-mail
- The <stripe-pricing-table> web component supports setting the customer-email property.
- When the property is set, the pricing table passes it to the Checkout Session’s customer_email attribute, automatically entering the email address on the payment page
- Pricing is only shown to customer that have registered with the system and are logged in
Customer Billing Portals
- Customer specific billing portals will be provided via Stripe Billing Customer Portals support.
- Information on how to integrate these portals for each application is here. Key things to integrate
- Create the portal launch feature via a button that customers can click to enter the portal. (Instructions)
- Setup webhooks to handle changes in subscription notifications (Instructions)
- All the events provided via the webhooks into the customers action log
- Only the events related to customer.subscription.updated and customer.subscription.deleted will trigger updates to the customers subscription setup in the system
- When subscriptions are upgraded, downgraded, or canceled, you need to make sure that customers receive only the products or services they’re actively subscribed to.
- Stripe sends notifications of these changes to your integration using webhooks.
- In the Event object, look at the ID for the subscription or the customer to determine which customer the event applies to.
- Stripe also sends notifications if an invoice is paid to your integration using webhooks. In the Event object, look at the ID for the invoice or the customer to determine which customer the event applies to.