#micha-czernek_code
1 messages ยท Page 1 of 1 (latest)
๐ Welcome to your new thread!
โฒ๏ธ We'll be here soon! Typically we respond in a few minutes, but sometimes we might take a bit longer if the server is busy or if you have a particularly tricky question.
โฑ๏ธ We close idle threads, which makes them read-only. Once a thread is closed it won't be reopened, but you can always start a new thread if you have another question.
๐ This thread will always be available, even after it's closed. You can find it again using Discord's search, or you can save this link: https://discord.com/channels/841573134531821608/1435742729584906420
๐ Have more to share? Add more details, code, screenshots, videos, etc. below.
Below are links to other discussions we've had with you in the past week in case you want to review that information. If your question is related to one of these previous discussions, please provide a comprehensive summary of the current state and what you need help with now. We help many users simultaneously, so a summary allows us to resolve your issue as soon as possible.
- micha-czernek_docs, 5 hours ago, 17 messages
That is pretty much it:
const { error: initializeError } = await CustomerSheet.initialize({
setupIntentClientSecret: data.clientSecret,
customerEphemeralKeySecret: data.customerEphemeralKey,
customerId: data.customerId,
applePayEnabled: false,
style: "alwaysDark",
returnURL: "stacked-expo://return",
});
const { error, paymentOption, paymentMethod } = await CustomerSheet.present();
What version of the SDK are you using?
0.55.1
If it helps, here's backend code (in golang) that returns customerId, clientSecret and ephemeralKey
si, err := setupintent.New(&stripe.SetupIntentParams{
Customer: stripe.String(user.StripeCustomerId.String),
Usage: stripe.String(stripe.SetupIntentUsageOffSession),
Metadata: map[string]string{
"user_id": authedUserId,
},
})
if err != nil {
stackedErrors.Log.WithError(err).Error("Error creating setup intent.")
return nil, status.Error(codes.Internal, "Error creating setup intent.")
}
key, err := ephemeralkey.New(&stripe.EphemeralKeyParams{
Customer: stripe.String(user.StripeCustomerId.String),
StripeVersion: stripe.String("2020-08-27"),
})
if err != nil {
stackedErrors.Log.WithError(err).Error("Error creating ephemeral key.")
return nil, status.Error(codes.Internal, "Error creating ephemeral key.")
}
return &creatorService.SetupIntent{
SetupIntentId: si.ID,
ClientSecret: si.ClientSecret,
CustomerId: user.StripeCustomerId.String,
CustomerEphemeralKey: key.Secret,
}, nil
chiming here, we are using the go stripe sdk version v82.5.0
Example one is: seti_1SQEEX0KyUBzf7jJ7NKSxNQ5
Hmm I'm not seeing anything noteworthy ๐ค
Overall this is the legacy way of integrating CustomerSheet (see: https://docs.stripe.com/elements/customer-sheet?platform=react-native&locale=en-GB#react-native-configure-wallet-element for the updated way) but it should still work afaik
For testing purposes can you try using:
const {error} = await CustomerSheet.initialize({
// You must provide intentConfiguration and clientSecretProvider
intentConfiguration: {
paymentMethodTypes: ['card'],
},
clientSecretProvider: clientSecretProvider,
headerTextForSelectionScreen: 'Manage your payment method',
returnURL: 'my-return-url://',
});
The problem is that, although it is in documentation, it doesn't exist in react native's SDK code
Uhh you mean you don't even see the component in the SDK?
I've actually raised another issue in here that describes discrepancy between code and docs: #dev-help message
I see the component, but only with initialisation method that corresponds with what I implemented
Not with what you sent
Take a look here: https://github.com/stripe/stripe-react-native/blob/8aca5f2b078546e7431472c56c83a0677d9f1a1e/src/components/CustomerSheet.tsx#L28
Ah yeah the docs are now showing the CustomerSessionInitParams: https://github.com/stripe/stripe-react-native/blob/8aca5f2b078546e7431472c56c83a0677d9f1a1e/src/types/CustomerSheet.ts#L70
But the CustomerAdapterInitParams which you are using are also supported: https://github.com/stripe/stripe-react-native/blob/8aca5f2b078546e7431472c56c83a0677d9f1a1e/src/types/CustomerSheet.ts#L51C6-L51C31
Can you double check your API keys and ensure you are using the right correspond secret + publishable key?
I am confident they are right, I tried changing them deliberately and ended up with different errors
Okay let's try just initializing with customerId and the customerEphemeralKeySecret
Comment out the other parameters
The same output
Okay I'm spinning up my sample to test, give me a minute
types/CustomerSheet.ts from mastyer vastly differs from the one released in 0.55.1
I think documentation describes what is about to be released
And those changes landed on master literally 3 hours ago, so after I posted my previous issue ๐
I thought I am losing my senses (which would make sense since its almost midnight here :P)
Yep okay those changes are for the next release. So yeah your code should be fine as far as I know. Can you show me your StripeProvider component?
This is somewhere high in hierarchy:
<StripeProvider publishableKey={Constants?.expoConfig?.extra?.stripePublishableKey}>
I am logging publishable key and it seems fine, can I send it to you?
Yeah you can, it is safe to share
pk_test_51O123456789012345678901234567890
Hmm that is not the publishable key I am seeing associated with the account for the SetupIntent that you shared
In fact when I search internally that string doesn't seem to be a key at all...
Wait, what? ๐ I'll check with our admins
Yeah I think that's the right next step here.