sverraest / revolut-php

💳 PHP Bindings for the Revolut Business API
https://revolutdev.github.io/business-api/#api-v1-0-introduction
Other
46 stars 17 forks source link

Payment /pay authorization problem #23

Open tomekhun opened 2 years ago

tomekhun commented 2 years ago

Dears!

First of all thank you for this package! Really easy to integrate!

I ran into a problem, which i couldnt solve as of now.

I'm trying everything in sandbox mode. Authorization working perfectly. Counterparty creation is also flawless.

Altough when i try anything else it goes into forbidden.

During authoriazion i tried to add different scopes but does not change the permission that the app-confirm is giving (payments, accounts, etc).

All the time i try to do a transfer of payment i get back a 403:

"message": "Client error: POST https://sandbox-b2b.revolut.com/api/1.0/pay resulted in a 403 Forbidden response:\n{\"message\":\"This action is forbidden\",\"code\":9002}\n"

I know that the problem is on my end, but i'm unable to figure it out.

Any help is appreciated!

Regards Tom

Yuzmi commented 2 years ago

I also got this issue recently, it came from the getAuthorizationUrl() method. I used it to redirect the user to Revolut but the default scope is only READ. The provided access token only lets you retrieve data, nothing more.

You must add WRITE (for counterparty creation, etc...) and/or PAY (for payments). return $this->getAuthProvider()->getAuthorizationUrl(['scope' => "READ,WRITE,PAY"]);

You don't have this issue if you do it directly from the Revolut website.

Hope it helps.