0
我在使用Drop-in功能的沙盒模式中尝试Braintree。 我使用现有的customerID
创建客户端令牌。但是,当我做transaction.sale
调用这个customerId
和期权storeInVault = true
提示错误以下错误:Braintree沙箱transaction.sale给出错误:“销售客户ID已被采纳”
Sale Customer ID has already been taken.
按照它应该更新与支付现时客户的文档。
下面是代码:
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;
}
}
});
我使用流星与包patrickml:braintree
。
我认为这是我可能要做的。但根据文档:**现有客户使用新的付款方式** 要将此交易的付款方式与现有客户关联,请将customerId与options.storeInVault或options.storeInVaultOnSuccess一起传递为true。 的Node.js 'gateway.transaction.sale({ 量: “10.00”, paymentMethodNonce:nonceFromTheClient, 客户ID: “theCustomerId”, 选项:{ storeInVaultOnSuccess:真 } },功能(ERR,结果){ });' –
该文档是正确的,但我可以看到混淆。您在客户选项中嵌套'id'属性。在您已链接的示例中,customerId属性在顶层指定。 – ThinkAboutIt
尤里卡瞬间!良好的捕捉,它总是有助于有第二双眼睛!非常感谢。 –