我不知道该怎么解决这个问题 谁来帮帮我!
< a href=>"https://i.static.net/BfUSIJzu.png" rel="没有跟随 nofollow norereferrer">这里的图像描述
router.post("/create-payment-intent", async (req, res) => {
const { items, user_id } = req.body;
const customer = await stripe.customers.create();
const ephemeralKey = await stripe.ephemeralKeys.create(
{ customer: customer.id },
{ apiVersion: 2024-04-10 }
);
try {
const paymentIntent = await stripe.paymentIntents.create({
amount: 1099,
currency: usd ,
confirm: true,
payment_method: pm_card_visa ,
payment_method_types: [ card ],
});
const response = {
paymentIntent: paymentIntent.client_secret,
ephemeralKey: ephemeralKey.secret,
customer: customer.id,
publishableKey: pk_test_51PA9vlRsfm3Ucs22ixDUZ8mt2Ki9E7WR4tSil67ONZD4dptsAwjVZ0J2IFNEEf0iHQhDNEaTT87f6mTD9dnY1lAW00TQcuO9MO
};
return res.json(response);
} catch (error) {
console.error(error);
return res.status(500).json({ error: An error occurred while creating Payment Intent });
}
});
My coding very very bad, i don t know how to fix that.
I know my code is wrong somewhere in here or missing a lot of things. I can identify what error I am facing but I can t fix it because I am not good at coding and this is my graduation project. I hope someone will help me and code for me to be able to fix the error! Please!
[enter image description here][1]
[enter image description here][2]
[enter image description here][3]
i don t know what happened for my code, i can t fix that
[1]: https://i.sstatic.net/AJlyFGp8.png
[2]: https://i.sstatic.net/itUY8uDj.png
[3]: https://i.sstatic.net/ok7OlRA4.png
[enter code here][1]
[1]: https://i.sstatic.net/3GS7DiJl.png
The server reports that there is a secret_client but the application logs out like that