#Pain-subscriptions-limit

1 messages ยท Page 1 of 1 (latest)

honest knot
#

Hello ๐Ÿ‘‹
I don't think there are any limits on the number of subscriptions. Are you getting any errors creating more?

weary pumice
#

Yes, that's correct

#

When I tried adding them directly from the dashboard I received an error

#

Sorry was 3 not 5.

honest knot
#

Give me a moment to see if I can reproduce

weary pumice
#

Is it possible that it's happening because I'm using the test clock?

#

I also seem to be getting this error constantly when attempting to retrieve an invoice

#
message: 'This object cannot be accessed right now because another API request or Stripe process is currently accessing it. If you see this error intermittently, retry the request. If you see this error frequently and are making multiple concurrent requests to a single object, make your requests serially or at a lower rate.',
honest knot
#

Ah yes. that must be it. Test clocks have different behavior.

weary pumice
#

I am trying to grab two different invoices

#

My flow is to currently listen to incoming events from the Webhook for invoice.paid I have 2 subscriptions for 1 customer, when I speed up the time so both of them get paid I get the rate limiting error?

#

Status is 429, so it's stating I'm sending too many requests but I'm only sending 2?

honest knot
#

Do you have request IDs for these by any chance?

weary pumice
#

req_nP1xJg8DZR1Nmz

#

That's the only request ID in the error

#
const invoice = await stripe.invoices.retrieve(
  event.data.object.id,
 {
  expand: ['customer', 'lines.data.plan.product', 'subscription']
 }
);
honest knot
#

Gotcha. I don't think you're hitting the rate limit but it is possible that the test clock takes a little longer to release the objects.
Can you try adding a timeout maybe to see if that helps? AFAIK You'd not see these errors in live mode

weary pumice
#

I see, because from what I know I can send up to 100 requests per second

#

You want me to add a timeout before retrieving the objects?

honest knot
#

Yeah adding a timeout should probably tell us how long the test clock takes in order to release the objects

weary pumice
#

I will try a 2 second time out

#

It does the first one successfully

#

I will attempt with 5 seconds

#

Alright, I've tried all the way up to 5 seconds, nothing seems to work below

#

but 5 seconds does work

#

Nevermind seems like even that has issues from time to time

#

I will increase it to 6 seconds

honest knot
#

hmm interesting.
I believe you won't see the same behavior if you were to create subscriptions without test clocks

weary pumice
#

Yeah I believe there are some restrictions on the testclock, I guess it makes sense.

#

I will just remove the timeout in production and catch errors, will keep an eye out to see if they keep occurring.

#

Appreciate the feedback.

honest knot
#

Yup, NP! Feel free to use test mode objects in order to test this prior to deployment

weary pumice
#

Will do, have a great day.

honest knot
#

Good luck ๐Ÿ˜„

weary pumice
#

That's weird now it's not letting me grab even one?

#

I tried removing the timeout

#

I have a question, will the invoice_pdf we sent to the user prior to paying?

#

Or is just a receipt that's sent to them?

honest knot
#

It's a copy of the finalized invoice
I don't think users can pay using this URL

weary pumice
#

Oh I see

#

Where can I find the receipt that is sent to them?

honest knot
#

Hosted invoice URL would include a link to the receipt once the payment has been made
I know we do surface this somewhere on the object
Just having trouble locating the exact docs

weary pumice
#

I remember seeing this in the object a while ago, that's why I'm asking too.

honest knot
weary pumice
#

Oh right, that's where it was

#

Is this sent automatically to the customer?

honest knot
#

It is based on your account settings

weary pumice
#

I see, what about the invoice_pdf?

honest knot
#

that should have the copy of the finalized invoice
Different from a receipt

weary pumice
#

Is that sent to the customer at any point?

#

or is just the receipt that's sent?

honest knot
#

Just the receipt
unless your invoices are sent to customers for manual payments

weary pumice
#

I have these set up so only the receipt should be sent

#

and this setting is off, but this is for 3D secure

#

This one is on, so does that mean that invoice will be sent to the customer?

last pulsar
#

I believe that option only works for send_invoice option

weary pumice
#

Oh I see, so only the receipt will go out from stripe as I have that enabled?

last pulsar
#

let me rephrase

#

if you use the send_invoice behavior when creating an Invoice, you can manually send it through the send endpoint
OR
you can have it automatically send the Invoice email to the Customer when the Invoice is finalized

#

the latter being that toggle^

weary pumice
#

Oh I see, got it. Thank you very much for the clarification!