mirror of
				https://github.com/KevinMidboe/planetposen.git
				synced 2025-10-29 17:50:32 +00:00 
			
		
		
		
	
		
			
				
	
	
		
			23 lines
		
	
	
		
			533 B
		
	
	
	
		
			JavaScript
		
	
	
	
	
	
			
		
		
	
	
			23 lines
		
	
	
		
			533 B
		
	
	
	
		
			JavaScript
		
	
	
	
	
	
| 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
 | |
| }
 |