#harshiliroid_api

1 messages ¡ Page 1 of 1 (latest)

tight pierBOT
#

👋 Welcome to your new thread!

⏲️ We'll be here soon! We typically respond in a few minutes, but in some cases we might need a bit more time (e.g., server's busy, you've got a complex question, etc.).

⏱️ We close idle threads, which makes them read-only. Once a thread is closed it won't be reopened, but you can 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/1248626218555805876

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

rocky pendant
#

Sorry I don't understand the question

#

That request id you provided is just a customer creation request

rough lynx
#

wait a minute i will explain you in brief

#

currently i am creating stripe payment testing api's for learning in this potion of time customer payment is sended but every time status is requires_action. managing status sending in server side so why status is not succeeded and and front end i using ejs.

attach code for batter understanding :

rocky pendant
#

Can you share the request id where this is happening

rough lynx
#

server side api :
router.post("/chackout", async (req, res) => {
const { email, name, amount, token, PaymentMethodId } = req.body
try {
const customer = await stripe.customers.create({
email: email || 'testUser@gmail.com',
name: name || "123"
})

    await stripe.paymentMethods.attach(PaymentMethodId, {
        customer: customer.id,
    });

    await stripe.customers.update(customer.id, {
        invoice_settings: {
            default_payment_method: PaymentMethodId,
        },
    });
    console.log(customer.id);
    console.log(PaymentMethodId);
    const payment = await stripe.paymentIntents.create({
        payment_method_types: ['card'],
        amount: 200,
        currency: 'usd',
        description: 'Example charge',
        customer: customer.id,
        payment_method: PaymentMethodId,
        confirm: true,
        description:"testing",
       
    })
    const intenteId = payment.id
    console.log(intenteId);
    const paymentIntent = await stripe.paymentIntents.retrieve(intenteId);
    console.log(payment);
    // if (error) {
    //     console.log(error);
    // }
    // else{
    //     console.log(paymentIntent);
    // }

    // console.log(stripe.charges);
    // console.log(payment);
    console.log({ client_secret: payment.client_secret });
    return res.json({ client_secret: payment.client_secret })

} catch (error) {
    res.send(error.message)
    console.log(error);
}

})

rough lynx
rocky pendant
#

Is there a guide you're following?

#

This flow isn't very common

#

Generally we recommend confirming payment intent client side

#

So that customer can handle any required actions like 3ds

#

(i bet that's what's happening here)

#

But I need to see the payment intent creation/confirmation's request id

rough lynx
#

yes sure
id: "req_DXiV1IdA71ay0Q"

rocky pendant
#

Is there a guide you're following?

#

Yeah this is exactly what I thought

#

Payment required 3ds, which is extremely common

#

Is there a particular reason you need to finalize payment on the server? If not, I don't recommend you do this

#

@rough lynx

#

@rough lynx this is your thread

#

Keep messages in here

#

You keep messaging in somebody else's thread

#

No

#

I help run this server

#

You're the one who keeps messaging in the wrong thread

#

@rough lynx are you there?

rough lynx
#

Can I share my project with your help?

rocky pendant
#

I don't need to see your project

#

I already see your code above

#

My question is the same

#

Is there a particular reason you need to finalize payment on the server? If not, I don't recommend you do this

rough lynx
#

no

rocky pendant
#

Ok