#imgroot
1 messages · Page 1 of 1 (latest)
Hi. Before that success: true log, did you see the client secret outputted?
client secret: pi_3LsemFK8PMRUef6p0BHx1hkv_secret_Wb70lo5dNZSwJRSF3Xux8RNVo
success: true
message: Payment successful!
initSheet: Object {
"paymentOption": undefined,
}
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?
that was the initial. They both produce the same issue
just changed to just clientSecret and no change
Okie. Putting aside the log, did the PaymentSheet show up correctly in your app?
no it doesnt. it crashes the app with no logs
i figured the issue might be from above so comment that section out
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
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
Not certain I think. It could be something else
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
presentPaymentSheet doesn't need the clientSecret
Let's try
const { error, paymentOption } = await presentPaymentSheet();
console.log(error);
console.log(paymentOption);
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
If you add log before and after that presentPaymentSheet do you see the before log printed and the after log doesn't?
I believe if it crashes it should have error/stack trace somewhere
can't you see anything on anywhere?
unfortunately, I cant see anything. Nothing on either frontend or backend
Okie. It sounds super weird. But can you try also using customer and ephemeralKey as our official Doc suggested? https://stripe.com/docs/payments/accept-a-payment?platform=react-native&ui=payment-sheet#react-native-collect-payment-details
i did try with those on the earlier tries and scaled down to the only required param because of this same issue
okie then. Can you send the full file code at this moment?
Paste here is fine
(masked out your publishable key )
well although it's publishable, but it's up to you
Um where is HandlePayment using
ah nevermind
Could you try moving the logic of getting clientSecret and initialize PaymentSheet a bit earlier like this https://github.com/stripe/stripe-react-native/blob/2c0183e672403d89fd5fa8b9d3569335bd774dbe/example/src/screens/PaymentsUICompleteScreen.tsx#L114?
one sec
discord kicked me out for some reason... sorry
i tried moving it earlier but didnt help
I am running out of idea.. Could you try the example screen here and just replace the URL with your backend? https://github.com/stripe/stripe-react-native/blob/2c0183e672403d89fd5fa8b9d3569335bd774dbe/example/src/screens/PaymentsUICompleteScreen.tsx
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
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
thanks @static delta
@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?
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
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
That's strange but do you see any error on your Stripe Account's request log? I think no but just checking