我正在使用braintree进行支付,而我已经做到了。
gateway.customer.create({
firstName: "Sachin",
lastName: "Shah",
company: "Qwerty",
email: "Qwerty@example.com",
phone: "114.555.1234",
fax: "614.555.1234",
website: "www.example.com",
}, function (err, result) {
if (err) {
res.send({code:0, status:'Error', message:err});
}else{
res.send({code:1, status:'Success', data: result});
}
});
我遵循的是官方的doc,他们表明,当req成功时,我会获得令牌,但我会result.customer.paymentMethods[]
回复
{
"code": 1,
"status": "Success",
"data": {
"customer": {
"id": "569549779",
"merchantId": "XXXXXXXXXXXXXXXXX",
"firstName": "Sachin",
"lastName": "Shah",
"company": "Qwerty",
"email": "Qwerty@example.com",
"phone": "114.555.1234",
"fax": "614.555.1234",
"website": "www.example.com",
"createdAt": "2019-10-10T05:13:42Z",
"updatedAt": "2019-10-10T05:13:42Z",
"customFields": "",
"globalId": "XXXXXXXXXXXXXXXXX",
"creditCards": [],
"addresses": [],
"paymentMethods": []
},
"success": true
}
}
预期产量
我需要获得paymentMethodToken
才能进行进一步的API调用。
答案 0 :(得分:1)
全部披露:我在Braintree工作。如果您还有其他疑问,请随时与support联系。
您当前正在创建没有付款方式的客户。您需要create the customer with a payment method来检索paymentMethodToken
。