I am using Braintree
as a payment gateway of my iOS app.
I created a Node.js server to process the payment.
I want to create customers with the customer id of the user id used in the user management system.
BraintreeGateway.customer.update(req.uid, {
paymentMethodNonce,
verifyCard: process.env.NODE_ENV === 'production'
}, (err, result) => {
if (err) {
next(err);
} else {
if (result.success) {
req.customer = result.customer
console.info('Payment Method:', result.customer.paymentMethods[0])
res.send({
status: HttpStatus.OK,
message: 'Successfully updated!'
})
} else {
next({
error: 'Failed to update a payment method!',
result
})
}
}
})
Here req.uid
is the unique identifier of the user.
It is working well without CVV verification settings enabled in the Braintree Control Panel. Here
But with the CVV verification settings enabled, I get authorizationError: Authorization Error
which means the invalid API key.Here
I am using DropIn UI
to input credit card and passing the paymentMethodNonce
to the server properly.
The current test credit card number is Number: 4242 4242 4242 4242
Exp: 12/2019
CVV: 123
.
What is the mistake here? Will it work in the production mode? (Braintree will accept the valid credit card numbers in the production mode? )
I work at Braintree. If you have any further questions, feel free to contact support.
It's likely that the user you are using to perform the update API call does not have the correct permissions to perform card verifications. I recommend checking the user's role and making sure it has all the necessary permissions: https://articles.braintreepayments.com/control-panel/basics/users-roles#creating-and-editing-roles
If after doing this you still receive an authorization error, I recommend reaching out to Braintree support.