#nicoyamx_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/1400396730452803704
๐ Have more to share? Add more details, code, screenshots, videos, etc. below.
Below are links to other discussions we've had with you in the past week in case you want to review that information. If your question is related to one of these previous discussions, please provide a comprehensive summary of the current state and what you need help with now. We help many users simultaneously, so a summary allows us to resolve your issue as soon as possible.
- nicoyamx_error, 2 days ago, 28 messages
๐ happy to help
unfortunately your issue is not related to your integration
these declines can happen because the issuing bank refuses payment and your customers should contact their bank to sort this out. These cards can also be disabled for international payment. For more info please contact https://support.stripe.com/?contact=true
Find help and support for Stripe. Our support site provides answers on all types of situations, including account information, charges and refunds, and subscriptions information. Get your questions answered and find international support for Stripe.
I've tried to speak with the support about it. Can you please comfirm if my integration is ok:
import Stripe from "stripe";
export default async function handler(req, res) {
if (req.method !== "POST") {
res.setHeader("Allow", ["POST"]);
return res.status(405).json({ error: Method ${req.method} not allowed });
}
const { amount, currency, checkoutId, pspId } = req.body;
try {
if (!pspId) {
return res.status(400).json({ error: "Missing pspId in request" });
}
const API_URL = process.env.NEXT_PUBLIC_API_URL;
const API_KEY = process.env.NEXT_PUBLIC_API_KEY;
// ๐ข Get the correct PSP using pspId instead of top-daily
const pspResponse = await fetch(`${API_URL}/psp/${pspId}`, {
method: "GET",
headers: {
"Content-Type": "application/json",
"x-api-key": API_KEY,
},
});
if (!pspResponse.ok) {
throw new Error(`Failed to fetch PSP: ${pspResponse.status} - ${pspResponse.statusText}`);
}
const pspData = await pspResponse.json();
const { publicKey, secretKey, id } = pspData;
// โ
Init Stripe with correct PSP secretKey
const stripe = new Stripe(secretKey);
// โ
Create the PaymentIntent
const paymentIntent = await stripe.paymentIntents.create({
amount: Math.round(amount),
currency: currency.toLowerCase(),
payment_method_types: ['card'],
payment_method_options: {
card: {
request_three_d_secure: 'challenge'
}
}
});
res.status(200).json({
clientSecret: paymentIntent.client_secret,
paymentIntentId: paymentIntent.id,
pspId: id,
meta: pspData.meta
});
} catch (error) {
console.error("Error creating payment intent:", error.message);
res.status(500).json({ error: "Failed to create payment intent" });
}
}
It is a 3DS issue? I've enabled it on radar
hi! I'm taking over this thread.
can you share a specific PaymentIntent ID (pi_xxx) with this issue?
Sure
cus_SlLrnX9BvgTWlD
or this one: pm_1RpovmLfO8dSZu6B7kow6Zwm
pi_3RpooeLfO8dSZu6B3Zo1FaDS
pi_3Rpog2LfO8dSZu6B1OxGVdoG
We are building a checkout for our customers all of them are having issues with their payment only 30ish% of their customer are able to pay
Looking at pi_3RpooeLfO8dSZu6B3Zo1FaDS
- you created the PaymentIntent, so its status was
requires_payment_methodas expected - then... nothing happened. you didn't collect a payment mehtod and try to confirm the PaymentIntent
so as expected, you didn't collect any payment for that PaymentIntent
so it's a code issue?
the code you have is correct. it's just missing a big part: collecting the payment method from the customer.
I recommend reading this guide in details that explains everything: https://docs.stripe.com/payments/accept-a-payment?platform=web&ui=elements
But how come some end customer payment method is saved then?
using the same code
Seems like it work sometimes
30% of the traffic works fine
Im wondering if their bank has issues accepting the payment
but that's so many customers
the classic payment flow is like this:
- you create the PaymentIntent on the backend
- then you mount the Payment Element on the frontent with the client secret
- the user enters their payment details, then you confirm the PaymentIntent
on the PaymentIntent you shared, I only see step 1. which can happen if the user simply decide to not complete the payment flow
Im wondering if their bank has issues accepting the payment
that can happen yes, but not in the 2 examples you shared.