If you are developing a sales or subscription site, then billing and payments play a major role. To integrate billing various software are available. Stripe is one among them, the advantage of stripe is that you don’t need a merchant account or gateway as it act as one.
Integrating stripe in your site can be done in two ways:
- Create a plan that defines how much should be billed and at what interval
- Associate a plan with a customer to create a subscription
1: Create a plan
To create a plan in Stripe you need to define two components namely Plans and Customers. Plans basically explains cost set for the payment and billing cycle. You can add n number of plans based on your requirement. The plan creation can be done by two ways
- In the Stripe Dashboard, on the plans page
- Via the API
Note: Stripe support only the plan id, name, metadata (set and unset metadata), statement_descriptor details of plan will be changed in future.
2: Subscribing a customer to a plan
The typical second part is the customers. The process is not complete without the users. This is basically associating the users with the stripe account. The customer data contains some metadata association such as email id. It should also stores the details such as credit card details and payment method associated with the user.
You can create customers via the Dashboard, but as you’ll likely create them as part of the workflow at your site, it makes more sense to use the API.
Upgrading and Downgrading Plan
Stripe also provides the facility to upgrade and downgrade the plans. Upgrading and downgrading is nothing but altering the subscription price, billing cycle, interval and so on. This is possible at any time and Stripe will prorate the difference automatically.
The change in plan will be effective immediately. If you upgrade to a premium plan then the updated features will be effective immediately and at the same time if your downgrade from a premium plan to a basic plan then the premium features will be effective till the completion of the billing period. Once the billing period is over the new features will be effective.
Note: Stripe will charge the customer same day the subscription is created.
Implementation of the plan
The above logic can be achieved in one of the following method,
We can upgrade the plan by delete existing subscription of the customer and create the new subscription for the customer and we can prorate the customer by creating invoice for remaining unused days. Stripe change the billing cycle to current subscription creation date and charge the customer accordingly.
Note: Stripe will not prorate the customer automatically on deleting(unsubscribe) the subscriptions.
We can downgrade the plan simply by update the subscription and set proration to false when update subscription. This means the amount charged for the old plan will not be refunded and next plan start from upcoming billing cycle.
This explains the ways to integrate stripe as a subscription tool in your site. Stripe is a startup growing rapidly and its advantage of negating the merchant account helps many in creating an easy solution of subscription plan and easy to alter the same.