#simon-_best-practices

1 messages ยท Page 1 of 1 (latest)

frozen sonnetBOT
static mossBOT
#

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.

frozen sonnetBOT
#

๐Ÿ‘‹ 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.

small bear
#

Hi ๐Ÿ‘‹

I"m a little confused here. Are you creating a Subscription with the Checkout Session? If so, which recurring Price are you using?

idle blade
#

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

small bear
#

Okay so this would create a Subscription for $9.99/month and that is the flat fee you were referring to?

idle blade
#

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.

small bear
#

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?

idle blade
#

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.

small bear
#

I want to record usage of the graduated pricing Price
Does the customer's subscription include this price at that point?

idle blade
#

No

small bear
#

Well then that's a good place to start

idle blade
#

If they buy a subscription while purcahsing a report then yes

small bear
#

Which scenario are you asking about here?

#

Sorry this is not clear at all

idle blade
#

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.

small bear
#

Okay, well both a flat rate and tiered pricing will bill upfront

idle blade
#

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?

frozen sonnetBOT
small bear
#

aptly named ๐Ÿ˜…

idle blade
#

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?

wary mantle
#

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

idle blade
#

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'..

#

@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"},
)

wary mantle
#

Yeah ok so I think we were mixing up 2 things here

idle blade
#

So you can record the usage of a graduated tiered price after all

wary mantle
#

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

idle blade
#

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"],
)
wary mantle
#

yeah exactly

idle blade
#

Oh okay wow

wary mantle
idle blade
#

can you add the Meter to the Price via the dashboard?

wary mantle
#

Not sure. We don't know much about the dashboard in here

#

Recommend trying

#

We mostly just answer api questions

idle blade
#

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?

wary mantle
#

Yep I would create a separate meter for each price

#

You don't really need to if the configuration is going to be the exact same

#

But i think it makes sense to separate them by price