Implemented payments with stripe.

This commit is contained in:
2020-07-21 12:56:16 +02:00
parent 5757d4ba90
commit f57b3295bb
6 changed files with 209 additions and 1 deletions

View File

@@ -0,0 +1,22 @@
const config = require('../config')
const Stripe = require('stripe')
const stripe = Stripe(config.stripe.secretKey)
const createPaymentIntent = async (req, res) => {
const { items, currency } = req.body;
const paymentIntent = await stripe.paymentIntents.create({
amount: 1009,
currency: 'NOK'
})
console.log('created payment intent:', paymentIntent);
return res.send({
publishableKey: config.stripe.publicKey,
clientSecret: paymentIntent.client_secret
})
}
module.exports = {
createPaymentIntent
}