#uristri2_androind-terminal-cancel-pi

1 messages ยท Page 1 of 1 (latest)

sinful lintelBOT
#

๐Ÿ‘‹ 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/1475547482837749922

๐Ÿ“ Have more to share? Add more details, code, screenshots, videos, etc. below.

umbral pivot
#

Hello ๐Ÿ‘‹

#

Do you mean use a method from the Terminal Android SDK to cancel the Payment Intent?

delicate pike
#

yep

#

I'm trying to cancel a payment after authorization but before the capture

umbral pivot
#

Is there a particular reason for this?

delicate pike
#

backup flow in case we create the authorization but the order creation fails in our backend for example

#

user swypes the card -> collected payement -> order creation fails for external reasons

#

we want to cancel the authorization to avoid user having the confusion thinking we charged them

umbral pivot
delicate pike
#

I'm using it, no error but in the dashboard I still see Uncaptured instead of cancelled

umbral pivot
#

Do you have an example payment intent I can look at?

delicate pike
#

pi_3T430mGnytxJlNo91AgBj5II

umbral pivot
#

Hmmm.... there is no record of an attempt to cancel this payment intent

#

Are you logging the callback status?

delicate pike
#

I have a nother test with log

#

pi_3T43FRGnytxJlNo91WWOqRMz

#

Card Reader Native Status: {"platform":"Android","timestamp":"2026-02-23T14:49:01.546Z","message":"[Payment] PaymentIntent cancelled successfully (source=PaymentCubit-cancelCardPayment)","status":"info","metadata":{"class":"[StripePaymentManager]"},"reader_info":{"id":"tmr_GOCzZwwLNrsJoX","serial":"STRM26139005364","firmware_version":"2.01.00.38","software_version":"2.01.00.38-SZZZ_Prod_US_v12-481001","hardware_version":"STRM2-01 (0803)","device_type":"STRIPE_M2","label":null,"is_charging":false,"battery":0.24,"network_status":"UNKNOWN","is_usb_connected":false,"bluetooth_address":"CC:D3:1E:69:F6:50","location_id":"tml_E98NBgjxyNI9Ze"}}

umbral pivot
#

There is no attempt to cancel this Payment Intent

delicate pike
#

but I got the log...

umbral pivot
#

Those logs are not from our SDK.

#

At least not that I can tell. source=PaymentCubit-cancelCardPayment this doesn't exist in our SDK

delicate pike
#

that's from our side

umbral pivot
#

So your log might be incorrect. There is no API request to cancel either payment intent

#

We have a code snippet that I'd like you to try here: https://docs.stripe.com/terminal/features/refunds?terminal-sdk-platform=android#client-side

Terminal.getInstance().cancelPaymentIntent(paymentIntent,
    object : PaymentIntentCallback {
        override fun onSuccess(paymentIntent: PaymentIntent) {
            Log.d("CANCEL-PI", "Payment Intent ${paymentIntent.id} canceled")
        }

        override fun onFailure(e: TerminalException) {
            Log.d("CANCEL-PI", "Payment Intent ${paymentIntent.id} failed to cancel: $e")
        }
    }
)
#

I don't see you using this method in your code snippet

delicate pike
#

what's the difference of calling the Cancelable object with the .cancel()?

umbral pivot
#

Please use the exact code we provide.

#

The .cancel with the Cancelable object cancels the operation, not the Payment Intent.

#

So like how collecting card details returns a cancelable object. If you call that cancelable object it cancels the card collection. It does not cancel the Payment Intent

delicate pike
#

ah great, I'll check the flows and get back If I have any issue.
Thanks!

umbral pivot
#

Yeah, now that I read more of the docs I can see how it would be easy to mix those up. But you definitely want to use the Terminal.getInstance().cancelPaymentIntent() function. That will do just what you want.

delicate pike
#

perfect, thanks!

umbral pivot
#

Happy to help ๐Ÿ™‚
It's why we're here