#xyz_api
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/1377653402137526504
๐ Have more to share? Add more details, code, screenshots, videos, etc. below.
Hey there, let me take a look.
Yes please.. we wanna fix this ASAP
I get payment failed : no such payment intent 'some id' is displayed
Ok, it appears you're attempting to confirm a PaymentIntent (req_9VPX078u04CaKB) that was created in the Sandbox in Live Mode (req_U8IuQBvE13u5aP) which you cannot do.
How can I change that. Can you guide me please
Objects created in the Sandbox are not available to Production and vice versa.
If your intent is to confirm the PaymentIntent that was created in the Sandbox, you'll need to make sure you're using the API keys associated with the Sandbox when sending the API request.
I changed it to production now. Updated the keys with live keys
Do I need to change anything else ?
This is my code
console.log('๐ณ Stripe routes initialized');
stripeRouter.post('/create-payment-intent', validatePaymentData, async (req, res) => {
try {
const { amount } = req.body;
const paymentIntent = await stripe.paymentIntents.create({
amount: Math.round(amount * 20),
currency: 'usd',
automatic_payment_methods: {
enabled: true,
},
});
console.log('โ
Payment intent created:', { id: paymentIntent.id });
res.status(200).json({
clientSecret: paymentIntent.client_secret,
});
} catch (error: any) {
console.error('โ Payment error:', error);
// Handle different Stripe error types
let errorMessage = 'Payment processing failed';
let statusCode = 500;
if (error.type === 'StripeCardError') {
// Card was declined
errorMessage = error.message || 'Your card was declined';
statusCode = 402;
} else if (error.type === 'StripeAuthenticationError') {
// Invalid API keys
errorMessage = 'Payment system configuration error';
statusCode = 500;
} else if (error.type === 'StripeInvalidRequestError') {
// Invalid parameters
errorMessage = 'Invalid payment request';
statusCode = 400;
} else if (error.type === 'StripeRateLimitError') {
// Too many requests made
errorMessage = 'Payment system busy, please try again';
statusCode = 429;
}
res.status(statusCode).json({
error: errorMessage,
code: error.code || 'unknown',
type: error.type || 'unknown'
});
}
});
If you've switched to production and updated to the live keys you should be fine.
You just need to be sure you're no longer trying to interact with anything you've done in the Sandbox like in this case.
I used a working credit card but still it returns the same error. Should we add stripeAccount in the header while passing ?
Is that the probable cause ?
Can you provide the request ID that was returned?
intent ID ?
"request_log_url": "https://dashboard.stripe.com/logs/req_7ZJmaGarSVrvT0?t=1748530471"
Sign in to the Stripe Dashboard to manage business payments and operations in your account. Manage payments and refunds, respond to disputes and more.
Can you let me know the fix ASAP please. We wanna take the site live shortly
This is the same as previous. The PaymentIntent is being created in the Sandbox account (req_DrFbn7DhXVOWwM) and being confirmed in Live Mode (req_7ZJmaGarSVrvT0)