#jhonny_reactnative-error

1 messages ¡ Page 1 of 1 (latest)

lethal isleBOT
#

👋 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/1229494501203120262

📝 Have more to share? Add more details, code, screenshots, videos, etc. below.

dreamy zephyrBOT
echo prawn
#

Hey @red quail ! I'm happy to help bur I'm going to need a lot more details: exact doc you're using, exact version of the SDK, what part is and isn't working, what you see exactly in your logs, etc.

red quail
#

ok!

#

code:

if (establishmentId) {
      try {
        const response = await createOrder({
          appointmentsId: Array.isArray(appointmentsId)
            ? appointmentsId.map((appointmentId) => ({ id: appointmentId }))
            : [{ id: appointmentsId }],
          paymentType: paymentInfo.payMethod,
          couponId: couponId ?? undefined,
          installments: paymentInfo.installments,
          establishmentId,
        });

        const { customer, ephemeralKey, paymentIntent } = await createPayment({
          amountInCents: response.order.totalInCents,
          currency: 'BRL',
          orderId: response.order.id.toString(),
          paymentGatewayCustomerId: user.customerId,
          paymentMethod: 'card',
        });

        await initPaymentSheet({
          merchantDisplayName: 'Example, Inc.',
          customerId: customer,
          customerEphemeralKeySecret: ephemeralKey,
          paymentIntentClientSecret: paymentIntent,
          allowsDelayedPaymentMethods: true,
        });

        await new Promise((resolve) => setTimeout(resolve, 2500));

        await presentPaymentSheet();
.....
#

no logs appear

echo prawn
#

Okay so the first step is to add clear logs everywhere here. Right now you don't really know which part is or isn't working right? Like does createOrder work? does createPayment work? Please add clear logs before/after all of those calls

red quail
#

yeah, I've added some logs

#

let me show ya

#
        console.log('hello 1');

        await new Promise((resolve) => setTimeout(resolve, 2500));
        console.log('hello 2');
        await presentPaymentSheet();
        console.log('hello 3');

stops at hello 2

echo prawn
#

I mean that's just a few hello. What about everything else? What are the exact value(s) passed to every method, and the exact response. I think that's important to log all of that too. Our docs have a clear error handling example for initPaymentSheet that you aren't doing

#

jhonny_reactnative-error

red quail
#

oh ok

#

oh, could it be the paymentIntentClientSecret?

echo prawn
#

yep that's one possibility

#

also careful this has sensitive data, don't just dump it here

red quail
#

oh ok

#

didnt notice

#

thanks for warning

echo prawn
#

but the fact that the PI's client secret is undefined is likely part of the issue