stripe / stripe-react-native

React Native library for Stripe.
https://stripe.dev/stripe-react-native
MIT License
1.25k stars 256 forks source link

cancelPaymentIntent doesn’t cancel a payment in the requiresCapture state #1630

Closed marvinklein closed 4 months ago

marvinklein commented 4 months ago

Describe the bug When calling cancelPaymentIntent with a valid payment intent ID for a payment intent in the requiresCapture state, the SDK returns this response object:

{"error": {"code": "InvalidRequiredParameter", "message": "There is no associated paymentIntent with id pi_xxxxxxxxxx"}, "paymentIntent": undefined}

Before calling the cancel method the payment intent is visible in the Stripe dashboard (in test mode) and I am definitely passing the correct payment intent ID. The payment intent I am trying to cancel is in the requiresCapture state. Canceling a payment works for payments in the requiresPaymentMethod state.

To Reproduce Steps to reproduce the behavior:

  1. Create a payment intent, tap/swipe the card and proceed until the payment intent is in the requiresCapture state.
  2. Attempt to cancel the payment intent by calling cancelPaymentIntent(...) with the payment intent ID.

Expected behavior The payment intent is canceled.

Smartphone (please complete the following information):

marvinklein commented 4 months ago

I submitted this as a bug to the stripe-terminal-react-native repo instead: https://github.com/stripe/stripe-terminal-react-native/issues/655