#lutthein_best-practices
1 messages ยท Page 1 of 1 (latest)
๐ Welcome to your new thread!
โฒ๏ธ We'll be here soon! Typically we respond in a few minutes, but sometimes we might take a bit longer if the server is busy or if you have a particularly tricky question.
โฑ๏ธ We close idle threads, which makes them read-only. Once a thread is closed it won't be reopened, but you can always start a new thread if you have another question.
๐ This thread will always be available, even after it's closed. You can find it again using Discord's search, or you can save this link: https://discord.com/channels/841573134531821608/1354494638735495189
๐ Have more to share? Add more details, code, screenshots, videos, etc. below.
Below are links to other discussions we've had with you in the past week in case you want to review that information. If your question is related to one of these previous discussions, please provide a comprehensive summary of the current state and what you need help with now. We help many users simultaneously, so a summary allows us to resolve your issue as soon as possible.
- lutthein_api, 55 minutes ago, 15 messages
Im using react native stripe sdk, and I already tested using cancelCollectPaymentMethod but it wont cancel the transaction in neither the Wisepad3 or M2 terminals
So you are saying this does not work for M2 or Wisepad3? https://docs.stripe.com/terminal/payments/collect-card-payment?terminal-sdk-platform=react-native#collect-cancel-collection
What does the Promise resolve to when you call this method?
Well, I can see a "Cancelled" promise since Im making a Promise.race (my approach as the M2 as no cancel button) between the collectPaymentMethod Promise and a button tap I created to call the cancelCollectPaymentMethod
--Screenshot--
But the PaymentStatus is still stuck in waitingForInput
But the PaymentStatus is still stuck in waitingForInput
Where are you seeing this?
well, I would expect it to change to any other status, in the Wisepad3 it gets stuck in that waiting for input screen
Hmmm... true, I would expect it to transition to ready since we should exit the current operation and be ready to accept a new command
also, I removed my logic to see if enableCustomerCancellation on its own would do it, but with a M2 terminal it throws a
Customer-initiated cancellation is only available on Android-based internet readers.
Yes, that requires the reader have some sort of interface
The X button on the WP3, for example
Yup, makes sense
Hmmm... okay I'm not seeing anything that looks like this reported in the GH issues page for that SDK.
I'm still digging
Thank you, cancelling the collectPaymentMethod is both not working for M2 and Wisepad3, in the Wisepad3 side, it is not a big deal, just tap the cancel physical button, but for M2 it certainly gets the process stuck
Okay and can you tell me what version of the SDK you are using?
It looks like this was flagged for both M2 and WP3 last year
"@stripe/stripe-terminal-react-native": "0.0.1-beta.23",
Hi, taking over as my teammate needs to step away. Let me catch up.
Sure, thank you!
It looks like you might be using a Beta version. Let me loop in a teammate who has more expertise here.
I was able to confirm that we document this behavior here: https://docs.stripe.com/terminal/payments/collect-card-payment?terminal-sdk-platform=react-native#programmatic-cancellation
You'll need to add a button in your app that calls the above function
let me check, thanks! I will try to PoC asap
Oh wait
yeah, I already do that haha
cancelCollectRefundPaymentMethod is the function you refer to?
Yes, you'd need to wire up a separate button to cancel the collection
Yeah, I do that while waitingforinput status
Nothing gets logged when I tap the button and call the function while the PaymentStatus is waitingForInput
Hello
Jumping into help out here
Can you take out the if condition to invoke the function directly?
Hi, thank you
Sure, I have logged and it is firing, reaching that point, the function just wont do anything.
that function returns a promise I think
can you modify the code a bit to receive a response and see if you're getting an error?
like
const { _, err } = await cancelCollectPaymentMethod();
console.log(_);
console.log(err);
also I wonder if it's just bad naming in the SDK for the function but there seems to be a cancelCollectSetupIntent function as well
Ah yup bad naming on our end
Since you're using SetupIntents, you need to use cancelCollectSetupIntent function instead - https://docs.stripe.com/terminal/features/saving-cards/save-cards-directly?terminal-sdk-platform=react-native#programmatic-cancellation
Sure one sec
So, for reference, the error from calling const { _, err } = await cancelCollectPaymentMethod(); is undefined
ah yeah it likely just returns one parameter back (in case there's an error)
so you should try
const { error } = await cancelCollectSetupIntent()
Onn it, changing it now
That was it! the M2 device actually does a Nah ah sounds and everything, perfect!
Awesome.. Sorry for the confusion earlier. I've flagged the weird naming issue internally already. Let's see if we can get it updated in future SDK releases.
It makes some sort of sense anyway, Im actually going to change the catch function in my setupIntent to also call cancelCollectSetupIntent instead of the cancelCollectPaymentMethod which apparently was not doing anything, it was the terminal or TapToPay who was handling the cancelation in case of an error
Sounds good! ๐
Anything else I can help you with?
That would be all, thanks so much appreciate it!