#hassan-shahzad_code
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/1441059408942465167
š Have more to share? Add more details, code, screenshots, videos, etc. below.
hi there!
I don't really undersand. what are you trying to do, and what is the issue you see?
Hi, i am trying to do stripe subscption through android pos nfc. my code for single payment is working fine. but when i triy this code which is for subscription then it is failing on frontend side even before showing paymentIntent. i would like to know what is wrong with my backend code
what's the error message you see?
this if (!paymentSuccess || confirmedPI == null) {
result.error("PAYMENT_FAILED", "PaymentIntent failed or canceled", null)
return@collectAndConfirmPaymentIntent
}
hi there, taking over for my colleague who had to step away. do you have an ID for the failed Payment Intent? it should look like pi_2134
pi_3SVYMpJinHQ71v5x1Z8leFXu
thanks! it looks like something in your code is cancelling the Payment Intent almost immediately after it's created https://dashboard.stripe.com/acct_1EW3fkJinHQ71v5x/test/logs/req_ENcALnwUswsMvU
ok, u would like to know which part is missing on backend side, we changed our code after this https://github.com/stripe/stripe-terminal-android/issues/651
here we are creating a paymentIntent
got it, so you're following this guide? https://docs.stripe.com/terminal/features/saving-payment-details/save-after-payment?terminal-sdk-platform=android
yes
can you share the part of your code where you're calling collectPaymentMethod()?
private fun processPayment(
clientSecretPI: String?,
result: MethodChannel.Result
) {
val terminal = Terminal.getInstance()
val reader = terminal.connectedReader
if (reader == null) {
result.error("NO_READER", "No connected reader available", null)
return
}
if (clientSecretPI.isNullOrEmpty()) {
result.error("MISSING_ARGS", "clientSecretPI is required", null)
return
}
// Step 1ļøā£: Process the initial one-time payment
terminal.retrievePaymentIntent(clientSecretPI, object : PaymentIntentCallback {
override fun onSuccess(paymentIntent: PaymentIntent) {
collectAndConfirmPaymentIntent(terminal, paymentIntent) { paymentSuccess, confirmedPI ->
if (!paymentSuccess || confirmedPI == null) {
result.error("PAYMENT_FAILED", "PaymentIntent failed or canceled", null)
return@collectAndConfirmPaymentIntent
}
// ā
One-time payment only (no SetupIntent)
val reply = mapOf(
"status" to "Payment Successful",
"transactionId" to confirmedPI.id
)
result.success(reply)
}
}
override fun onFailure(e: TerminalException) {
result.error("PAYMENT_INTENT_RETRIEVE_ERROR", e.message, null)
}
})
}
ok, can you confirm that terminal.retrievePaymentIntent() is retrieving the Payment Intent correctly? I would try adding logs to determine this