#kun_api

1 messages ¡ Page 1 of 1 (latest)

sly lightBOT
#

👋 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/1386755488208781333

📝 Have more to share? Add more details, code, screenshots, videos, etc. below.

topaz sentinel
#

Received unknown parameter: subscription_data[billing_thresholds]. Did you mean billing_mode?"

I am getting this error

#

any help?

chrome forge
#

Hi there

sly lightBOT
chrome forge
tropic portal
#

Hi there, I'll be taking over for bismarck here, who needed to step away

topaz sentinel
#

Greetings

#

I need help

let me explain you the scenerio

tropic portal
#

Do you have additional context beyond what you described above?

#

I've read the summary there and bismarck's comments so far

topaz sentinel
#

sure

#

I have one product with three price id
1 SUB for 200 usd per month
2 PAYG for 1 QTy charge 10usd
3 Overage for extra QTY

These will be connected to subscription

so I am trying to create the subscription with three prices id

#

and here is my implementation

            const params: Stripe.Checkout.SessionCreateParams | any = {
                mode: 'subscription',
                line_items: [{ price: process.env.VALITRON_PAY_AS_YOU_GO_PRICE_ID }],
                subscription_data: {
                    billing_thresholds: { amount_gte: 1000 },
                },
                success_url: `http://localhost:3000/recruiter/credits/success?session_id={CHECKOUT_SESSION_ID}`,
                cancel_url: `http://localhost:3000/recruiter/credits/cancel`,
                metadata: recruiterEmail ? { recruiter_email: recruiterEmail } : undefined,
            };

else if (plan === "SUB") {
            const subParams: Stripe.Checkout.SessionCreateParams | any = {
                mode: 'subscription',
                line_items: [
                    { price: process.env.VALITRON_SUBSCRIPTION_PRICE_ID, quantity: 1 },
                    { price: process.env.VALITRON_OVERAGE_PRICE_ID },
                ],
                subscription_data: {
                    items: [
                        { price: process.env.VALITRON_SUBSCRIPTION_PRICE_ID, quantity: 1 },
                        { price: process.env.VALITRON_OVERAGE_PRICE_ID, billing_thresholds: { amount_gte: 10000 } }, // $100
                    ],
                },
                success_url: `http://localhost:3000/recruiter/credits/success?session_id={CHECKOUT_SESSION_ID}`,
                cancel_url: `http://localhost:3000/recruiter/credits/cancel`,
                metadata: recruiterEmail ? { recruiter_email: recruiterEmail } : undefined,
            };


tropic portal
#

okay, and what issue are you having?

topaz sentinel
#

got this error

tropic portal
topaz sentinel
#

So how can I acheve my requirements

#

any help?

tropic portal
topaz sentinel
#

So I cannot use the checkout directly with this way?

tropic portal
#

Not if you want to use the billing thresholds feature

topaz sentinel
#

Okay let me ask you a quick question
if my subscription incrementing the QTY
how can I trigger the invoice and charge the customer on every 1 QTY increment

tropic portal
#

You mean you want to update the Subscription mid-cycle, change the quantity of a price from n to n+1, and then cut an Invoice immediately?

topaz sentinel
#

yes

tropic portal
#

You could achieve that using the parameter proration_behavior: 'always_invoice'

https://docs.stripe.com/api/subscriptions/update?api-version=2025-05-28.preview#update_subscription-proration_behavior

Are you aware of our test clocks feature? With Subscriptions, fine tuning the exact behavior you want can be difficult. Test clocks allow you to create a simulation and advance the time for the Subscription so you can see the effects that your changes have and review the Subscription's Invoices, etc. I highly recommend using test clocks when developing a Subscriptions integration

https://docs.stripe.com/billing/testing/test-clocks

topaz sentinel
#

Is it possible that I create the subscription with session stripe checkout page

and then update the subscription with threshold value?

tropic portal
#

It seems to be possible based on a quick test, but again, I would highly recommend testing with Test Clocks to observe the behavior and ensure that it aligns with your desired effect