You can bill customers using invoices, subscriptions, or Checkout. Examples for each of these methods is explained below.
If you need to invoice a customer for a one-time charge like your setup fee, create an invoice item by passing the customer ID, currency, and price:
You can then create an invoice for your customer and the invoice item will be added automatically:
To create a subscription, combine a recurring price with a customer. If you would like to bundle one-time purchases with a recurring purchase, you can do so by using
This creates a 10 USD/month subscription for the prices analytics dashboard and charges a one-time set up fee of 20 USD. The customer will be charged 30 USD for their first month and then 10 USD each month after that.
You can also use
add_invoice_items when updating subscriptions, including with pending updates. All invoice items configured in
add_invoice_items will be created immediately. If the update results in an invoice, the invoice items will be included on that invoice. Otherwise, the invoice items will remain pending on the customer and will be picked up by the next invoice. If your business charges additional fees when upgrading to a new service, you would pass the price for that fee in
Using subscription schedules
Some of your customers may want to schedule their analytics dashboard service to start in the future or only sign up for a year of service at a time. Using subscription schedules, you can configure phases with a recurring price to start in the future and/or end on a particular date. If you would like to bundle one-time purchases with the beginning of a phase, you can do so by using
add_invoice_items on a phase:
This will schedule a 10 USD/month subscription to begin in the future and its first invoice will include a one-time fee of 20 USD.
add_invoice_items is configured on future phases, invoice items will not be generated until that phase begins. If you set
add_invoice_items on the current phase, invoice items will be generated immediately.
Checkout creates a secure, Stripe-hosted payment page that lets you collect payments quickly. As a busy entrepreneur, you focus on improving your analytics dashboard product rather than your checkout flow.
A Checkout Session represents the details of your customer’s intent to purchase. You create a session when your customer wants to pay for something. After redirecting your customer to a Checkout Session, Stripe presents a payment form where your customer can complete their purchase. Once your customer has completed a purchase, they are redirected back to your site.
Checkout supports recurring and one-time purchases using prices:
Similar to the subscriptions example, this Checkout session creates a 10 USD/month subscription and charges a one-time fee of 20 USD. The customer will be charged 30 USD for their first month and then 10 USD each month after that.
In some cases, you might want to use a custom price that has not been preconfigured. For example, donation sites often allow customers to specify the amount they want to donate. In this case, you’re offering a limited time promotion to “choose what you pay” for your analytics dashboard. You can pass in
price_data instead of a price ID. For example, subscribing a customer to a monthly subscription with a custom price might look like this:
This creates an ad-hoc
active=false recurring price of 50 USD for the Starter Dashboard product and creates a subscription with the new price. These ad-hoc prices cannot be updated once they have been created.
You can also pass
price_data into the Checkout, Invoice Items, and Subscription Schedule APIs.