Reputation: 3051
Since I switched from the sandbox mode to the real deal I get a client authentication failed error.
Config:
{
"port": 5000,
"api": {
"host": "api.paypal.com/v1/",
"port": "",
"client_id": "-",
"client_secret": "-"
}
}
I've double checked my client id and secret, they are enabled and aren't for the sandbox mode.
Code:
paypalService.getPaypalMethodOption(req.body.paymentMethodOptionId).then(function (paymentMethodOption) {
var invoiceId = uuid.v4();
var payment = {
"intent": "sale",
"payer": {
"payment_method": "paypal"
},
"transactions": [{
"amount": {
"currency": 'USD',
"total": paymentMethodOption.Price
},
"description": paymentMethodOption.Description,
"invoice_number": invoiceId
}]
};
payment.payer.payment_method = 'paypal';
payment.redirect_urls = {
"return_url": "http://localhost:3000/paypal/execute",
"cancel_url": "http://localhost:3000/donate/cancelled"
};
paypal.payment.create(payment, function (error, payment) {
// error
});
});
What can be the problem?
Upvotes: 1
Views: 1287
Reputation: 3051
After searching for a few hours i found out that i needed another property. Apparently you need to add the property mode with the value "live". The documentation isn't very clear on this part, neither are there any live example codes in the node sdk github repository.
My config now looks like the following:
{
"port": 5000,
"api": {
"mode": "live",
"host": "api.paypal.com",
"port": "",
"client_id": "-",
"client_secret": "-"
}
}
Upvotes: 3