#.strawht

1 messages · Page 1 of 1 (latest)

astral kelpBOT
drifting island
#

Hello

#

Can you summarize the issue here?

green night
#

I'm adding a user payment method using setup intents on iOS via the StripePaymentSheet; however, I'm noticing there's maybe a ~20-30 second delay between adding and fetching valid payment methods for the customer via the customer context (It is returning empty even though I had just added a payment method via setup intent). Are there recommendations you can provide to not have such a great delay?

drifting island
#

Hmm yeah that delay shouldn't exist

#

How are you fetching the PaymentMethod exactly after the SetupIntent is confirmed?

#

Like it should be available immediately after successful confirmation

green night
#

I'm adding a payment via the payment sheet configured with a setup intent

drifting island
#

Huh okay so you call this immediately in your case .completed block?

green night
#

self.paymentSheet?.present(from: self.rootViewController) { [weak self] paymentResult in
switch paymentResult {
case .completed:
self?.store.dispatch(.loggedInAppStatusAction(.hasSuccessfullyAddedPaymentMethod))
self?.progressToNextOnboardingFlow()
break
case .canceled:
break
case .failed(_):

                break
            }
        }

yes, i try to present available payment methods to the user in the following screens

drifting island
green night
#

confirmed, when using the curl, right after adding a card via a setup intent on the iOS Payment sheet, the results are correct

drifting island
#

Thanks for testing

green night
#

the iOS SDK returns invalid output up to 30 seconds

#

as in, it doesn't believe there's a valid payment method

#

and returns an empty list

drifting island
green night
#

yes, the listPaymentMethodsForCustomer is succeeding, but the output is incorrectly an empty list

drifting island
#

So call that then call listPaymentMethodsForCustomer

green night
#

great that resolved the issue

drifting island
#

nice

green night
#

is it recommended to clear the cache post add/removal

#

of payment methods?

drifting island
#

Yeah if you want to list them immediately

green night
#

thank you

#

Another question is , when adding a payment method via the payment sheet, how can it be set as the default payment method?

#

when retrieving via stripe cl:
stripe customers retrieve cus_OjKMhZNHyKYoAp

"invoice_settings": {
"custom_fields"
:
null
,
"default_payment_method"
:
null
,
"footer"
:
null
,
"rendering_options"
:
null
,
"supported_payment_methods"
:
{}
,
}

fierce oyster
#

Hi there 👋 I'll need to double check whether it's possible to have the Payment Sheet update the default payment method for the Customer.

You can make a request to update the Customer object directly, and provide the ID of the newly created Payment Method to the invoice_settings.default_payment_method field.

green night
#

okay, lmk when you can confirm!

fierce oyster
#

Hm, not finding anything so far, one more place to look.

astral kelpBOT