PHP PayPal REST: Unauthorized Payment - US Account

ShawnRebelo
New Community Member

Hello, I hope someone may be able to help with my issue. PayPal keeps changing their pages. I am having a hard time trying to get my REST API to work when made live.

I went into my developer account, selected live. Copied the ID and Secret.
* Is it supposed to stay on live once clicked? It never stays and I always have to click Live to get the info again.

When I test it, I get "Unauthorized Payment".
Created a new secret, still the same.

We are a US business. I did a lot of searching and found no resolve. Posts are anywhere from 2-5 years old and most commonly related to people out of the country.

Stuff I have come across and read:
- Do I need to have a Pro account?
- Do I need to use PayPal Here?
- Do I need to enable Future Payents?
- I do not see an option to enable Direct Payments/Direct credit cards. Because not using Pro or PayPal here?

The whole process is not all tat smooth. I feel they lack displaying proper information to get most people going in the right direction. No mention of what you do and do not need activated. Or it is so well hidden.

Thank You.

Login to Me Too
1 REPLY 1

MTS_Andre
Moderator
Moderator

Hi, the switch box between Sandbox and Live, to get the credentials, is just a switch box, doesn't need to be "set" to Sandbox or Live, the purpose is to show either Sandbox or Live credentials, not to "set" them, so it's ok in every position it is.

 

For the 401 Unauthorized payment there can be different reasons but the most common is about the payment method. It can be "paypal" for payments with a PayPal account and cards (only managed by PayPal checkout page where the buyer has to fill-in his card details on PayPal and not on your website) or "credit_card" for direct card payments where the buyer can provide his card details directly on your website (not on PayPal checkout). This last method is only reserved for PRO accounts in Uk, Us and Canada.

If you are passing:

"payment_method": "credit_card"

And your account is not PRO you will receive this error. Pass the value "paypal" instead and you will able to process account card payments correctly as the buyer will log in into his/her PayPal account that will use the card already added in it or will be offered, where available, the Guest Checkout with card.
If you send the full response (where you can also see a DebugID or CorrelationID) I can have a look in the logs.


Here 2 links with all the details:

payment_create
definition-payer

Login to Me Too

Haven't Found your Answer?

It happens. Hit the "Login to Ask the community" button to create a question for the PayPal community.