react-stripe-elements icon indicating copy to clipboard operation
react-stripe-elements copied to clipboard

Getting error with createPaymentMethod

Open ae3e opened this issue 7 years ago • 5 comments

Hi,

I'm working on the new payment flow to meet SCA regulation. I followed the migration guide and so I replaced the method (which works) :

let {token} = await this.props.stripe.createToken()

by :

let {paymentMethod} = await this.props.stripe.createPaymentMethod('card')

But I have the following error :

IntegrationError: Please provide either an Element or PaymentMethod creation parameters to createPaymentMethod.

I also tried to pass an empty object as second parameter.

let {paymentMethod} = await this.props.stripe.createPaymentMethod('card',{})

Then the request is sent but it returns an error with the message Missing required param: card. (Elements are not found to fill card's data?? Obviously, they're found with createToken method!)

I finally tried to upgrade api version on Stripe dashboard (#354) but without any luck. Am I missing something or is this a bug (npm package used is [email protected]) ?

ae3e avatar Jul 16 '19 10:07 ae3e

I am facing the same issue, works for createSource but not for createPaymentMethod

shujaattariq avatar Jul 16 '19 14:07 shujaattariq

Hey there! Thanks for the report. Taking a look at this.

oliver-stripe avatar Jul 16 '19 16:07 oliver-stripe

Since 3.0.0, this method should automatically find the elements and I was unable to reproduce this on 4.0.0 as well. Can you confirm that an older version of react-stripe-elements is not being used somehow?

I don't believe this is a bug as I haven't been able to reproduce on recent versions. Here's a rough fiddle I used to verify: https://jsfiddle.net/mjrLt082/2/

If you're still running into issues, please reach out to our support team at https://support.stripe.com/contact or come chat with us at #stripe on freenode.

oliver-stripe avatar Jul 16 '19 17:07 oliver-stripe

Shame on me ! I was running npm commands in the wrong folder... and so I was not using 4.0.0 release...

Now, it works... I really apologize...

ae3e avatar Jul 16 '19 20:07 ae3e

I had similar issues with the createPaymentMethod function not sending card details to the server. Updating from 3.0.0 to 4.0.0 fixed the issue.

tuomashatakka avatar Oct 21 '19 14:10 tuomashatakka