The client_secret provided does not match the client_secret associated with the PaymentIntent.
Platform
- [ ] Web
- [X] iOS
- [X] Android
Describe the bug If a previous request failed due to an error, attempting to make a payment again result in the following message: "The client_secret provided does not match the client_secret associated with the PaymentIntent."
To Reproduce
- Make a payment using a real card while keeping the Stripe key in test mode.
- This should result in a failed payment due to the mismatch between the live card and the test environment.
- After the failed payment, attempt to call collectPaymentMethod with a new payment intent ID.
- You should encounter an error message indicating that the client secret provided does not match the client secret associated with the PaymentIntent.
Another way to reproduce
- Connect to tap to pay
- Put app in background and then open the app
- Now try to make the payment
- It throws the error
Expected behavior It should open new payment sheet with new payment intent id.
Additional context Clear previous payment intent info if its failed.
Using Function:
- [ ] Payment Sheet / Payment Flow
- [ ] Apple Pay
- [ ] Google Pay
- [ ] Identity (@capacitor-community/stripe-identity)
- [X] Terminal(@capacitor-community/stripe-terminal)
After the failed payment, attempt to call collectPaymentMethod with a new payment intent ID.
If failed, another card can be tried in succession. If change collectPaymentMethod with PaymentIntent, you should run cancelCollectPaymentMethod before collectPaymentMethod.
Another way to reproduce
There does not appear to be a problem at this time. For longer periods of time, the Secret Key is likely to change and a revert algorithm will be required.
https://github.com/capacitor-community/stripe/assets/9690024/361e2ee1-c0c6-47d3-a029-5ced917d6c2d
@divyesh-savaliya Has this solved the problem? If so, close the Issue.
Closed due to lack of comments for a long time.