permission_denied error when capturing paypal order with paypal buttons and php
Asked Answered
D

1

7

since a few weeks ago I receive an error, when capturing a paypal order. All works fine in the sandbox but not in the production environment.

The buttons are rendered correctly and the paypal window opens. After I login to paypal the console on the shop prints:

buttonCorrelationID: "f648506974719"
buttonSessionID: "xxx"
clientID: "xxx"
env: "production"
err: "Identitysecuretokenserv responded with status 401 for securityContext"
referer: "www.paypal.com"
sdkCorrelationID: "a156c1d6c1aa1"
sessionID: "xxx"
time: "1644485190845"
timestamp: "1644485190845"
token: "xxx"
user_id: "xxx"

xxx is replaced and in real it is filled with the correct data.

In the paypal window I don't see any error. Even when I change the adress and the callback "onShippingChange" is being called I get the correct shipping price. I don't get any error then.

After I click on "pay now" the paypal-popup closes and I see this error:

Error: Api: /smart/api/order/xxx/capture 
returned ack: permission_denied (Corr ID: f1924860b1e9c { 
    "ack":"permission_denied",
    "message":"Insufficient privileges"
}

As I said in the beginning this only appears in the production environment. The sandbox works fine. This error just appeared a few weeks ago. Before then it worked in the production environment fine as well. This occured at the same time on all the online shops of my clients and all have different merchant accounts.

Does anybody has an idea what's wrong? I can provide all the information and the code if needed.

thanks and kind regards hansrouge

Dillie answered 10/2, 2022 at 9:56 Comment(8)
I don't know the API specifically but it sounds like a token somewhere has expired and needs renewing.Tarlatan
@Tarlatan Yes, the tokens are generated just a few seconds before I submit the order.Dillie
So if the token hasn't expired when you try to use it, then perhaps whatever you're generating and/or your account no longer has the necessary privileges to do the action you're attempting. If you had working code and haven't changed it, but are now getting authentication errors, then it's almost certainly a config issue rather than a programming problem. Again I don't know the product specifically, but I'd suggest checking whatever management tool you use for your account, checking your permissions thoroughly etc.Tarlatan
How are you loading the JS SDK script?Merla
Thanks for you comments. I digged a little depper and found the following: This only occurs when I am using the browser Brave. And it only occurs in live mode, never in sandbox mode. But still it just occured couple of weeks ago...so maybe Brave did change something?Dillie
@Dillie , Thank you so much for saving my hours But yes this happened when I use Brave and on other browser it seem perfectly fine without any issues.Whinny
This seems to be happening on Firefox 103.0.2 as well.Llamas
This seems to be happening still, regardless of browser. One factor seems to be the use of a credit card. More here: github.com/paypal/paypal-checkout-components/issues/1521Fourcycle
D
3

For my case, I was trying to make payment from the browser with another tab, where logged in sandbox account dashboard is open. Making payment from another browser resolved the issue.

Doubleacting answered 22/7, 2022 at 10:38 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.