#Gautam

1 messages · Page 1 of 1 (latest)

feral pewterBOT
wild patio
#

Hi! Let me help you with this.

#

You can create a PaymentIntent with payment_method parameter set.

flint sequoia
#

could you please send me the docs link for this

feral pewterBOT
wild patio
#

Do you have a Payment Method saved for that Customer?

sullen cape
#

👋 taking over for my colleague. Let me know if there's any follow-up Qs I can answer!

flint sequoia
#

we don't have the saved payment method for customer ..
currently , we are creating customer and attaching the subscription .. want to understand how we can do this for one time payment

sullen cape
flint sequoia
#

app.post("/create-payment-intent", async (req, res) => {
const { items } = req.body;

// Create a PaymentIntent with the order amount and currency
const paymentIntent = await stripe.paymentIntents.create({
amount: calculateOrderAmount(items),
currency: "usd",
automatic_payment_methods: {
enabled: true,
},
});

res.send({
clientSecret: paymentIntent.client_secret,
});
});
here we are handling which customer we are going to charge

sullen cape
#

not really, because you're not passing the customer ID to the create PaymentIntent