I am coding an IOS app with Payment feature. I decided to use Braintree V Zero.
At the very beginning, I use their excellent DropIn UI feature, and everything works fine. But when payment happen, the Drop In UI required end-user to input his credit card or Paypal information every time.
Does any expect know how to implement one automatic charge solution by BrainTree V zero?
Like Uber's charge solution.
I guess maybe need to mark the user's credit card information from app side or service side?
router.get('/token', function (req, res) {
console.log('Kevin in token be called %s', req.param('aCustomerId'));
var aCustomerId = req.param('aCustomerId');
console.log('Kevin %s', aCustomerId);
gateway.clientToken.generate({customerId: aCustomerId}, function (error, response) {
res.send(response.clientToken);
console.log(response.clientToken);
});
});
Thank you in advanced!
Full disclosure: I work for Braintree.
The Braintree drop-in will display previously used payment methods for a customer, if you pass the customer_id
in when generating a client token on your server.
Here's an example of how to do it in Node:
gateway.clientToken.generate({
customerId: aCustomerId
}, function (err, response) {
var clientToken = response.clientToken
});
Once a payment method is used, it will be saved in the drop-in and the customer will not have to enter it again. Pass the token of the saved payment method when creating a transaction:
gateway.transaction.sale({
amount: "10.00",
paymentMethodToken: theToken,
options: {
submitForSettlement: true
}
}, function (err, result) {
});
If you have any further questions, please feel free to contact Braintree support. 3133e