#pierre_best-practices
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/1344394251827412993
๐ Have more to share? Add more details, code, screenshots, videos, etc. below.
Here's a screenshot of the current checkout session, for reference.
And here's how I am setting up the checkout session
params.line_items = Some(vec![
CreateCheckoutSessionLineItems {
price: Some(env::var("STRIPE_FLAT_PRICE_ID").unwrap()),
quantity: Some(1),
..Default::default()
},
CreateCheckoutSessionLineItems {
price: Some(env::var("STRIPE_METER_PRICE_ID").unwrap()),
..Default::default()
},
]);
Hi, can you confirm exactly what your customers would like to see instead?
I modified the HTML to give an example, note that there is no longer "Subscribe [...] and 1 more" in the title, that there is a single line item with the first 100k units at 49 euros
Hi there ๐ jumping in as my teammate needs to step away soon. Please bear with me a moment while I get caught up here.
Hmmm, I think the simulator got fixed in the stripe dashboard, because it seems that even with 0, the customer is billed 49euros now
When I tried few weeks back, 0 would put the amount at 0 euros
Ah no, still not with "graduated"
Taking a step back, is volume or graduated better for your use case here?
I want to be sure we're aligned in what we're looking into.
Here's the final goal:
- To have a base price of 49euros, that includes the first 100k request, even if no request is performed.
- Then, after the first 100k requests, there is tiers that makes the cost per unit decrease
It's materialized by the simulator at the bottom of this page https://www.merklemap.com/pricing
Then, after the first 100k requests, there is tiers that makes the cost per unit decrease
Will the price of the first 100k requests be impacted by the price decrease, or only requests beyond the initial 100k?
I want the first 100k to be a base package, that stays at the same price, whatever the usage.
0,1 or 80k requests, the price should stay 49 euros.
Because we sell other things than API services, but want to have a single subscription / product
And, looking at the two screenshots above, it's not clear why "tiered" would start at 0euros if no metered usage even though the first unit is 0
Which is why I'm curious what you see when you actually create the Subscription, my team doesn't spend too much time in the dashboard, so I'm not familiar with or confident in what it shows.
Ah
I am going to try to stand up a test of mine own, but this flow is a bit complex and may take me a bit to piece together between other threads.
Thank you!
And appart from the UX part, I'd love to have a single price to be able to benefit from https://docs.stripe.com/payments/checkout/adaptive-pricing as well as https://docs.stripe.com/payments/checkout/upsells
Adaptive Pricing doesn't work with Checkout Sessions in subscription mode:
https://docs.stripe.com/payments/checkout/adaptive-pricing?payment-ui=stripe-hosted#:~:text=Are in subscription mode.
Ah, bummer. Thanks!
Before I get too far into building this test. Are you planning on using Usage Records (legacy approach), or Meters and Meter Events (new approach) for reporting usage to us?
I am using the meter api using the ingest v2 endpoint
Don't bother, I created a new price
I am trying it out now
And here is the tiers table
What I'd need is "For the first 0 to 100,000"
I just created a Price using tiers in this fashion:
recurring: {
interval: 'month',
usage_type: 'metered',
},
product_data: {
name: 'Tiered Price testing'
},
billing_scheme: 'tiered',
tiers_mode: 'graduated',
tiers: [{
up_to: 100000,
flat_amount: 4900,
},{
up_to: 'inf',
unit_amount: 1,
}]```
And when the usage is 0 the $49 flat fee is shown on the upcoming Invoice.
You're saying that's not what you see when you create the Subscription for that Price but haven't reported usage yet?
Exactly
Can you share the ID of the Subscription from your test?
Ah, to make things fast, I tried with the "live" environment, and only created a price, not a sub I am not sure if you'll have access to this price_1QwqxTRr03lycn02ACGEfclB
I always recommend testing in testmode rather than in livemode. Based on what I'm seeing in my testing, the first tier is used even if the usage is 0 when a Subscription is actually created. I think the dashboard just shows a misleading value when it shows that the first tier starts at 1. But I want to ensure you're seeing the same behavior when you're actually creating a Subscription.
I'm adapting my test to use a meter now to ensure that doesn't make a difference in the behavior I'm seeing.
But then, what about this screenshot that shows 0 euros? (no free trial here)
Yes!
That's expected. Since everything is under a metered Price, and those bill in arrears (at the end of the billing period), the customer doesn't pay the flat fee until the end of the month. So the amount due on the first Invoice is 0.
Ah, I see, that's definitely not what I want either
I guess I am stuck with two prices then
Oh, yeah, if you want them to pay the flat fee up front, you need two Price objects.
It'd help if I could attach a price to the names in the checkout sessions
It's very confusing atm
You could tack on a one-time price that only applies to the first invoice. I'm not sure if that would be more or less confusing for your users.
You can create them under different Product objects with different names.
At that point, It'd probably be easier to implement the checkout page myself using stripe elements
Ah, that's smart
Thanks, I will explore that. You were extremely helpful!
Happy to help!
That's certainly a lot better
Well, I didn't expect the fix to be that easy. I ignored that subscriptions could contain two products
Thanks again!
Any time!