Closed rapidmon17 closed 6 years ago
Your client side code sounds correct by the fact that you're getting a nonce back 👍 I'm assuming you're using the same gateway object to create a Client Token so I'm ruling out the thought that your server side credentials might be incorrect.
Your first snippet would fail because you're missing customerId
which is a required param for creating a payment method: https://developers.braintreepayments.com/reference/request/payment-method/create/node
Your second snippet would fail because your options
param needs to be nested under creditCard
: https://developers.braintreepayments.com/reference/request/customer/create/node#card-verification
You are getting authorizationError probably because of that missing customerId
param. You're probably also seeing that for the gateway.paymentMethod.create
call as well.
The authorization error is misleading. We are tracking the issue in #129.
Thank you! Turns out my request structure was a bit off. I corrected it and it worked.
Meteor.methods({
'braintreeAPI.createPaymentMethod'(nonce){
console.log(`UserID on server side ${this.userId}`);
gateway.customer.create({
Id:this.userId,
paymentMethodNonce: nonce,
creditCard: {
options: {
verifyCard: true
}
}
}, function (err, result) {
if(err){
console.log(`Error ${err}`);
} else {
var paymentToken = result.customer.paymentMethods[0].token;
addPaymentToken(this.userId, paymentToken);
console.log(`Results ${result.customer.paymentMethods[0].token}`);
}
});
}
});
I am glad you guys are adding more context to Authorization Error.
Hi, I am currently in Sandbox mode. I am able to obtain the paymentNonce from the DropIn. However, when I tried to create a paymentMethod, it appeared to work. But there was no vault showing up on the Braintree sandbox dashboard when I did a search for vaults created today. Here is the code used in creating a paymentMethod.
So I decided that maybe I needed to create a customer first. And that didn't work. I got an Authorization Error.
Here is my code below.
Below is my client code.
Am I missing something? I am in sandbox mode, I could really use a clue. And I have admin authorization on my Braintree sandbox account.