#altairsama2_api
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/1286284989201383566
đ Have more to share? Add more details, code, screenshots, videos, etc. below.
Also, is there a way we can combine subscription and meter apis? our usecase is, we want a running tiered subscription and only prompt the user for topup if their tokens run below a particular amount. The second case is handled via meter from what I saw on the docs
do we have to poll stripe for summary (https://docs.stripe.com/api/billing/meter-event-summary) and stop services
Yes you need to check the Summary yes
or you can check the invoice
ah, so basically check for invoice.created event?
so after invoice.created there's no indication from stripe's side regarding usagE?
also what about the second case? we would ideally want to generate a subscription on our end and send it to stripe and only allow automatic wallet topups if the client opts in for that
will meter supoprt this or should we stick with Stripe invoice?
where we generate adhoc invoices on the fly based on usage and send to stripe?
and stripe will auto deduct payments as per that invoice and let us know?
THere is the meter-event-summary you've shared too.
but we will have to initiate that, only invoice.created will be sent from stripe right?
also what about the second case? we would ideally want to generate a subscription on our end and send it to stripe and only allow automatic wallet topups if the client opts in for that
why you want to manage Subscriptions on your side ?
no, Stripe will manage that for us, this is for new client onboarding
as event, yes
we would ask them if they want to opt in for auto topups
and only then allow it on stripe
I havent found anything in the docs for this usevase
and in the api too
only way I can figure this is via manually calling stripe like stripe.Invoice.create(customer="cus_")
ah, thanks, appreciate it, how would you recommend us to proceed in this case?
Sorry I'm not sure I understand the use case... can you share a concrete example?
yeah sure my bad, let's say you are an openAI customer, you are using chatGPT and you are onboaring to their platform. and they ask you if you want to get auto debited once your tokens run low and you accept that,
and lets say, you opted for Tier A plan which gives 1mil credits for 1000$
but after some usage, you only have a 1000 credits left
stripe in this case will detect that and create an invoice and charge the customer for a topup
meanwhile the subscription will continue as usual
so 1000$/monthly for 1 mil credits
and some topup amount if credits in a month runs low
and this will be OPTIONAL, so based on usage and might be that the customer will never be charged for that
is there an existing API option you're using for this?
no, we are creating invoices ad hoc and tracking usage ourselves
I was checking out meter for our usecase
so your question is if we can do that automatically instead?
I doubt there's anything that directly does everything for you, but https://docs.stripe.com/billing/subscriptions/usage-based/alerts-and-thresholds#billing-thresholds is the closest to "charge the customer when usage reaches a certain amount".
can we integrate it with Meter somehow?
afaik subscription is another set of APIs
and in this case, we will need to trigger it ourselves
A meter is how you report usage of an item on a subscription, I don't think of them as separate.
ah, makes sense, so just to confirm, we listen for the alert on our end and then when we receive the event, we trigger the invoice flow on our end?
I think this suits our purpose perfectly but its in beta right now
would you recommend trying beta on prod?
yes, most of this is in beta and various states of being built as we try to solve for more advanced use cases than the existing usage APIs used to, it will be that way for a while
we'd say it's fine to use beta products, as long as you have the ability to change your integration when we move things from beta to GA as there can be changes/tweaks at that point, as opposed to "build once and never touch again".
ah, but chances of it breaking is nil right? only thing we have to make sure is to adap for any feature changes
depends what you mean by 'breaking'? No chance is ever nil.
also can you confirm this flow, would help a lot if this is indeed how its done for ease in migration
ah yeah, by breaking I meant, unexpected outages, incorrect reports etc
yes, seems like it would be useful for what you describe if you don't want to count the usage on your side for that alerting.
thanks, really appreciate the help here
I mean that's possible, and that's possible in GA APIs too really. It would really depend on the specific beta feature, they're all different and you generally work closely with the product teams involved. Sorry, my team doesn't work much with this, we only commit to doing developer support for GA features for the most part, if you have sales contacts or are deeply involved with the product teams they generally work with betas.
ah thanks, I'll send a email to our contact person with Stripe regarding this