cancel
Showing results for 
Search instead for 
Did you mean: 

Unauthorized (401) message received when making credit card payment via PayPal SDK

SOLVED
Member

Unauthorized (401) message received when making credit card payment via PayPal SDK

Hi, we managed to complete the credit card payment via PayPal SDK on PayPal Sandbox environment, but once we've switched it to PayPal Live environment, the payment could not get thru, we're receiving HTTP response Unauthorised (401) code from PayPal Live env. We've confirmed that our PayPal Live API credentials (clientId and secret) are being applied, and the mode has been set to "live" as well. May I know what could be the other possibilities of getting (401) code?

 

<settings>
<add name="mode" value="live"/>
<add name="connectionTimeout" value="360000"/>
<add name="requestRetries" value="1"/>
<add name="clientId" value="[our live credentials]"/>
<add name="clientSecret" value="[out live credentials]"/>
</settings>

 

1 ACCEPTED SOLUTION

Accepted Solutions
Highlighted
Moderator

Re: Unauthorized (401) message received when making credit card payment via PayPal SDK

Hi, the error this time is about the missing "last_name": "YourCustomerLastName".

Also check that your request has the correct objects and fields, you can see example here for reference in case: https://developer.paypal.com/docs/api/payments/#payment_create_request

3 REPLIES
Moderator

Re: Unauthorized (401) message received when making credit card payment via PayPal SDK

Hi, the most common cause is that in your request you are passing the "payment_method": "credit_card", that is only reserved to PRO accounts. If your account is not PRO then it will fail. If this is your case then just pass the value "paypal" instead and you will able to process card payments via the GuestCheckout, where available.

If this is not your case then would help to have any correlationID or DebugID you received in the response (only the most recent one) so that I can have a look in the logs.

Member

Re: Unauthorized (401) message received when making credit card payment via PayPal SDK

Hi, it seems like the 401 Error has gone away after applying "payment_method": "credit_card" but another error surfaced. I've got an 500 Internal Server error but no descriptive message is given in the repsonse.

 

The Debug ID is : 85c818fa5c34a

 

Could you please help me check on what is causing this issue ?

 

And also there are no Debug ID shown in the Live API Dashboard. could you help me check on that as well ?

PaypalNoDebugID.PNG

Highlighted
Moderator

Re: Unauthorized (401) message received when making credit card payment via PayPal SDK

Hi, the error this time is about the missing "last_name": "YourCustomerLastName".

Also check that your request has the correct objects and fields, you can see example here for reference in case: https://developer.paypal.com/docs/api/payments/#payment_create_request