custom amount payments
This commit is contained in:
@@ -40,12 +40,13 @@ DB.getDB.then((DB) => {
|
||||
|
||||
|
||||
router.post("/create-payment-intent", async (req, res) => {
|
||||
const { items } = req.body;
|
||||
console.log("payments", req.body)
|
||||
const userid = req.body.userid;
|
||||
const price = req.body.price || 500;
|
||||
console.log(req.body)
|
||||
|
||||
// Create a PaymentIntent with the order amount and currency
|
||||
const paymentIntent = await stripe.paymentIntents.create({
|
||||
amount: 500,
|
||||
amount: price,
|
||||
currency: "usd",
|
||||
payment_method_types: [
|
||||
"card",
|
||||
@@ -54,7 +55,8 @@ DB.getDB.then((DB) => {
|
||||
|
||||
res.send({
|
||||
clientSecret: paymentIntent.client_secret,
|
||||
email: await DB.getUsernameByIdCache(req.body.userid)
|
||||
email: await DB.getUsernameByIdCache(req.body.userid),
|
||||
price
|
||||
});
|
||||
});
|
||||
|
||||
|
||||
Reference in New Issue
Block a user