Want to let your customers subscribe for your thing? Easy Peasy.
How We Do Subscriptions
TL;DR. First a plan is made, then it is subscribed to.
We have two concepts of how a Subscription works; either users can change the thing they're paying to get each month, or they can't. You don't change what you get on your Twitch, Netflix or HBO subscription. You just pay and you get the content. Products or services like these would use our Standard Plans to base their Subscriptions on.
Standard Subscriptions
As an example, let's say we're making Gamefly, a company that gives you access to video games for a monthly fee. Here's what we'll do:
Create a User
Create a Standard Plan
Create a Subscription
Set up Payment
Create a User
Gamefly wants to let theirs users sign in online, which will create a user through our API. To just create a new user, call the /users endpoint with a JWT. Thereafter, that will log in the existing user.
You create Plans in the dashboard (for now). Under Subscriptions, you'll see Plans. Near the top will be New plan +. Enter the the basic parameters; name, delivery interval, billing interval and price. For Gamefly, maybe the first plan we'd make would be a basic plan. In the plan's details, we can add a description and fill in a few other fields. Easy.
Create a Subscription
Now that the Plan is created, your users can subscribe to it.
Note: start_now must be set to true for the subscription to start automatically after creation. An associated payment_method must be in the request data.
Argument
Type
Description
plan
string
ID of the Plan associated with the subscription.
subscription_method
string
Name of subscription method. Must be license.
note
string
A short description.
start_now
boolean
If true, the subscription will start now.
POST /subscriptions HTTP/1.1Content-Type: application/jsonAuthorization: Bearer <jwt>X-Builton-Api-Key:<builton-api-key>Host: api.builton.dev{"plan":"5931697ed57ba271c0c7de66","subscription_method":"license"}
The fun part. Check out Payment Methods and Payments for all the parameters and related endpoints, as there are a few parts to getting paid. Here's the gist.
1. User adds a card
Your user will need to add a payment method, i.e. a credit or debit card, that they want to use to pay for their order.
Attribute
Type
Description
payment_method
string
Must be stripe for triggering a STRIPE payment method.
payment_method_id
string
Payment Method created with the card details (number, expiration month, expiration year, cvc).
And that's it. If the user has a payment method associated with them, it will get charged when the plan they've subscribed to says it should. And they get to game to their heart's content.