Files
WrenchStripeNode/controller/cardsController.js
T
CHIEFSOFT\ameye b45348353e Fix data
2024-06-28 20:28:25 -04:00

51 lines
1.5 KiB
JavaScript

import User from "../model/cardModel.js";
// Set your secret key. Remember to switch to your live secret key in production.
// See your keys here: https://dashboard.stripe.com/apikeys
const stripe = require('stripe')('sk_test_4eC39HqLyjWDarjtT1zdp7dc');
export const createCard = async (req,res)=>{
try {
const userData = new User(req.body);
const { email } = userData;
const cardholder = await stripe.issuing.cardholders.create({
name: 'Jenny Rosen',
email: 'jenny.rosen@example.com',
phone_number: '+18008675309',
status: 'active',
type: 'individual',
individual: {
first_name: 'Jenny',
last_name: 'Rosen',
dob: {day: 1, month: 11, year: 1981},
},
billing: {
address: {
line1: '123 Main Street',
city: 'San Francisco',
state: 'CA',
postal_code: '94111',
country: 'US',
},
},
});
res.status(200).json(saveUser);
} catch (error) {
res.status(500).json({error: `Internal Server error 002 ${error} ` });
}
}
export const activateCard = async (req, res)=>{
try{
return res.json("Hello Worlds");
}catch(error){
res.status(500).json({error: "Internal Server error"});
}
}
//C:\WORKS\PROJECTS\WRB\WrenchCore\WrenchStripeNode\controller\cardsController.js