#aequitas_code
1 messages ¡ Page 1 of 1 (latest)
đ 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.
Where do you pass the client_secret parameter?
Btw the code looks like a legacy flow in JS which we strongly discourage today too
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;
}
};```
Okie, in which line of this did you receive "Unknown parameter received: client_secret"?
This is the
The code you shared above, is it ReactNative on your app?
Yes that is correct
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');
}
paymentIntentId: paymentIntent.id,
clientSecret: paymentIntent.client_secret,
});```
Yes
Hmm do you have any log around where you see this screen?
It should be after the fetchPaymentIntent function
I do not