#paolo_api
1 messages ยท Page 1 of 1 (latest)
๐ Welcome to your new thread!
โฒ๏ธ We'll be here soon! Typically we respond in a few minutes, but sometimes we might take a bit longer if the server is busy or if you have a particularly tricky question.
โฑ๏ธ We close idle threads, which makes them read-only. Once a thread is closed it won't be reopened, but you can always start a new thread if you have another question.
๐ This thread will always be available, even after it's closed. You can find it again using Discord's search, or you can save this link: https://discord.com/channels/841573134531821608/1336691712369885214
๐ Have more to share? Add more details, code, screenshots, videos, etc. below.
๐
You should call /v1/billing/meter_events endpoint instead
More context:
I have this customer: https://dashboard.stripe.com/customers/cus_PnqYAu2RlnEQJT
It has a subscription: https://dashboard.stripe.com/subscriptions/sub_1Qp8XNGC2agebJWXmB5KHHM7
The subscription item has a price: https://dashboard.stripe.com/prices/price_1Qp80tGC2agebJWXL2MD7DK8
The price is usage-based and attached to a meter named "usage".
You should call /v1/billing/meter_events endpoint instead
yes, I know - but that doesn't seem to increment.
Here's my POST in postman:
It shows up in the meters dashboard:
Oh wait, now it showed up as incremented in the subscription. Is there a delay on Stripe's end or is this done via a job in the background? I swear I didn't see it before
No worries, yes it take some time to propagate.
Ok thanks!
Another related question:
Yes sure, happy to help, what it is ?
When creating a meter event, there's an identifier prop: https://docs.stripe.com/api/billing/meter-event/create#create_billing_meter_event-identifier
If I am reading this correctly, it seems very similar to the idempotency-key header.
Should we be using both? Or just one of them?
Mm not realy but they could be used for the same reason (to enforce uniqueness).
You can still use both.
idempotency-key is a header for all Stripe requests.
Ok, we will stick with using idempotency-key then, thanks!
Welcome!
Hi there ๐ jumping in as my teammate needs to step away soon. The idempotency key is used to allow you to safely remake a request, without risking duplicate action, if you do not receive a response and are unsure of the outcome of your previous request. I don't think it's comparable to the identifier parameter.
https://docs.stripe.com/api/idempotent_requests
Got it - thanks!
Last question:
For usage-based subscriptions, do you recommend we set up a different meter for every customer or can we reuse a single meter across all usage-based subscription prices?
Meters are attached to Price objects rather than Customers, so you can reuse them if you like.
https://docs.stripe.com/billing/subscriptions/usage-based/implementation-guide?dashboard-or-api=api
Yeah - was just short cutting it.
So say I have multiple customers:
- customer A, subscription 1 with price X, price X has meter Y
- customer B, subscription 2 with price X, price X has meter Y
when posting a billing event POST https://api.stripe.com/v1/billing/meter_events , and I specify payload[stripe_customer_id]=cus_A, only the usage on the invoice for cus_A will be incremented and NOT cus_B, right?
Yup
Thank you!
Really appreciate the quick help here! โค๏ธ