Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

ERROR: You must provide paymentIntent that was returned from either createPaymentIntent or retrievePaymentIntent. #786

Open
a-eid opened this issue Aug 15, 2024 · 4 comments

Comments

@a-eid
Copy link
Contributor

a-eid commented Aug 15, 2024

Describe the bug
We're getting this error: You must provide paymentIntent that was returned from either createPaymentIntent or retrievePaymentIntent., from the method collectPaymentMethod, even thou the passed paymentIntent is returned from the retrievePaymentIntent method call.

To Reproduce
Steps to reproduce the behavior:

// 1- collection client secret.
const clientSecret = await api.post("endpoing", { amount });
// 2- retrievePaymentIntent from stripe 
const { paymentIntent, error } = retrievePaymentIntent(clientSecret);
// 3- collect payment method 
const { error: collectPaymentMethodError } = await collectPaymentMethod({
   paymentIntent,
   skipTipping: true,
});

// ERROR: `You must provide paymentIntent that was returned from either createPaymentIntent or retrievePaymentIntent.`

Expected behavior
for collectPaymentMethod to accept the paymentIntent returned from retrievePaymentIntent

Stripe Terminal React Native SDK version

  • ^0.0.1-beta.20

  • Device: Iphone 15 Pro Max

  • OS: IOS

@a-eid
Copy link
Contributor Author

a-eid commented Aug 26, 2024

any idea what this issue be, judging by the lack of comments I assume this is an issue on our part. any idea where could it be ?

@danmofo
Copy link

danmofo commented Sep 3, 2024

any idea what this issue be, judging by the lack of comments I assume this is an issue on our part. any idea where could it be ?

Maybe because you are missing the await keyword on this line?

const { paymentIntent, error } = retrievePaymentIntent(clientSecret);

vs

const { paymentIntent, error } = await retrievePaymentIntent(clientSecret);

@nabilfreeman
Copy link

nabilfreeman commented Sep 12, 2024

We are experiencing this on beta 20 which I just upgraded to. Downgrading to beta 19 makes this error go away.

We had a stable implementation in production prior to the upgrade, so I don't think it is a syntax issue in our case.

Update: This is actually because v20 changes the parameters of confirmPaymentIntent to be an object of parameters rather than just a payment intent.

So my code was this:

await confirmPaymentIntent(paymentIntent)

And I changed to this:

await confirmPaymentIntent({ paymentIntent })

@nazli-stripe
Copy link
Collaborator

@a-eid are you still running into this issue?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants