Instantiating CustomerSession
restart the initCustomerSession
process instead of just referencing the initialised one
#151
Labels
I'm using
flutter_bloc
for state management and initialiseCustomerSession
inPaymentScreen
'sinitState()
as:then initialise
PaymentBloc
which instantiatePaymentStripeRepository
in which I do all the customer related operations usingCustomerSession
.The problem is that when I call an operation like
retrieveCustomerPaymentMethods
( the first one I do ) I get the errorThe provided key 'ek_test_YW*********************************************************************_******2Cdw' does not have access to account 'cus_Ku8ajLiFEsdnEB' (or that account does not exist). Application access may have been revoked.
I checked and in my Stripe dashboard I have test mode enabled and the customer shows up so that's ok.
The problem I found is that when I instantiate
CustomerSession
as below in thePaymentStripeRepository
I see that my server generates anotherEphemeralKey
and use that to carry on any operation as prints below show:flutter app:
node server prints:
Now this shows that calling
CustomerSession.instance
calls again thecreateCustomerEphemeralKey
fromCustomerSession.initCustomerSession
inPaymentScreen
'sinitState
as the print I setup there only show up twice.Why is instantiating
CustomerSession
restart theinitCustomerSession
process instead of just referencing the initialised one??Many thanks
This is the repo:
The text was updated successfully, but these errors were encountered: