#micha-czernek_code

1 messages ยท Page 1 of 1 (latest)

sullen troutBOT
#

๐Ÿ‘‹ 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.

cursive wharf
#

Hello there

#

Can you show me your full code snippet?

sick viper
#

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();
cursive wharf
#

What version of the SDK are you using?

sick viper
#

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
keen carbon
#

chiming here, we are using the go stripe sdk version v82.5.0

cursive wharf
#

Thanks, give me a sec

#

Can you give me a SetupIntent ID that you are testing with?

sick viper
#

Example one is: seti_1SQEEX0KyUBzf7jJ7NKSxNQ5

cursive wharf
#

Hmm I'm not seeing anything noteworthy ๐Ÿค”

#

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://',
});
sick viper
#

The problem is that, although it is in documentation, it doesn't exist in react native's SDK code

sullen troutBOT
cursive wharf
#

Uhh you mean you don't even see the component in the SDK?

sick viper
#

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

cursive wharf
#

Can you double check your API keys and ensure you are using the right correspond secret + publishable key?

sick viper
#

I am confident they are right, I tried changing them deliberately and ended up with different errors

cursive wharf
#

Okay let's try just initializing with customerId and the customerEphemeralKeySecret

#

Comment out the other parameters

sick viper
#

The same output

cursive wharf
#

Okay I'm spinning up my sample to test, give me a minute

sick viper
#

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

cursive wharf
#

Ah

#

That is true that is coming in the next update.

sick viper
#

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)

cursive wharf
#

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?

sick viper
#

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?

cursive wharf
#

Yeah you can, it is safe to share

sick viper
#
pk_test_51O123456789012345678901234567890
cursive wharf
#

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...

sick viper
#

Wait, what? ๐Ÿ˜„ I'll check with our admins

cursive wharf
#

Yeah I think that's the right next step here.

sick viper
#

Thank you so very much, that was it

#

We had issue with our config that picked some random key instead of good one

#

The problem is also that the error message was super misleading

#

But thanks a lot for that