#arya_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/1345041812619923539
đ 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.
https://docs.stripe.com/payments/accept-a-payment-deferred?platform=web&type=subscription
https://docs.stripe.com/payments/accept-a-payment-deferred?platform=web&type=subscription#set-up-stripe
https://docs.stripe.com/payments/payment-intents
These are the docs I am following
Hi, what error are you exactly seeing? When you are you seeing this error? Can you share the request id for when you see this error? Here's how you can find a request ID: https://support.stripe.com/questions/finding-the-id-for-an-api-request
POST /api/payments/create-payment-intent 404 1.557 ms - 174
Getting this
Can you share more please?
const createPaymentIntent = async (req, res) => {
try {
const { amount, currency, customerId, packageId, email } = req.body;
// Validate request data
if (!amount || !currency || !customerId || !packageId || !email) {
return res.status(400).json({ error: "Missing required parameters" });
}
// Check for existing incomplete subscription
const subscriptions = await stripe.subscriptions.list({
customer: customerId,
status: "incomplete",
limit: 1,
});
if (subscriptions.data.length > 0) {
return res
.status(400)
.json({ error: "An incomplete subscription already exists." });
}
// Create a payment intent with 'incomplete' subscription mode
const paymentIntent = await stripe.paymentIntents.create(
{
amount,
currency,
customer: customerId,
description: `Payment for package ID: ${packageId}`,
setup_future_usage: "off_session", // To save the card for future use
automatic_payment_methods: { enabled: true },
metadata: { packageId, email },
},
{
idempotencyKey: `${customerId}_${packageId}`, // Prevents duplicate charges
}
);
res.status(200).json({
success: true,
message: "Client Secret Created",
result: paymentIntent.client_secret,
});
} catch (error) {
console.error("Error creating payment intent:", error.message);
res.status(500).json({ error: error.message });
}
};
This is the code, while I hit the api, it just send 404
Whar errors do you see? Can you share the request id from this attempt? Here's how you can find a request ID: https://support.stripe.com/questions/finding-the-id-for-an-api-request
Please note that I can't audit/review your code for you. If can share the specific request id, I'm happy to assist further
Sorry, I just created word mistakes in write the api path
Ah, so are you unblocked?
Yups, I need more help
Like I am navigated to payment page, now according to https://docs.stripe.com/payments/accept-a-payment-deferred?platform=web&type=subscription , How will I subscribe the client who created successfull transaction
Or it will be self handle if payment is done?
What do you mean by that? Can you reword the ask a bit?
I am confused for the flow, like according to docs, after creating the payment page, It is saying to create customer, however the customer is already created that's why he is able to create payment intent
reference -> https://docs.stripe.com/payments/accept-a-payment-deferred?platform=web&type=subscription point number 5
https://codeshare.io/k0opww
If you are not getting, just say what to do next to submit the payment and let subscribe the user
Ok, if you already created the customer, then you can move on to the next step: http://docs.stripe.com/payments/accept-a-payment-deferred?platform=web&type=subscription
Ok, thanks