Send optional address to Stripe for better compliance
parent
e46f5a7f4b
commit
83a23d397d
|
@ -11,13 +11,26 @@ router.post('/checkout_action', (req, res, next) => {
|
|||
const config = req.app.config;
|
||||
const stripeConfig = common.getPaymentConfig();
|
||||
|
||||
// charge via stripe
|
||||
stripe.charges.create({
|
||||
// Create the Stripe payload
|
||||
const chargePayload = {
|
||||
amount: numeral(req.session.totalCartAmount).format('0.00').replace('.', ''),
|
||||
currency: stripeConfig.stripeCurrency,
|
||||
currency: stripeConfig.stripeCurrency.toLowerCase(),
|
||||
source: req.body.stripeToken,
|
||||
description: stripeConfig.stripeDescription
|
||||
}, (err, charge) => {
|
||||
description: stripeConfig.stripeDescription,
|
||||
shipping: {
|
||||
name: `${req.body.shipFirstname} ${req.body.shipLastname}`,
|
||||
address: {
|
||||
line1: req.body.shipAddr1,
|
||||
line2: req.body.shipAddr2,
|
||||
postal_code: req.body.shipPostcode,
|
||||
state: req.body.shipState,
|
||||
country: req.body.shipCountry
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
// charge via stripe
|
||||
stripe.charges.create(chargePayload, (err, charge) => {
|
||||
if(err){
|
||||
console.info(err.stack);
|
||||
req.session.messageType = 'danger';
|
||||
|
|
Loading…
Reference in New Issue