#Techy Geek
1 messages · Page 1 of 1 (latest)
- just https://stripe.com/docs/billing/subscriptions/billing-cycle#new-subscriptions , so that the initial invoice created on the 15th is prorated.
- the same I would say, as it would technically still work, but maybe you 'd want to specifically detect the current date in your code and if it's the first of a month, just create a subscription 'normally' without specifying a
billing_cycle_anchorsince it's not needed
Okay, @hearty juniper . Thanks for the information.
And what will be the value for billing_cycle_anchor ? Actual date or timestamp duration from current DateTime??
you would calculate some unix timestamp for the 1st of next month and pass that
for example maybe 1672563600 for 9am GMT 1st Jan 2023
Okay
And alongside that is it possible to add an additional amount based on GB used in the last month?
Like last month's user usage of 1 Gb, I will charge an additional $5. It's $5 per GB usage.
0 < usage < 1GB: $5
1 < usage < 2GB: $10
2 < usage < 3GB: $15
well you can add direct integer amounts when creating the subscription for a one time-fee that is charged when creating the subscription : https://stripe.com/docs/billing/invoices/subscription#first-invoice-extra , which might help there
we do support usage based billing with tiers too(https://stripe.com/docs/products-prices/pricing-models#usage-based-pricing) , but it's billed in arrears, so you can't really charge for some existing accumulated usage that happened before you created the subscription, it's not really how that works(hence why I mentioned you can pass some flat integer invoice item manually too). But that is what you'd use in general for this going forward on the subscription