Stripe.js Elements unsolvable invalid_request_error

696 views
Skip to first unread message

Gilles

unread,
Jan 14, 2018, 9:48:17 AM1/14/18
to Stripe API Discussion
Hi there,

I just migrated from V2 to V3/Elements. I followed the doc and API and things were working as intended, I made a lot of tests with the testing tokens to check if everything were going well and it was, until now.

When I try to create a charge by using the informations entered in the card element, I get an invalid_request_error with the message "Could not find payment information". But when I use one of the tokens provided in the test area of the doc (like tok_mastercard, or tok_visa), everything goes well and I get a success feedback.
I was thinking the problem was coming from the token created when using card element content, but the logs tell me that the token is good.
I changed the API keys too.
I reduced my code to only the card element and the functions provided in the quickstart but I still get that feedback from server
I looked everywhere for a solution but I can't find anything.

I'm working on a local developpement area but until now it wasn't a problem at all as it was working well (and it works well with testing tokens)


Remi J.

unread,
Jan 14, 2018, 9:53:04 AM1/14/18
to api-d...@lists.stripe.com
Hey Gilles,

This issue often happens when you send the whole token object in the `source` parameter instead of just sending the token id.

If you look into your logs in the dashboard [1], you should see your failed request as a POST /v1/charges. If you click on one of those, you'll see what you sent to our API and confirm what is passed in that parameter. It likely looks like `source: "{"id": "tok_123","....` instead of `source: "tok_123"`.

If that's the issue, you'll want to change your code sending the token to your server to ensure that you pass the token id and nothing else. You'll likely want `result.token.id` instead of `result.token` and you can see an example here: https://jsfiddle.net/edz9d5Ln/

If that's not the issue, our support team can look into your logs though and find out what's causing the bug. You can contact them here: https://support.stripe.com/email

Hope this helps!
Remi


--
You received this message because you are subscribed to the Google Groups "Stripe API Discussion" group.
To unsubscribe from this group and stop receiving emails from it, send an email to api-discuss+unsubscribe@lists.stripe.com.
To post to this group, send email to api-d...@lists.stripe.com.
Visit this group at https://groups.google.com/a/lists.stripe.com/group/api-discuss/.

Gilles

unread,
Jan 14, 2018, 10:12:21 AM1/14/18
to Stripe API Discussion
Hi Remi

It seems to have been the matter

I couldn't thank you enough for solving it that fast.


thanks a lot!
To unsubscribe from this group and stop receiving emails from it, send an email to api-discuss...@lists.stripe.com.
Reply all
Reply to author
Forward
0 new messages