From 6264e9e930409d92fa5b9799708a28c78c8c82b0 Mon Sep 17 00:00:00 2001 From: Ben Guo Date: Fri, 15 Dec 2017 18:11:09 -0500 Subject: [PATCH] clearCachedCustomer in retryLoading --- Stripe/STPPaymentContext.m | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/Stripe/STPPaymentContext.m b/Stripe/STPPaymentContext.m index 53ad35c2e04..c3a8e06196a 100644 --- a/Stripe/STPPaymentContext.m +++ b/Stripe/STPPaymentContext.m @@ -109,6 +109,11 @@ - (instancetype)initWithAPIAdapter:(id)apiAdapter } - (void)retryLoading { + // Clear any cached customer object before refetching + if ([self.apiAdapter isKindOfClass:[STPCustomerContext class]]) { + STPCustomerContext *customerContext = (STPCustomerContext *)self.apiAdapter; + [customerContext clearCachedCustomer]; + } WEAK(self); self.loadingPromise = [[[STPPromise new] onSuccess:^(STPPaymentMethodTuple *tuple) { STRONG(self);