#simon-_best-practices
1 messages ยท Page 1 of 1 (latest)
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.
- simon-_best-practices, 14 hours ago, 3 messages
๐ Welcome to your new thread!
โฒ๏ธ We'll be here soon! We typically respond in a few minutes, but in some cases we might need a bit more time (e.g., server's busy, you've got a complex question, etc.).
โฑ๏ธ We close idle threads, which makes them read-only. Once a thread is closed it won't be reopened, but you can 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/1256312650799775847
๐ Have more to share? Add details, code, screenshots, videos, etc. below.
Hi ๐
I"m a little confused here. Are you creating a Subscription with the Checkout Session? If so, which recurring Price are you using?
The Subscription and Products are all created in Stripe via the dashboard. Then I use the Price object for a subscription during a Checkout. The price id is price_1PLsulKDnziSHEQ7Dw1ofYZr
Okay so this would create a Subscription for $9.99/month and that is the flat fee you were referring to?
That is the subscription to pay each month. With a subscription you can purchase reports at a cheaper and graduated rate. If it helps here is the product Id. prod_QFbUBiurYN0hW3
This product has 2 prices. 1 price is for a non-subscriber and one price for a subscriber.
Not really.
So a user completes the checkout session and they are now subscribed to $9.99/month.
What is it you want to happen after that?
I want to record usage of the graduated pricing Price (reports are what I sell) as they use the platform (id is price_1PP6HhKDnziSHEQ7YE7f1KIO).
I was adding usage by updating the subscriptionItems object so that the usage accrues and at the end of the month then the subscriber pays the 9.99 and any usage of the graduated priced reports.
I want to record usage of the graduated pricing Price
Does the customer's subscription include this price at that point?
No
Well then that's a good place to start
If they buy a subscription while purcahsing a report then yes
Which scenario are you asking about here?
Sorry this is not clear at all
And are you referring to Tiered pricing: https://docs.stripe.com/products-prices/pricing-models#tiered-pricing
Or usage-based-billing: https://docs.stripe.com/products-prices/pricing-models#tiered-pricing
which are two different pricing models
Ok taking a step back, all I really am trying to do is provide access to these reports without having to charge the User every single time they want one. I want to charge them at the end of the month.
Okay, well both a flat rate and tiered pricing will bill upfront
It sounds like Usage based billing might be a better fit for report consumption: https://docs.stripe.com/billing/subscriptions/usage-based/pricing-models#pay-as-you-go
Yep thats what I have
Which makes sense when creating the Subscription you add 'items' like so:
stripe.Subscription.create(
customer="{{CUSTOMER_ID}}",
items=[
{"price": "{{FLAT_MONTHLY_FEE_PRICE_ID}}", "quantity": 1},
{"price": "{{METERED_USAGE_PRICE_ID}}"},
],
)
But how do you add to this usage?
Okay, then you would create usage records to....record usage https://docs.stripe.com/billing/subscriptions/usage-based/recording-usage
aptly named ๐
See this is the really confusing part. I get it a Meter and Meter Event work hand-in-hand. How then does the graduated tiered pricing Price object 'connect' with this Meter??
Do you map the price id to the Meter? Or should I not be using the grad. pricing model at all?
Graduated pricing is different from usage based billing w/ meters
my colleague was suggesting you used usage based billing instead
since you're billed at the end of the month for that month's usage
thank you, so what I am gathering I should use a Meter and Meter Event to achieve what I am after.
Btw your docs refer to both graduated pricing and meter usage as usage based billing... hence the confusion when you say stick with 'usage based billing instead'..
'Tiered and graduated pricing: Similar to volume pricing, graduated pricing charges for the usage in each tier instead of applying a single price to all usage.'
https://docs.stripe.com/billing/subscriptions/usage-based/pricing-models#pay-as-you-go
@small bear mentioned tiered pricing will bill upfront so I'll stick with a Meter then.
The next question is how can I customize a Meter to have a graduated tiered scheme? For example 1st report is free, 2 - 5 reports is $10, 5-10 reports is $5 each?
AH I see now you add the meter as part of the recurring Price object.
stripe.Price.create(
currency="usd",
unit_amount=4,
billing_scheme="per_unit",
transform_quantity={"divide_by": 1000, "round": "up"},
recurring={"usage_type": "metered", "interval": "month", "meter": "{{METER_ID}}"},
product_data={"name": "Alpaca AI tokens"},
)
Yeah ok so I think we were mixing up 2 things here
So you can record the usage of a graduated tiered price after all
You can
I think my colleague was just confused about what you want
This looks to be more what you want ^
well similar anyway
that's volume pricing not graduated
but the concept is similiar
This is graduated pricing w/ meters: https://docs.stripe.com/products-prices/pricing-models#graduated-pricing
Thank you, that last link doesn't have a METER_ID for the recurring object. I would just add one right?
stripe.Price.create(
nickname="Per-minute pricing",
tiers=[
{"unit_amount": 500, "up_to": 5},
{"unit_amount": 400, "up_to": 10},
{"unit_amount": 100, "up_to": "inf"},
],
currency="usd",
recurring={"usage_type": "metered", "interval": "month", "meter": "{{METER_ID}}"},
product='{{PRODUCT_ID}}',
tiers_mode="graduated",
billing_scheme="tiered",
expand=["tiers"],
)
yeah exactly
Oh okay wow
see this for setting up the meter: https://docs.stripe.com/billing/subscriptions/usage-based/implementation-guide
then this for recording usage (which was linked already): https://docs.stripe.com/billing/subscriptions/usage-based/recording-usage
can you add the Meter to the Price via the dashboard?
Not sure. We don't know much about the dashboard in here
Recommend trying
We mostly just answer api questions
I have a number of reports (aka Prices ), Should I use a separate Meter and Meter Event for each one or have one Meter / Meter Event object to record all of the report usage? What is the benefit or downside with not have multiple Meter / Meter Events?