#yogenp

1 messages ยท Page 1 of 1 (latest)

flat havenBOT
quick bloom
#

I guess that error is shown when you press pay? Can you add some logging into your Android call around the Payment Sheet method as there is likely errors thrown

sacred island
#

Yes, @quick bloom I get this error after pressing Pay. I've added logging until I call CreateIntentResult.Success(response.clientSecret) and everything looks good until then. Let me know if I could add any logging after this statement.

quick bloom
#

If your backend successfully creating the Payment Intent?

#

Do you have a catch block to handle scenarios where the create intent callback fails?

try {
          val response = myNetworkClient.createIntent(
          )
          CreateIntentResult.Success(response.clientSecret)
        } catch (e: Exception) {
          CreateIntentResult.Failure(...)
        }
#

I expect there to be something in that catch block

sacred island
#

Yes, I have wrapped everything in a try catch and there's nothing in the catch block either.

quick bloom
#

And your backend code is definitely creating and returning a Payment Intent?

sacred island
#
try {
    ---
    if (result.isSuccess()) {
        LoPayLogger.i("Received payment Intent: ${result.extractData().clientSecret}")
        CreateIntentResult.Success(result.extractData().clientSecret)
    } else {
        CreateIntentResult.Failure(NullPointerException(""), "")
    }
} catch (e: Exception) {
    LoPayLogger.e("Failure: ${e.message}")
    CreateIntentResult.Failure(e, e.message)
}
#

Yes, I can share the Payment intent with you in a DM if that helps.

quick bloom
#

No need for a DM. But you're going to need to share more of your code really

#

Are you sure that that code is even beign triggered? You need to add logging to figure our which code is problematic

sacred island
#

Yes, I'm sure it' being triggered as I'm seeing the network call to my backend in the Logcat and the logging statement LoPayLogger.i("Received payment Intent: ${result.extractData().clientSecret}") is also being triggered every time.
I'm happy to add more logging wherever you recommend.

#

This is the full code btw

paymentSheet = PaymentSheet(
    activity = activity,
    createIntentCallback = { paymentMethod, _ ->
        try {
            stripePaymentMethodId = paymentMethod.id
            val requestBody = requestBodyUtils.getRequestBodyFromDataClass(hardwareOrderModel)

            val result = terminalsRepository.orderHardware(requestBody)

            if (result.isSuccess()) {
                LoPayLogger.e("Received payment Intent: ${result.extractData().clientSecret}")
                CreateIntentResult.Success(result.extractData().clientSecret)
            } else {
                val error = result.extractError().toString()
                CreateIntentResult.Failure(CustomException(error), "Error: error")
            }
        } catch (e: Exception) {
            LoPayLogger.e("Failure: ${e.message}")
            CreateIntentResult.Failure(e, e.message)
        }
    },
    paymentResultCallback = ::onPaymentSheetResult
)

eternal raft
#

๐Ÿ‘‹ taking over for my colleague. Let me catch up.

sacred island
#

Sure, thanks.

eternal raft
#

would you mind sharing a request ID?

sacred island
#

On it

#

req_hB7vaN36g08yUk is the one for creating a Payment Intent and after that, I can see a GET request to the created Payment Intent at req_EvYuunIVyqVFKF

eternal raft
#

I'm looking into this, will be with you shortly

sacred island
#

Thanks @eternal raft

eternal raft
#

@sacred island this is taking more than I was hoping, would you mind writing to us to https://support.stripe.com/contact/email?topic=api_integration and add all the details necessary (version of Android you're working on, target version, etc...) and code snippets backend/mobile and the request IDs so we could try to build and reproduce this issue?

#

and this way we can stay in touch asynchronously

sacred island
#

Sure, on it. Is there an alternative I could try while you look into it?

eternal raft
#

I'm a bit curious to see whether this is related to the deferred flow in particular

sacred island
#

I'll give it a go and post an update here.

Just some additional contextual information:
When I use the Card Element only, everything works fine. We're implementing some new changes wherein we need to store the paymentMethodId for future purposes. That's when I started looking into this and received the discussed error.
I managed to implement this successfully for Google Pay using stripe?.confirmPayment(activity, confirmParams). And now I'm stuck for Cards.

eternal raft
#

could we try something for now

#

can you leave your mobile code as is

#

and just remove setup_future_usage from your backend call when creating the PI?

sacred island
#

On it.

flat havenBOT
eternal raft
#

please ping me when you're back

sacred island
#

Yep, my backend team is just making that change. I'll share results here as soon as I have them.

eternal raft
#

๐Ÿ‘

sacred island
#

Btw, while they're doing it, I implemented the "Accept a payment" flow and worked fine.

eternal raft
#

with setup_future_usage?

sacred island
#

Yes, as we have now. I'll be able to share the results without setup_future_usage very shortly.

eternal raft
#

would you mind sharing the request ID or the PI ID that succeeded?

#

I'm a bit confused on why there's a Payment Method in this request req_hB7vaN36g08yUk

sacred island
#

That's what we're implementing, storing paymentMethod and using it in the future for other purposes. Should it not be there?

eternal raft
#

Should it not be there?
not while creating the PI

#

you need to create the PI

#

and the PaymentSheet will take care of adding the PM when confirming

sacred island
#

Very interesting, someone needs to answer some questions it seems then ๐Ÿ˜
Give me a min, and I'll get back to you.

Btw, this is PI that succeeded: req_keB38WWz6de9MM ("Accept a payment") with setup_future_usage

#

@eternal raft Removing setup_future_usage works like a treat(still sending the paymentMethod though). I'm having a chat with my backend team about paymentMethod and potentially removing it.

eternal raft
#

@sacred island once you have all the results please contact https://support.stripe.com/contact/email?topic=api_integration and give us all the necessary information so we could try to reproduce and understand exactly what's happening

sacred island
#

Will do, thanks for the help.