#aequitas_code

1 messages ¡ Page 1 of 1 (latest)

final vaultBOT
#

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

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

wide sapphire
#

The error is shown inside the payment sheet when I attempt to place an order

#

.

wispy raven
#

Where do you pass the client_secret parameter?

#

Btw the code looks like a legacy flow in JS which we strongly discourage today too

wide sapphire
#
        if (!routine.cost) {
            Alert.alert('Error', 'Routine cost is missing.');
            return null;
        }

        console.log('Fetching PaymentIntent with:', {
            url: `${DATABASE_URL}/createPaymentIntent`,
            token: authData.token,
            body: { amount: Math.round(routine.cost * 100), currency: 'usd' },
        });

        try {
            const response = await fetch(`${DATABASE_URL}/createPaymentIntent`, {
                method: 'POST',
                headers: {
                    'Content-Type': 'application/json',
                    Authorization: `Bearer ${authData.token}`,
                },
                body: JSON.stringify({
                    amount: Math.round(routine.cost * 100),
                    currency: 'usd',
                }),
            });

            const responseText = await response.text();
            console.log('Raw response status:', response.status);
            console.log('Raw response body:', responseText);

            if (!response.ok) {
                throw new Error(`Server error: ${response.status} - ${responseText}`);
            }

            const data = JSON.parse(responseText);
            if (!data.paymentIntentId || !data.clientSecret) {
                throw new Error('Missing paymentIntentId or clientSecret in response');
            }

            setPaymentIntentData({ paymentIntentId: data.paymentIntentId, clientSecret: data.clientSecret });
            setIsOpen(true);
            return data;
        } catch (err) {
            Alert.alert('Error', 'Failed to initialize payment. Please try again.');
            console.error('Payment intent error:', err);
            return null;
        }
    };```
wispy raven
#

Okie, in which line of this did you receive "Unknown parameter received: client_secret"?

wide sapphire
#

This is the

wispy raven
#

The code you shared above, is it ReactNative on your app?

wide sapphire
#

Yes that is correct

wispy raven
#

Ok, how is this data looks like?

const data = JSON.parse(responseText);
if (!data.paymentIntentId || !data.clientSecret) {
    throw new Error('Missing paymentIntentId or clientSecret in response');
}

wide sapphire
#
        paymentIntentId: paymentIntent.id,
        clientSecret: paymentIntent.client_secret,
      });```
wispy raven
#

In frontend, did fetchPaymentIntent succeed?

#

Your whole function

wide sapphire
#

Yes

wispy raven
#

Hmm do you have any log around where you see this screen?

#

It should be after the fetchPaymentIntent function

wide sapphire
#

I do not

wispy raven
#

You would want to put debug log to the logic after fetchPaymentIntent finished, to see where does it give you this error

#

Looks like a JSON parsing error