#dludus

1 messages · Page 1 of 1 (latest)

high flareBOT
twilit hull
#

Happy to help, can you tell me more about what is happening?

junior plinth
#

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

twilit hull
#

Interesting. Can you send me your Stripe code for getting the card and calling confirmPayemntIntent?

junior plinth
#

`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

twilit hull
#

@junior plinth Just checking in, do you have the confirmPaymentIntent code?

junior plinth
#

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()
}
}
})
}`

twilit hull
#

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?

junior plinth
#

pi_3O32eK4QXNU7JRrp1kvAPL2m

twilit hull
#

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

junior plinth
#

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

frail pilot
#

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

high flareBOT
junior plinth
#

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

slim dawn
#

HI 👋

I'm stepping in as my colleagues need to go. Give me a minute to catch up.

junior plinth
#

yes that's right

slim dawn
#

And none of the code after object: PaymentIntentCallback is being triggered?

junior plinth
#

correct

slim dawn
#

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?

junior plinth
#

sure

#

Neither logging statements are triggered

slim dawn
#

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?

junior plinth
#

sure. Do you need the entire object?

slim dawn
#

Nope

#

Just the ID would work

junior plinth
#

pi_3O33WM4QXNU7JRrp1By0iKrk

slim dawn
#

Okay, nothing wrong there. It's in a status of requires_payment_method and includes card_present as a payment method type

junior plinth
#

So does that mean there is something wrong with my implementation then? When I print out that intent, the status is REQUIRES_CONFIRMATION

slim dawn
#

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()?

junior plinth
#

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

slim dawn
#

No, that isn't expected.

#

Wait a sec. I'm looking at Beta documentation. Nevermind

junior plinth
#

It's pretty late where I am at. Would I be able to pick this thread back up tomorrow?

slim dawn
#

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.

junior plinth
#

Ok great. Thank you for the help