Braintree VaultManager using react-native-braintree-dropin-u



我想让用户删除他保存的支付卡我正在使用这个包

"react-native-braintree-payments-drop-in": "^1.2.0"`

代码:

BraintreeDropIn.show({
clientToken: this.state.clientToken,
// I also add this but it is not showing me edit option in dropin
vaultManager: true 
}).then(result => { ...

我有什么东西不见了吗?

您必须创建一个;脑树客户;然后将brainstree.customer.id存储到用户对象中。

然后,如果你有一个头脑树客户id,你可以像我一样生成一个自定义客户端令牌。在你的后端调用它来生成一个,然后在你的Drop-in-show({clientToken}(选项字段中使用它

if(!req.user.brainTreeCustomerId){
gateway.customer.create({
firstName: req.user.name.first,
lastName: req.user.name.last,
email: req.user.email
}, function (err, result) {
if(err) return error(res, 500, "Something went wrong while creating customer payment profile");
if(result.success){
req.user.brainTreeCustomerId = result.customer.id;
req.user.save();
}
});
}
return gateway.clientToken.generate({
customerId: req.user.brainTreeCustomerId
})
.then(response => {
console.log(response);
return result(res, 200, response.clientToken);
}).catch(error(res));

相关内容

  • 没有找到相关文章

最新更新