PayPal Client Authentication Failed

廉价感情. 提交于 2019-12-02 09:04:43

问题


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?


回答1:


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": "-"
    }
}


来源:https://stackoverflow.com/questions/33815079/paypal-client-authentication-failed

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!