node.js - Creating a customer in BrainTree with a credit card -


i'm reading docs creating customer. need create 1 credit card, cvc number error , don't know how must create it.

i show code

if(user.local.subscription == undefined){             //creamos cliente             gateway.customer.create({                 creditcard : {                     number : cardnumber,                     expirationdate : "12/15"                 }             }, function (err, result) {                 if(err){                     //return res.status(500).json({ error : "error creating customer"});                     console.log(err);                 }                 console.log(result);                 /*user.subscription = result;                 userid = result.customer.id;*/              });         } 

var braintree = require("braintree");  var gateway = braintree.connect({   environment: braintree.environment.sandbox,   merchantid: "your sanboxmerchant",   publickey: "your sandbox public key",   privatekey: "sandbox privatekey" });  gateway.customer.create({                 creditcard : {             cardholder_name : 'james bliz',                     number : "4111111111111111",             cvv : '123',                     expirationdate : "12/17"                 }             }, function (err, result) {                 if(err){                     //return res.status(500).json({ error : "error creating customer"});                     console.log(err);                 }                 console.log(result);                 /*user.subscription = result;                 userid = result.customer.id;*/              }); 

the answer should somthing this

{ customer:     { id: '29931379',      merchantid: 'qn5442rvm794nc6q',      firstname: null,      lastname: null,      company: null,      email: null,      phone: null,      fax: null,      website: null,      createdat: '2015-05-12t10:33:41z',      updatedat: '2015-05-12t10:33:42z',      customfields: '',      creditcards: [ [object] ],      addresses: [],      paymentmethods: [ [object] ] },   success: true } 

take required field think need customer id tha result object.


Comments

Popular posts from this blog

android - MPAndroidChart - How to add Annotations or images to the chart -

javascript - Add class to another page attribute using URL id - Jquery -

firefox - Where is 'webgl.osmesalib' parameter? -