#imgroot

1 messages · Page 1 of 1 (latest)

kindred parrotBOT
static delta
#

Hi. Before that success: true log, did you see the client secret outputted?

shrewd pecan
#

yes

#

just decided not to add to the screenshot

static delta
#

It's ok to share, if you are just using Test mode

#

what format does it have?

shrewd pecan
#

client secret: pi_3LsemFK8PMRUef6p0BHx1hkv_secret_Wb70lo5dNZSwJRSF3Xux8RNVo
success: true
message: Payment successful!
initSheet: Object {
"paymentOption": undefined,
}

static delta
#

Okie. So clientSecret has the correct value

#

in your initPaymentSheet you use data.clientSecret instead. Why don't you just use clientSecret which is outputted correctly?

shrewd pecan
#

that was the initial. They both produce the same issue

#

just changed to just clientSecret and no change

static delta
#

Okie. Putting aside the log, did the PaymentSheet show up correctly in your app?

shrewd pecan
#

no it doesnt. it crashes the app with no logs

#

i figured the issue might be from above so comment that section out

static delta
#
    const { error } = await initPaymentSheet({
      paymentIntentClientSecret: clientSecret,
    });
    if (error) {
      console.log(error);
    }
#

Let's see how error looks like

#

oh wait

#

but that is actually your initSheet variable

#

So initPaymentSheet was fine. It comes back without error

#

The crashing could be something else

shrewd pecan
#

exactly, there is no error exactly, its an issue with the "paymentOption": undefined,

#

im just not sure if that is what causes the presentPaymentSheet to crash because its undefined

static delta
#

Not certain I think. It could be something else

shrewd pecan
#

const initSheet = await stripe.initPaymentSheet({ paymentIntentClientSecret: clientSecret }); console.log("initSheet:", initSheet); if (initSheet.error) { console.error(initSheet.error); return Alert.alert(initSheet.error.message); } const presentSheet = await stripe.presentPaymentSheet({ clientSecret: data.clientSecret, }); console.log("presentSheet:", presentSheet); if (presentSheet.error) { console.error(presentSheet.error); return Alert.alert(presentSheet.error.message); }

#

if I just have it like this, there is no error whatsover, it just crashes with no stacktrace

#

console.log("presentSheet:", presentSheet); is never reached, but console.log("initSheet:", initSheet); is.
Which put the problem at presentPaymentSheet

static delta
#

presentPaymentSheet doesn't need the clientSecret

#

Let's try

const { error, paymentOption } = await presentPaymentSheet();
console.log(error);
console.log(paymentOption);
shrewd pecan
#

same console log
client secret: pi_3Lsf4tK8PMRUef6p0pSi4FT3_secret_dPvZMrWwi9VigAtH6zoYYU0pL success: true message: Payment successful! initSheet: Object { "paymentOption": undefined, }

#

and the app still crashes with no error

static delta
#

If you add log before and after that presentPaymentSheet do you see the before log printed and the after log doesn't?

shrewd pecan
#

and the app still crashes with no error

static delta
#

I believe if it crashes it should have error/stack trace somewhere

#

can't you see anything on anywhere?

shrewd pecan
#

unfortunately, I cant see anything. Nothing on either frontend or backend

static delta
shrewd pecan
#

i did try with those on the earlier tries and scaled down to the only required param because of this same issue

static delta
#

okie then. Can you send the full file code at this moment?

shrewd pecan
#

sure

#

is it okay to send to you directly?

static delta
#

Paste here is fine

#

(masked out your publishable key )

#

well although it's publishable, but it's up to you

shrewd pecan
#

sure

static delta
#

Um where is HandlePayment using

#

ah nevermind

shrewd pecan
#

one sec

#

discord kicked me out for some reason... sorry

#

i tried moving it earlier but didnt help

static delta
shrewd pecan
#

sure

#

it might take me a while to get that up and running since I dont have the same file/ screen structure as this. I know there might be others with questions and I will be respectful of that

#

i will dig into this a bit more and ping you when I have some results

static delta
#

Sure. Even if I am not around and the thread is closed, feel free to ask in the channel to re-open the thread. Any of my colleagues should be able to continue assisting you

shrewd pecan
#

thanks @static delta

shrewd pecan
#

@static delta , I am trying to redo a lot of my implementation by leveraging the official stripe example. I am trying to use generate keys using this same implementation: https://github.com/stripe/stripe-react-native/blob/2c0183e672403d89fd5fa8b9d3569335bd774dbe/example/server/index.ts#:~:text=}-,const ephemeralKey %3D await stripe.ephemeralKeys.create(,)%3B,-const paymentIntent %3D

However, I keep gettting an "undefined" for my implementation:
[Unhandled promise rejection: TypeError: undefined is not an object (evaluating 'stripe.ephemeralKeys.create')]

Any ideas why this may be happening?

GitHub

React Native library for Stripe. Contribute to stripe/stripe-react-native development by creating an account on GitHub.

static delta
#

is stripe initialized successfully and did you have customer.id? Sorry if it sounds obvious but the same that you would want to debug server-side steps by steps

#

this is server-side

shrewd pecan
#

I did put dummy dummy id:
const ephemeralKey = await stripe.ephemeralKeys.create( { customer: "1111111111111111" }, { apiVersion: '2022-08-01' } ); console.log("here") console.log(ephemeralKey)

#

and im positive stripe is initialized properly as I am able to complete other actions with that same stripe import

static delta
#

That's strange but do you see any error on your Stripe Account's request log? I think no but just checking