#Markan97
1 messages ยท Page 1 of 1 (latest)
๐ happy to help
I think it's doable with https://stripe.com/docs/api/subscriptions/create#create_subscription-billing_thresholds
Complete reference documentation for the Stripe API. Includes code snippets and examples for our Python, Java, PHP, Node.js, Go, Ruby, and .NET libraries.
I think I've already tried this, and it didn't work. It was related to metered usage, according to what I saw on the dashboard.
I will try again, give me some time to attempt it, and I will get back to you to let you know how it went.
but I think in your case it's better to use the threshold on the subscription item https://stripe.com/docs/products-prices/pricing-models#usage-threshold
When do I define the threshold for a subscription - when updating the subscription or when creating the subscription?
you can do both
let me try
Can you please check why the charge was not made? Could you please take a look at this subscription: sub_1MgQwoC59TMCvkXUrVeSMIoH?
yes sure
ty
I set the first 12 to be $0, which is fine, and was not charged. The 13th unit should be charged $350 immediately upon exceeding the 12th unit, but this did not happen. Instead, it was added to the next subscription billing, which is for one year, and this doesn't work for me.
The threshold is set to charge immediately upon exceeding $100.
ok I do understand now
in that case what you need to do is use the first threshold (monetary-threshold) that I've sent you earlier with amount_gte
instead of the usage threshold
you can set the amount_gte to 350
Can you give me an example of how to set this up?
This is how I did it this.stripe.subscriptions.create({ customer: 'cus_NR608Z7zYkO28h', payment_settings: { save_default_payment_method: 'on_subscription', }, items: [ { price: 'price_1MgCctC59TMCvkXUAwK3itGZ', }, ], payment_behavior: 'default_incomplete', proration_behavior: 'always_invoice', expand: ['latest_invoice.payment_intent', 'plan.product.default_price'], cancel_at_period_end: false, billing_thresholds: { amount_gte: 35000, reset_billing_cycle_anchor: false, }, });
Did you tried this?
https://stripe.com/docs/products-prices/pricing-models#monetary-threshold
And what is happening and what are you expecting exactly ?
Let me check..
I see that you are updating the subscription quantities and not the usage metered.
The thresholds are applied when you report usage metrics:
https://stripe.com/docs/products-prices/pricing-models#reporting-usage
Cannot create a usage record with usage type `licensed`. You can only create a usage record for metered plans. run into this error
You need to use a metered price:
https://stripe.com/docs/products-prices/pricing-models#metered
next error ๐
Your amount-based billing threshold of 35000 is smaller than or equal to the total amount of 360000 of all flat fees on metered prices.
Yeah, threshold need to be greater than of all flat fees on metered prices. I think the error is quiet explicit.