Cofor.io integrates with Stripe to streamline management of your customers, payment methods, billing information, invoices, and seat-management.
The following are available for products that choose to use Cofor.io to manage billing and pricing. Cofor.io integrates with Stripe to manage payment methods, pricing plans, etc. and streamlines some functions.
For instance, products can tie user counts to plan item quantities on Stripe and automate that using Cofor.io.
Payment methods management
The user must set up their payment methods directly through Cofor.io or through Stripe (using the checkout screen). This provides a level of security to the user.
Team Product Plans/Pricing Mapping
Teams may use product pricing plans linked to the number of users in a team (per seat plans). To automatically update the quantity of a plan item when users/seats are added to a team on Stripe, you may configure seat-based pricing plan IDs on the Cofor.io Product Management page.
Automatic seat-management
When adding a plan to a team on Stripe from the list of seat-based plans configured on Cofor.io, changes in seat/user count automatically update the plan.
Subscribe a Team to Pricing Plans
When creating a team, you can pass a list of Stripe pricing plan IDs and quantities to the NewTeam function. Cofor.io will automatically subscribe the new team to the given quantities of plan items.
For instance, if you have a plan that is to be tied to the number of users (say pricing_plan_id_1) and you need two units of pricing_plan_id_2) which may be user-selected on your product frontend, you could create the team with the following code:
// Each plan object contains plan id and optionally, quantity
const plans = [{
plan: "pricing_plan_id_1"
}, {
plan: "pricing_plan_id_2",
quantity: 2
}];
const team = await cio.NewTeam(token, team_name, plans);
If a pricing plan ID is configured on the Cofor.io Product Configuration page to be tied to user count, quantity is automatically assigned as 1 when creating at team. When new users are invited, the quantity is increased at a pro-rata basis. When members are removed/deregistered from teams, quantity is decreased at a pro-rata basis as well.
Managing Subscriptions with the Stripe API
The
teamobject'sdataproperty hascustomer_idandsubscribtion_idproperties that contain the Stripe customer and subscription IDs for the team.The product can manage the customer subscriptions directly using the Stripe API as needed for granular control.
View Current Usage (upcoming invoice)
const upcoming = await team.GetUpcomingInvoice();
The upcoming object has the following schema:
{
due_amount: Number, // Number representing dollar amount due at next invoice
due_date: Date, // The day the next invoice will be sent/collected
items: [{
id: String, // Stripe item id
description: String, // Item description
unit_cost: Number,
quantity: Number,
line_total: Number
}, ... ]
}
View Past Invoices
const invoices = await team.GetPastInvoices(count=10, after=null);
The count and after arguments are for pagination. The after variable is the ID of the last item in the previous list.
The invoices response is a list with the schema:
[{
id: String, // Stripe invoice ID
amount: Number, // Total invoice amount
paid: Number, // Paid amount
url: String, // Link to download invoice
status: String, // Invoice status
}, ... ]
