#adityalystlocdeveloper_33428
1 messages · Page 1 of 1 (latest)
Hello! We'll be with you shortly. Below are links to other discussions we've had with you in the past week in case you want to review that information. If your question is related to one of these previous discussions, please provide a comprehensive summary of the current state and what you need help with now. We help many users simultaneously, so a summary allows us to resolve your issue as soon as possible.
- adityalystlocdeveloper_33428, 1 day ago, 37 messages
- adityalystlocdeveloper_33428, 1 day ago, 21 messages
👋 How can I help?
hello i have metered plan if user used our plan till the month invoice draft invoice is created i want to add usages record for that entire last month . But currently it was creating record but for next invoice i want it for last month
which event i can use to add that metred usage for a month and charge at the end of month
i want to add overall month usages at once
Once the invoice is created with invoice.created, you can report usage that occurred within the last few minutes of the previous period. If the invoice for the previous period isn’t finalized, we add that usage to it.
Reference: https://stripe.com/docs/billing/subscriptions/usage-based/recording-usage#clock-drift
yes i want to do that only when invoice is in draft i wanto add total usage of that particular month but it was adding in next month
case "invoice.created":
const invoiceid = eventdata.id;
const invoicesubscriptionitemid = eventdata.lines.data[0].subscription_item;
const amounttobepaid = eventdata.amount_due;
if (amounttobepaid > 0) {
await stripe.subscriptionItems.createUsageRecord(invoicesubscriptionitemid, {
quantity: 25500,
action: "set",
});
}
we have to give time paramter?
to add in last month?
Can you share the request ID (req_xxx) which you attempt to submit the usage? Here’s how you can find it: https://support.stripe.com/questions/finding-the-id-for-an-api-request
Find help and support for Stripe. Our support site provides answers on all types of situations, including account information, charges and refunds, and subscriptions information. Get your questions answered and find international support for Stripe.
req_xR0AVZ0PmRyQ0n
just to be clear i want metered usages when invoice is in draft for last month
hello
sorry, that's not possible at the moment. Usage reported after a billing period ends, even if its during the 5 minutes buffer time, will always fall into a new period. Basically, once a period has closed, our system will not allow usages to be reported in the closed period
any solution for this