capacitor-community / stripe

Stripe Mobile SDK wrapper for Capacitor
MIT License
185 stars 75 forks source link

readCancelled on collecting second payment. #346

Open divyesh-savaliya opened 2 months ago

divyesh-savaliya commented 2 months ago

Platform

Describe the bug collectPaymentMethod failed while accepting another payment with error readCancelled

To Reproduce First payment successful, when accepting payment again collectPaymentMethod failing with this error

Error (read): readCancelled {"message":"The command was canceled.","errorMessage":"The command was canceled."}

Using Function:

rdlabo commented 2 months ago

Did you run StripeTerminal.disconnectReader() after first payment successful?

ex) https://github.com/capacitor-community/stripe/blob/main/demo/angular/src/app/terminal/terminal.page.ts#L345C11-L345C44

rdlabo commented 2 months ago

Note) In some cases, it may be more convenient to remain connected to the READER when making successive payments. For this reason, automatic disconnection is not performed.

divyesh-savaliya commented 2 months ago

No, i did not disconnect reader because I want to keep it connected to accept multiple payments.

rdlabo commented 2 months ago

I have just tried it and it works fine at iOS.

(async ()=> {
  await StripeTerminal.initialize({ tokenProviderEndpoint: 'https://example.com/token', isTest: true })
  const { readers } = await StripeTerminal.discoverReaders({
    type: TerminalConnectTypes.TapToPay,
    locationId: "**************",
  });
  await StripeTerminal.connectReader({
    reader: readers[0],
  });

  // first payment
  await StripeTerminal.collectPaymentMethod({ paymentIntent: "**************" });
  await StripeTerminal.confirmPaymentIntent();

  // second payment
  await StripeTerminal.collectPaymentMethod({ paymentIntent: "**************" });
  await StripeTerminal.confirmPaymentIntent();

  await StripeTerminal.disconnectReader();
});

@divyesh-savaliya If you can't get it to work, give me a small reproduction code.

yllaw commented 1 month ago

I am also running into this issue.

There is an issue on the official stripe ios github: https://github.com/stripe/stripe-terminal-ios/issues/300

EDIT: What is odd is that sometimes it works but most of the time it will cancel

image
yllaw commented 2 weeks ago

Hey all,

I believe this issue can be closed as it was a bug with iOS.

Per Stripe's official ios github: https://github.com/stripe/stripe-terminal-ios/issues/300

....this is a known bug with iOS 17.4.1. It should be patched if you upgrade to iOS 17.5.