mirror of
https://github.com/KevinMidboe/planetposen.git
synced 2025-12-08 20:38:56 +00:00
Implemented payments with stripe.
This commit is contained in:
22
server/controllers/stripe.js
Normal file
22
server/controllers/stripe.js
Normal 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
|
||||
}
|
||||
Reference in New Issue
Block a user