stripe-terminal-react-native icon indicating copy to clipboard operation
stripe-terminal-react-native copied to clipboard

cancelPaymentIntent doesn’t cancel a payment in the requiresCapture state

Open marvinklein opened this issue 10 months ago • 3 comments

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):

  • iPad 6
  • Stripe Reader M2
  • "@stripe/stripe-react-native": "0.28.0",
  • "@stripe/stripe-terminal-react-native": "^0.0.1-beta.11",

marvinklein avatar Apr 01 '24 20:04 marvinklein

Do you have a Payment Intent ID or a request ID that we can look closer at?

billfinn-stripe avatar Apr 01 '24 20:04 billfinn-stripe

Sure. pi_3P1snBDLXVGdoDbn1wYFlVqI. We can cancel this payment intent using the web API. It’s only the react native terminal SDK cancelPaymentIntent method that fails with the error response above. I can’t see the terminal SDK’s cancel attempt in the stripe dashboard so perhaps the terminal SDK isn’t even making a web request. I also don’t think it's a timing issue since I already see the payment intent in the dashboard before I attempt to cancel it using the terminal SDK. I’d be happy to hop on a call and demonstrate the problem if that helps.

marvinklein avatar Apr 04 '24 16:04 marvinklein

Can you try upgrading to the latest release (17)?

I believe this error was fixed (or at least changed) as part of https://github.com/stripe/stripe-terminal-react-native/pull/551.

billfinn-stripe avatar Apr 04 '24 16:04 billfinn-stripe

hey @marvinklein did you get a chance to test this on the latest release?

nazli-stripe avatar Apr 25 '24 07:04 nazli-stripe

Closing this due to inactivity, feel free to open a issue if the issue still persists

nazli-stripe avatar May 21 '24 06:05 nazli-stripe