#_api

1 messages ¡ Page 1 of 1 (latest)

calm haloBOT
#

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

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

subtle wave
#

https://docs.stripe.com/rate-limits#rate-limiter

The basic rate limiter restricts the number of API requests per second as follows:

Live mode: 100 read operations and 100 write operations
Test mode: 25 read operations and 25 write operations

Learn about API rate limits and how to work with them.

verbal moth
#

Sure. This is my test req Id.
req_67aXwd4ym5dELz

subtle wave
#

Thanks, let me take a look

#

Ok, so there were some earlier request to update the subscription item of the same subscription.

verbal moth
#

Yeah, in our environment we need to update subscription quantity one by one when new person was invited to organization or leave organization.

So, I want to know is how many times are max limit request in an hour using this API. There is no exact count of limit in an hour in subscription update API docs. And also is there any way to increase limit of this API?

subtle wave
#

When you created a request to update a Stripe resource, stripe will lock the relevant object (i.e., the subscription) to ensure the data integrity

#

Therefore, increasing a limit in your case doesn't really help. What you should do is to aggregate the changes in your application first, and change one API request to update all changed fields.

verbal moth
#

Understood.

However, the way it should be implemented in the current service is that when a new person joins the organization, the payment should be made immediately, and if someone leaves, the refund should be made on a pro-rated basis, so the update of the quantity should be made immediately.

Is it possible to handle this case using the meter API in stripe? Does the meter API not have API limits like subscription updates?

subtle wave
#

Meter APIs has a higher rate limit, but I'm not entirely sure if it's the best billing model for your use case.

#

Do you expect your customer to update the quantity very often?

verbal moth
#

I'm not sure how often users will use the API to update subscription quantities, but if we know what the limit is for that API in an hour, then we can put a limit on it.

Also, when a 429 error occurs, is it possible for stripe to retry the process when it's back to normal, or to allow retries?

subtle wave
#

Stripe will retry a 429 error if the error code is lock_timeout. No it won't retry req_67aXwd4ym5dELz as its code is rate_limit

verbal moth
#

So we don't know when this rate limit will be released? When I called the update API again 5-10 minutes after seeing this error, I got the same error.

subtle wave
#

What's the new request ID?

verbal moth
#

A rough guess is that the number of times subscriptions go up or down in an organizational model is probably no more than 100 in an hour.

Even if the rate limit is a bit higher in Live mode, can't it cover the above number of API requests?

subtle wave
#

You said you got the same error after 5-10 mins, kindly share with me the ID of the request so I can check again

verbal moth
#

Sure.
req_JnqcFn0uVEsrM7
req_wLDQAxMv2gLGqw
req_4mL3sEgyiWwfy3

subtle wave
#

I'm still working at this, and I'll let you know when I find something

verbal moth
#

Okay. Thank you.

subtle wave
#

Thanks for waiting.

#

I noticed that you are using a test clock for this customer. Can you advance the test lock after each update?

verbal moth
#

Are you saying to turn back the test clock?

subtle wave
#

No, you can't turn back the clock,

#

I mean you should advance the test clock after each update to the subscription. Updating the same subscription many times without advancing the test clock will result in an error

verbal moth
#

oh i understood.

#

I'll test again and ask you if the same thing happens

#

Thank u for answer.

subtle wave
#

Happy to help!