[Answered ]-Stripe payment intent throw invalid integer

1👍

At the bottom of your question, you shared the request id req_4TngiwH4P1ztKp which can be loaded directly in your Stripe Dashboard here: https://dashboard.stripe.com/test/logs/req_4TngiwH4P1ztKp

The error message is also trying to show what you did wrong as it reads

Invalid integer: {:"0"=>"2400"}

This usually means that you’re not passing the parameter the way the API expects it. Somewhere, it expects an integer but instead you passed a hash where the integer is associated with the 0 key. The only parameter your code is sending that should be an integer is amount. This means that your self.amount right now, instead of being 2400 is { 0: '2400'} likely because of the way you send it from your client. This is the part you want to debug.

I also recommend carefully reading Stripe’s documentation on error handling as they cover the basics of their API in all languages. Catching the error cleanly in your code would allow you to immediately see the error and where it comes from.

Leave a comment