#jimit9792
1 messages · Page 1 of 1 (latest)
Could you please share the complete stacktrace? However I think the error message is quiet explicit, you can cancel the Tap to Pay only from the Activity and not on the callback. You need to udpate your flow
om.stripe.stripeterminal.external.models.TerminalException: Cancellation of a Tap to Pay transaction can only happen from the activity
atcom.stripe.stripeterminal.internal.common.adapter.CotsAdapter.cancelCollectPaymentMethod(CotsAdapter.kt:65)
atcom.stripe.stripeterminal.internal.common.adapter.ProxyAdapter.cancelCollectPaymentMethod(ProxyAdapter.kt:103)
atcom.stripe.stripeterminal.internal.common.terminalsession.TerminalSession$CollectPaymentMethodOperation.startCancel$terminalsession_release(TerminalSession.kt:1124)
atcom.stripe.stripeterminal.internal.common.terminalsession.Cancelable.cancel(Cancelable.kt:16)
atcom.givetap.view.ui.activities.DashboardActivity$cancelTerminalTapToPayTask$1.invokeSuspend(DashboardActivity.kt:433)
at kotlin.coroutines.jvm.internal.BaseContinuationImpl.resumeWith(ContinuationImpl.kt:33)
at kotlinx.coroutines.DispatchedTaskKt.resume(DispatchedTask.kt:235)
at kotlinx.coroutines.DispatchedTaskKt.dispatch(DispatchedTask.kt:168)
atkotlinx.coroutines.CancellableContinuationImpl.dispatchResume(CancellableContinuationImpl.kt:474)
at kotlinx.coroutines.CancellableContinuationImpl.resumeImpl(CancellableContinuationImpl.kt:508)
atkotlinx.coroutines.CancellableContinuationImpl.resumeImpl$default(CancellableContinuationImpl.kt:497)
atkotlinx.coroutines.CancellableContinuationImpl.resumeUndispatched(CancellableContinuationImpl.kt:595)
at kotlinx.coroutines.android.HandlerContext$scheduleResumeAfterDelay$$inlined$Runnable$1.run(Runnable.kt:19)
at android.os.Handler.handleCallback(Handler.java:942)
at android.os.Handler.dispatchMessage(Handler.java:99)
at android.os.Looper.loopOnce(Looper.java:226)
at android.os.Looper.loop(Looper.java:313)
at android.app.ActivityThread.main(ActivityThread.java:8757)
at java.lang.reflect.Method.invoke(Native Method)
at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run(RuntimeInit.java:571)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:1067)
this is the complete stack-trace
So yes, you need to call the cancel from an Activity and not from the callback
You need to update your flow
I get payment cancel callback on onFailure callback so I call that function from the onFailure method and this is as per the documantation
I imagine you are referencing to this part:
https://stripe.com/docs/terminal/payments/collect-payment?terminal-sdk-platform=android#collect-payment
Could you please share where you've notice that you should call cancelable.cancel() on callback onFailure ?
I saw the error log when i canceled the payment on onFailure and it was the transaction cancel.
so I call cancelable.cancel()
No don't call cancelable.cancel()
If it is not the proper way so could you please where I need to call the cancel method?
Just handle the error (for example by displaying an toast)
Why you need to cancel the method first ?
Before i put the toast but I got an email from Stripe about this:
Cancelling the Terminal.collectPaymentMethod() only causes the reader to no longer prompt for a card; the PaymentIntent remains in the requires_payment_method status. Only when calling Terminal.cancelPaymentIntent() will the PaymentIntent actually be moved into the canceled status. This allows the developer to cancel collection and recollect the PI under different circumstances if they choose to.
If they wish to cancel the PI (which would prevent it from being collectible anymore), they should call Terminal.cancelPaymentIntent() as well.
My payments status isremain incomplete in stripe dashboard
so i need to cancel them.
I also use the terminal reader and do the same thing to cancel payment and it works fine but when I use the Tap to Pay it gives error
Can you share the PaymentIntent id ?
pi_3O2VylEzGMAqDSOH1N5IdubH
This PaymentIntent is in a requires_payment_method status
So you don't need to cancel it
You can re-collect payment methods for it
But user cancel the payment from his side
In that case you cancel the PaymentIntent using the method Terminal.cancelPaymentIntent()
So no need to call the Cancelalbe.cancel()
In this particular usecase no I don't see why.