#esset

1 messages ยท Page 1 of 1 (latest)

gloomy pecanBOT
rare jetty
#

So you are sending the same idempotency_key but different orders in body?

mighty aspen
#

Yes

#

I'm not sure if that's why idempotency fails but it's the best guess so far

#

here's a req id: req_zsLRbSfU3qzi9u

rare jetty
#

Yeah I believe it's pretty much the case. The body should be the same

mighty aspen
#

Hm... does that really make sense though; the ordering of JSON object properties cannot be guaranteed, right?

rare jetty
#

You can think the whole body as a string, to be encoded. If the order is different then the string is different

mighty aspen
#

hm, ok. not quite sure it's easy to resolve on the calling end (all properties are being constructed in the same way, so the different order isn't applied deliberately).

#

Can I ask you about the Stripe Node.js SDK, too?

rare jetty
#

Sure!

mighty aspen
#

but... we're using "await" rather than ".then()", and, looking at the type definitions, I can't see the returned object from accounts.create() matching the example where the first value is the error...

#

would the StripeError be thrown = we should catch it and check the type?

#

An error is only thrown when you don't pass a required argument to a resource method. All REST or otherwise asynchronous errors will be available as the first argument of any Stripe method's callback:

rare jetty
#

Um I am not super familiar with Typescript, but I think you still be able to try/catch, no? Let's see this example code: https://github.com/stripe-samples/accept-a-payment/blob/main/custom-payment-flow/server/node-typescript/src/server.ts#L102

GitHub

Learn how to accept a payment from customers around the world with a variety of payment methods. - accept-a-payment/server.ts at main ยท stripe-samples/accept-a-payment

mighty aspen
#

thanks. yes, that was my expectation, too, but the part about not throwing errors...threw me off a bit.

#

does the error object include the same properties as the HTTP error, e.g. type + message + param?

rare jetty
#

Um not sure but I think it should. Have you tried it?

mighty aspen
#

was hoping to be able to see it in the docs or type defs ๐Ÿ™‚ but I'll figure it out

#

thanks

#

oh, one last thing;

#

Does creating a Person also disallow PO box addresses in the US? Or is it just when creating company accounts?

rare jetty
#

Um what is PO box addresses? Sorry...

mighty aspen
#

I'll figure it out ๐Ÿ™‚

#

thanks