我正在使用 Drop-in 功能在沙盒模式下试用 Braintree。我正在使用现有的customerID
. 但是当我transaction.sale
用这个customerId
和选项打电话时,storeInVault = true
它给出了以下错误:
销售客户 ID 已被占用。
根据文档,它应该使用付款随机数更新客户。
这是代码:
gateway.transaction.sale({
amount: '10.00',
paymentMethodNonce: nonceFromTheClient, // Generated nonce passed from client
customer: {
id: 232057823, //this customer exist in the vault
email : user.emails[0].address
},
options: {
submitForSettlement: true,
storeInVault: true
//storeInVaultOnSuccess: true
}
}, function (err, result) {
if (err) {
console.log(err);
} else {
if (result.success) {
return result.success;
} else {
console.log('ERR Sale '+result.message);
return result.success;
}
}
});
我正在将 Meteor 与包一起使用patrickml:braintree
。
您希望使用Braintree 交易销售 API 调用,其中包含了 storeInVault: true 选项。这样做是使用包含的付款方式 nonce 创建交易并尝试创建 232057823 的客户 ID,这就是您遇到该错误的原因。
如果您的目标是简单地更新现有客户,则您需要使用Customer Update API 调用。
本文收集自互联网,转载请注明来源。
如有侵权,请联系[email protected] 删除。
我来说两句