Added elements for mobile payments. BOD-90
This commit is contained in:
@@ -44,3 +44,38 @@ exports.payment = async (req, res) => {
|
||||
res.status(400).send(error);
|
||||
}
|
||||
};
|
||||
|
||||
exports.mobile_payment = async (req, res) => {
|
||||
const { amount, stripe_acct_id } = req.body;
|
||||
console.log("exports.payment -> amount", amount);
|
||||
console.log("exports.payment -> stripe_acct_id", stripe_acct_id);
|
||||
try {
|
||||
await stripe.paymentIntents
|
||||
.create(
|
||||
{
|
||||
//Pull the amounts from the payment request.
|
||||
payment_method_types: ["card"],
|
||||
amount: amount,
|
||||
currency: "cad",
|
||||
application_fee_amount: 50,
|
||||
},
|
||||
{
|
||||
stripeAccount: stripe_acct_id,
|
||||
}
|
||||
)
|
||||
.then(function (paymentIntent) {
|
||||
try {
|
||||
return res.send({
|
||||
clientSecret: paymentIntent.client_secret,
|
||||
});
|
||||
} catch (err) {
|
||||
return res.status(500).send({
|
||||
error: err.message,
|
||||
});
|
||||
}
|
||||
});
|
||||
} catch (error) {
|
||||
console.log("error", error);
|
||||
res.status(400).send(error);
|
||||
}
|
||||
};
|
||||
|
||||
Reference in New Issue
Block a user