Node.js 使用信用卡在BrainTree中创建客户

Node.js 使用信用卡在BrainTree中创建客户,node.js,braintree,Node.js,Braintree,我正在阅读有关创建客户的文档。我需要创建一个信用卡,一个cvc号码,但我得到一个错误,我不知道我必须如何创建它 我显示我的代码 if(user.local.subscription == undefined){ //creamos cliente gateway.customer.create({ creditCard : { number : cardnumber,

我正在阅读有关创建客户的文档。我需要创建一个信用卡,一个cvc号码,但我得到一个错误,我不知道我必须如何创建它

我显示我的代码

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;*/

            });
        }
答案应该是这样的

{ 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 }
从中获取必填字段,我认为您只需要结果对象中的客户id

答案应该是这样的

{ 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 }
从中获取必填字段,我认为您只需要结果对象中的客户id

答案应该是这样的

{ 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 }
从中获取必填字段,我认为您只需要结果对象中的客户id

答案应该是这样的

{ 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 }
从中获取必填字段,我认为您只需要结果对象中的客户id