Open kefahB opened 2 years ago
Thanks I'll check it out soon 😄
Hi @triniwiz
This issue still on android even with the latest change to add shouldPrefetchEphemeralKey = false
to com.stripe.android.CustomerSession.initCustomerSession(StripeStandardCustomerSession.context, createKeyProvider(), shouldPrefetchEphemeralKey);
with this change it make 3 calls instead of 4!! and now I did a quick look to the SDK and it seems that we can reduce the number to 2 calls by setShouldPrefetchCustomer(false)
to this line.
Now why still did 2 call I don't know but it is most likely from the Stripe SDK! I did explain this in new issue at the repo of Stripe android SDK
The problem is with all those call isReadyToCharge
most of the time it return false, we should return backward and try again!!
Now setShouldPrefetchCustomer(false)
does not request the auto filling the card info, the user should click show payment method to select the card!
@triniwiz,
I was wondering if we can change StripeStandardCustomerSession to private and call it internally directly from here.
This issue come mainly from the 'createKeyProvider` because it is asynchrone, all the initialisations begin before the return of the ephemeral object .. but not only, we should ensure a synchronous calls on the initialisations.
Hi @triniwiz @NathanWalker
Sorry for reporting 3 separated issues but I discover then as i go!
I've seen 4 call to get the Ephemeral key! the problem come from
com.stripe.android.CustomerSession.initCustomerSession
that accept a 3rd attribute to avoid sending other request whenPaymentSession
is initialized. see hereWe can expose an attribute at the constructor as below but strangely enough setting shouldPrefetchCustomer to false this does prevent the prefetech call but doesn't resolve the problem !! I'll investigate that more, I yhink the problem come from the
PaymentSession
!Also
Application.android.context
is deprecated forUtils.android.getApplicationContext()