Automatically update subscription in Zoho Billing based on external user count
Hi everyone👋
I hope you guys can help me on where to start for the following requirement (code share will follow once it works 🤞).
I am selling a service billed per user to my customers using Zoho Billing. The invoice is sent on a monthly basis. To provide this service, I myself have to pay some money to a third party platform provider (also billed per user on a monthly basis). The platform provider charges me the highest amount of users identified within a billing cycle.
Example: My customer with 100 employees hires 5 people in the billing period January-February and fires 3 of them. In that case I’ll be charged 105 users.
So I need to do the same. Luckily, the platform provides a GraphQL API which returns the max amount of users for each billing period in the following format (the order seems to be somewhat random):
{
"data": {
"company": {
"usage": [
{
"startDate": "2023-08-16",
"maxLearners": 49,
"currency": null
},
{
"startDate": "2023-09-16",
"maxLearners": 50,
"currency": null
},
{
"startDate": "2023-06-16",
"maxLearners": 50,
"currency": null
},
{
"startDate": "2023-07-16",
"maxLearners": 49,
"currency": null
}
]
}
}
}So at the end of each billing cycle I need to get this data for each customer, find the right startDate, update the respective subscription with the maxLearners and send the invoice.
Do you have any idea where to start and what Zoho product to use?
Cheers!