#uristri2_androind-terminal-cancel-pi
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/1475547482837749922
๐ Have more to share? Add more details, code, screenshots, videos, etc. below.
Hello ๐
Do you mean use a method from the Terminal Android SDK to cancel the Payment Intent?
Is there a particular reason for this?
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
Our SDK docs have this method: cancelPaymentIntent https://stripe.dev/stripe-terminal-android/core/com.stripe.stripeterminal/-terminal/cancel-payment-intent.html
That looks like what you are after
I'm using it, no error but in the dashboard I still see Uncaptured instead of cancelled
Do you have an example payment intent I can look at?
pi_3T430mGnytxJlNo91AgBj5II
Hmmm.... there is no record of an attempt to cancel this payment intent
Are you logging the callback status?
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"}}
There is no attempt to cancel this Payment Intent
but I got the log...
Those logs are not from our SDK.
At least not that I can tell. source=PaymentCubit-cancelCardPayment this doesn't exist in our SDK
that's from our side
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
what's the difference of calling the Cancelable object with the .cancel()?
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
ah great, I'll check the flows and get back If I have any issue.
Thanks!
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.
perfect, thanks!
Happy to help ๐
It's why we're here