A place to discuss charging merchants for your apps and services using the billing API.
I'm building a Shopify App using the remix app template which will have usage based pricing based on the number of objects created and published by the merchant. So for example if the merchant creates 150 objects they will be charged for the 150 objects every month.
I've followed the documentation here: https://shopify.dev/docs/api/shopify-app-remix/v2/apis/billing and created a plan with a lineItem with the interval set too
lineItems: [
{
amount: 0.05,
currencyCode: 'USD',
interval: BillingInterval.Usage,
},
],
But I can't find any further information from this point on how to apply this charge based on the merchants usage each month. Has anyone successfully setup usage based pricing in a remix app which can shed some light on how best to approach this?
I am stuck at the same stage. If anyone can help ?
requirement: i want to create a recurring charge of amount 0 that will be accepted post installation and then based upon usage i will be updating the the amount before billing each month.
Hi @syedusama0786 @abhishek1108
We did end up solving this, we have stored the line_item_id in the database when creating the charge. Then we needed to use the appUsageRecordCreate graphQL mutation to create the charge.
For us we created a cron job which ran on the 1st each month to calculate how much their usage was and apply it this way. But cron jobs in Remix wasn't simple.
Thanks for reply @WeAreMode
I think, Usage based billing will be added in code same as we added it in Node.js template.
I have all the code and i will use the same code and hope it will work.
It also use appUsageRecordCreate graphql mutation.