#dludus
1 messages · Page 1 of 1 (latest)
Happy to help, can you tell me more about what is happening?
I have a payment flow set up on our Android application. Everything works expectedly from getting the payment intent down to collecting the payment method. After succesfully collecting the payment method, I call confirmPaymentIntent(), but the call back for that never gets called. If I attempt to swipe the test card on the reader again, it does, however, get called that time, but with an error of You cannot provide a new payment method to a PaymentIntent when it has a status of requires_capture. We are using bluetooth M2 readers
Another dev on my team was experiencing the same issue, until a little bit ago where the callback started triggering
Interesting. Can you send me your Stripe code for getting the card and calling confirmPayemntIntent?
`val collectConfig = CollectConfiguration.Builder()
.updatePaymentIntent(false)
.skipTipping(false)
.build()
// stopCheckingForPaymentIntent()
Terminal.getInstance().collectPaymentMethod(intent,
object : PaymentIntentCallback {
override fun onFailure(e: TerminalException) {
// stopCheckingForPaymentIntent()
// Log.i("collect_payment_method", "error collecting payment method: $e")
// _state.value = _state.value.copy(allowUserPaymentCancel = false)
// resetRetryTimer()
}
override fun onSuccess(paymentIntent: PaymentIntent) {
// stopCheckingForPaymentIntent()
// _state.value = _state.value.copy(paymentState = PaymentState.PROCESSING)
confirmPaymentIntent(paymentIntent)
}
})`
here is where I am calling collectPaymentMethod(). I call confirmPaymentIntent() in the success callback
` private fun confirmPaymentIntent(intent: PaymentIntent) {
Terminal.getInstance().confirmPaymentIntent(intent,
object : PaymentIntentCallback {
override fun onFailure(e: TerminalException) {
Log.i("confirm", "failure")
// _state.value = _state.value.copy(paymentState = PaymentState.PAYMENT_FAILED, allowUserPaymentCancel = false)
// resetRetryTimer()
}
override fun onSuccess(paymentIntent: PaymentIntent) {
Log.i("confirm", "success")
if (paymentIntent.status == PaymentIntentStatus.SUCCEEDED || paymentIntent.status == PaymentIntentStatus.REQUIRES_CAPTURE) {
if (paymentIntent.status == PaymentIntentStatus.REQUIRES_CAPTURE) {
// Log.i("confirm", "requires capture")
resetPaymentCapturedTimer()
} else {
// Log.i("confirm", "failed to confirm payment intent")
// _state.value = _state.value.copy(allowUserPaymentCancel = false, paymentState = PaymentState.PAYMENT_FAILED)
// resetRetryTimer()
}
} else {
Log.i("confirm", "unexpected intent status")
_state.value = _state.value.copy(paymentState = PaymentState.PAYMENT_FAILED, allowUserPaymentCancel = false)
resetRetryTimer()
}
}
})
}And here is theconfirmPaymentIntent()` method
@junior plinth Just checking in, do you have the confirmPaymentIntent code?
Yes it is that second block of code. Sorry it's not formatted well. I'll send it again.
` private fun confirmPaymentIntent(intent: PaymentIntent) {
Terminal.getInstance().confirmPaymentIntent(intent,
object : PaymentIntentCallback {
override fun onFailure(e: TerminalException) {
Log.i("confirm", "failure")
// _state.value = _state.value.copy(paymentState = PaymentState.PAYMENT_FAILED, allowUserPaymentCancel = false)
// resetRetryTimer()
}
override fun onSuccess(paymentIntent: PaymentIntent) {
Log.i("confirm", "success")
if (paymentIntent.status == PaymentIntentStatus.SUCCEEDED || paymentIntent.status == PaymentIntentStatus.REQUIRES_CAPTURE) {
if (paymentIntent.status == PaymentIntentStatus.REQUIRES_CAPTURE) {
// Log.i("confirm", "requires capture")
resetPaymentCapturedTimer()
} else {
// Log.i("confirm", "failed to confirm payment intent")
// _state.value = _state.value.copy(allowUserPaymentCancel = false, paymentState = PaymentState.PAYMENT_FAILED)
// resetRetryTimer()
}
} else {
Log.i("confirm", "unexpected intent status")
_state.value = _state.value.copy(paymentState = PaymentState.PAYMENT_FAILED, allowUserPaymentCancel = false)
resetRetryTimer()
}
}
})
}`
Still looking in to what this may be. Not seeing anything immediately obvious. One more quick thing, do you have the ID of a PaymentIntent that you tried to confirm like this?
pi_3O32eK4QXNU7JRrp1kvAPL2m
Interestingly, I am not seeing the confirm call in our network logs at all. Do you know if you have been able to make any other Terminal SDK calls that reach out to Stripe? Or is this the only one your app needs/has tried to use?
I am reaching out to my colleagues for help looking in to this and will get back to you with what we can find
Our app uses
retrievePaymentIntent()
collectPaymentMethod()
confirmPaymentMethod()
discoverReaders()
connectBluetoothReader()
disconnectReader()
I am not sure which ones reach out to Stripe, but all of them except confirmPaymentIntent() have been successful
Can you add log/debug statements before and after the confirmPaymentIntent calls? Curious if the call is hanging, isn't reached, or is just immediately returning
I added log statements before calling Terminal.getInstance().confirmPaymentIntent() as well as one after, and they both get called
I'm not sure if it's relevant, but all of this is being called within a coroutine scope. We create the payment intent on our backend, and periodically make network calls to check if there is a payment intent and if so, we show the payment flow
HI 👋
I'm stepping in as my colleagues need to go. Give me a minute to catch up.
Just to confirm, you are attempting to perform this step: https://stripe.com/docs/terminal/payments/collect-payment?terminal-sdk-platform=android#confirm-payment in the payment collection process, correct?
yes that's right
And none of the code after object: PaymentIntentCallback is being triggered?
correct
I know this is extreme but can you try commetning out all of that and just try the folloing code?
Terminal.getInstance().confirmPaymentIntent(paymentIntent, object : PaymentIntentCallback {
override fun onSuccess(paymentIntent: PaymentIntent) {
Log.d("Debugging", "Success")
}
override fun onFailure(exception: TerminalException) {
Log.d("Deubbing", "Failure")
}
})
and see if either logging statement gets triggered?
Okay so we know nothing inside that code block is the problem.
I apologize if you've already done this (it's a long thread) but can you try logging the intent value before you get the getInstance().confirmPaymentIntent() line?
sure. Do you need the entire object?
pi_3O33WM4QXNU7JRrp1By0iKrk
Okay, nothing wrong there. It's in a status of requires_payment_method and includes card_present as a payment method type
So does that mean there is something wrong with my implementation then? When I print out that intent, the status is REQUIRES_CONFIRMATION
Ah, no but since you haven't sent the confirmation request the API doesn't know the Payment Intent has updated (which is what I see).
And just to confirm the prior step, you are able to see the paymentIntent.paymentMethod in the onSuccess callback after you call Terminal.getInstance().collectPaymentMethod()?
yes that's right. I call the confirmPaymentIntent() method inside the onSuccess callback of the collectPaymentMethod()
and I pass that intent from the onSuccess callback
hold on let me check what the value of the paymentMethod is
paymentMethod = null
I'm not sure if that's expected or not
It's pretty late where I am at. Would I be able to pick this thread back up tomorrow?
This thread will get closed due to inactivity (this server gets pretty busy and we can't leave things open). But you can come back to the main channel with a summary of the current state of your question and link to this thread. My colleagues will be happy to help you further.
Ok great. Thank you for the help