Stripe JS : use Stripe generated error messages!

Hello,

Using Stripe.JS or Stripe Library or whatever Stripe plugin can really be a pain in the *ss.

I would recommend, while building things, to use some text elements, and use :

Get Data from external API —> retrieve object (Payment intent for example), error parameter.

The Stripe API sends back wonderful, useful and specific messages, without which you can get stuck for days on a problem.

Hope that helps.

Michel

EDIT : for example, look :

{"error":{"message":"The provided PaymentMethod was previously used with a PaymentIntent without Customer attachment, shared with a connected account without Customer attachment, or was detached from a Customer. It may not be used again. To use a PaymentMethod multiple times, you must attach it to a Customer first.","type":"invalid_request_error"}}

Great, isn’t it ?

1 Like

Exactly how do you get it to show that message? I used Intent’s object and it just showed “payment intent” as result. I would like it to show exactly that message or atleast the online error_codes Stripe uses.

Is it the “last_payment_error”?