Coder Social home page Coder Social logo

sverraest / revolut-php Goto Github PK

View Code? Open in Web Editor NEW
44.0 7.0 15.0 69 KB

πŸ’³ PHP Bindings for the Revolut Business API

Home Page: https://revolutdev.github.io/business-api/#api-v1-0-introduction

License: Other

PHP 100.00%
revolut php php7 api api-client

revolut-php's Introduction

RevolutPHP

(Unofficial) PHP API Client and bindings for the Revolut Business API.

Build Status codecov Scrutinizer Code Quality Maintainability Latest Stable Version License composer.lock

Using this PHP API Client you can interact with your:

  • πŸ’° Accounts
  • 🏒 Counterparties
  • πŸ’Έ Payments
  • πŸ•°οΈ Payment Drafts
  • πŸ”€ Transfers
  • πŸ“Š Transactions
  • πŸ’Ή Rates
  • πŸ’± Exchanges
  • πŸ”— Webhooks

Revolut Business API does not support - 🧾 Invoices

Installation

Requires PHP 7.0 or higher

The recommended way to install revolut-php is through Composer:

First, install Composer:

$ curl -sS https://getcomposer.org/installer | php

Next, install the latest revolut-php:

$ php composer.phar require sverraest/revolut-php

Finally, you need to require the library in your PHP application:

require "vendor/autoload.php";

Development

  • Run composer test and composer phpcs before creating a PR to detect any obvious issues.
  • Please create issues for this specific API Binding under the issues section.
  • Contact Revolut directly for official Revolut For Business API support.

Quick Start

RevolutPHP\Auth\Provider

Start by following the authentication instructions in the Revolut API docs:

openssl genrsa -out privatecert.pem 2048
openssl req -new -x509 -key privatecert.pem -out publiccert.cer -days 1825

Paste the generated public key on the Revolut for Business API settings page, and use the private key to instantiate a new RevolutPHP\Auth\Provider:

$authProvider = new \RevolutPHP\Auth\Provider([
    'clientId' => '{clientId}', // As shown when uploading your key
    'privateKey' => 'file://{privateKeyPath}',
    'redirectUri' => 'https://example.com', // The URL to redirect the user to after the authorisation step 
    'isSandbox' => true
]);

You can now redirect the user to the authorisation flow in the Revolut for Business app:

$url = $authProvider->getAuthorizationUrl();

Once the user has confirmed authorisation, the user will be redirected back to the redirectUri with an authorisation code attached. You can exchange this authorisation code for an access token:

$accessToken = $authProvider->getAccessToken('authorization_code', [
    'code' => $_GET['code']
]);

You can save this $accessToken somewhere safe and pass it directly to the RevolutPHP\Client. The token is valid for 40 minutes. To request a new token after expiration, you can use the refresh token to get a new access token:

if( $accessToken->hasExpired() ) {
    $newAccessToken = $authProvider->getAccessToken('refresh_token', [
        'refresh_token' => $accessToken->getRefreshToken()
    ]);
}

RevolutPHP\Client

If you want to get a production client:

use RevolutPHP\Client;

$client = new Client($accessToken);

If you want to get a sandbox client:

use RevolutPHP\Client;

$client = new Client($accessToken, 'sandbox');

If you want to pass additional GuzzleHTTP options:

use RevolutPHP\Client;

$options = ['headers' => ['foo' => 'bar']];
$client = new Client($accessToken, 'sandbox', $options);

Available API Operations

The following exposed API operations from the Revolut For Business API are available using the API Client.

See below for more details about each resource.

πŸ’° Accounts

Get all accounts, Get a specific account and get details for a specific account.

🏒 Counterparties

Get all counterparties, get a specific counterparty, create a new counterparty and delete a counterparty.

πŸ’Έ Payments

Create and schedule new payments.

πŸ•°οΈ Payment Drafts

Create, get and delete payment drafts for approval by a business owner/admin.

πŸ”€ Transfers

Create a transfer between your accounts.

πŸ“Š Transactions

Get all transactions or a subset (with queryFilters), cancel a scheduled transaction, get a specific transaction and get a transaction by the unique specified requestId.

A Transaction is either created as a Payment or a Transfer.

πŸ’Ή Rates

Get exchange rates.

πŸ’± Exchanges

There are two ways of using this endpoint:

If you know the amount of currency you want to sell (e.g: I want to exchange 135.5 USD to EUR), then you should specify the amount in the "from" object.

If, on the other hand, you want to specify the amount of currency you want to buy (e.g: I want to exchange USD to receive 200 EUR), then you should specify the amount in the "to" object.

❗ Please note that the "amount" field can be specified only once, either in the "from" object or in the "to" object.

πŸ”— Webhooks

Create new webhooks.

Usage details

πŸ’° Accounts

Get all accounts

See more at https://developer.revolut.com/docs/api-reference/business/#tag/Accounts

use RevolutPHP\Client;

$client = new Client($accessToken);
$accounts = $client->accounts->all();

Get one account

See more at https://developer.revolut.com/docs/api-reference/business/#tag/Accounts/operation/getAccount

use RevolutPHP\Client;

$client = new Client($accessToken);
$account = $client->accounts->get('foo');

Get account details

See more at https://developer.revolut.com/docs/api-reference/business/#tag/Accounts/operation/getAccountDetails

use RevolutPHP\Client;

$client = new Client($accessToken);
$account = $client->accounts->getDetails('foo');

🏒 Counterparties

Add a Counterparty

See more at https://developer.revolut.com/docs/api-reference/business/#tag/Counterparties/operation/addCounterparty

use RevolutPHP\Client;

$client = new Client($accessToken);
$counterparty = $client->counterparties->create(['profile_type' => 'business', 'name' => 'TestCorp' , 'email' => '[email protected]']);

Delete a Counterparty

See more at https://developer.revolut.com/docs/api-reference/business/#tag/Counterparties/operation/deleteCounterparty

use RevolutPHP\Client;

$client = new Client($accessToken);
$client->counterparties->delete('foo');

Get all Counterparties

See more at https://developer.revolut.com/docs/api-reference/business/#tag/Counterparties/operation/getCounterparties

use RevolutPHP\Client;

$client = new Client($accessToken);
$counterparties = $client->counterparties->all();

Get a specific Counterparty

See more at https://developer.revolut.com/docs/api-reference/business/#tag/Counterparties/operation/getCounterparty

use RevolutPHP\Client;

$client = new Client($accessToken);
$counterparty = $client->counterparties->get('bar');

πŸ’Έ Payments

Create a payment

See more at https://developer.revolut.com/docs/api-reference/business/#tag/Payments/operation/createPayment

use RevolutPHP\Client;

$client = new Client($accessToken);

$payment = [
  'request_id' => 'e0cbf84637264ee082a848b',
  'account_id' => 'bdab1c20-8d8c-430d-b967-87ac01af060c',
  'receiver' => [
    'counterparty_id': '5138z40d1-05bb-49c0-b130-75e8cf2f7693',
    'account_id': 'db7c73d3-b0df-4e0e-8a9a-f42aa99f52ab'
  ],
  'amount' => 123.11,
  'currency' => 'EUR',
  'reference' => 'Invoice payment #123'
];

$payment = $client->payments->create($payment);

Schedule a payment (for up to 30 days in the future)

See more at https://developer.revolut.com/docs/api-reference/business/#tag/Payments/operation/createPayment

use RevolutPHP\Client;

$client = new Client($accessToken);

$payment = [
  'request_id' => 'e0cbf84637264ee082a848b',
  'account_id' => 'bdab1c20-8d8c-430d-b967-87ac01af060c',
  'receiver' => [
    'counterparty_id': '5138z40d1-05bb-49c0-b130-75e8cf2f7693',
    'account_id': 'db7c73d3-b0df-4e0e-8a9a-f42aa99f52ab'
  ],
  'amount' => 123.11,
  'currency' => 'EUR',
  'reference' => 'Invoice payment #123',
  'schedule_for' => '2018-04-20',
];

$payment = $client->payments->create($payment);

πŸ•°οΈ Payment Drafts

Get all Payment Drafts

See more at https://developer.revolut.com/docs/api-reference/business/#tag/Payment-Drafts/operation/getPaymentDrafts

use RevolutPHP\Client;

$client = new Client($accessToken);
$paymentDrafts = $client->paymentDrafts->all();

Get a specific Payment Draft

See more at https://developer.revolut.com/docs/api-reference/business/#tag/Payment-Drafts/operation/getPaymentDraft

use RevolutPHP\Client;

$client = new Client($accessToken);
$counterparty = $client->paymentDrafts->get('bar');

Create a Payment Draft

See more at https://developer.revolut.com/docs/api-reference/business/#tag/Payment-Drafts/operation/createPaymentDraft

use RevolutPHP\Client;

$client = new Client($accessToken);

$draft = [
  'title' => 'Title of payment',
  'schedule_for' => '2017-10-10',
  'payments' => [[
    'currency' => 'EUR',
    'amount' => 123,
    'account_id' => 'db7c73d3-b0df-4e0e-8a9a-f42aa99f52ab',
    'receiver' => [
      'counterparty_id' => '5138z40d1-05bb-49c0-b130-75e8cf2f7693',
      'account_id' => 'bdab1c20-8d8c-430d-b967-87ac01af060c'
    ],
    'reference' => 'External transfer'
  ]]
];

$draft = $client->paymentDrafts->create($draft);

Delete a payment draft

See more at https://developer.revolut.com/docs/api-reference/business/#tag/Payment-Drafts/operation/deletePaymentDraft

use RevolutPHP\Client;

$client = new Client($accessToken);
$client->paymentDrafts->delete('bar');

πŸ”€ Transfers

Transfer money between your accounts

See more at https://developer.revolut.com/docs/api-reference/business/#tag/Transfers/operation/createTransfer

use RevolutPHP\Client;

$client = new Client($accessToken);

$transfer = [
  'request_id' => 'e0cbf84637264ee082a848b',
  'source_account_id' => 'bdab1c20-8d8c-430d-b967-87ac01af060c',
  'target_account_id' => '5138z40d1-05bb-49c0-b130-75e8cf2f7693',
  'amount' => 123.11,
  'currency' => 'EUR',
  'description' => 'Expenses funding'
];

$transfer = $client->transfers->create($transfer);

πŸ“Š Transactions

Get a specific transaction (Transfer, Payment)

See more at https://developer.revolut.com/docs/api-reference/business/#tag/Payments/operation/getTransaction

use RevolutPHP\Client;

$client = new Client($accessToken);
$transaction = $client->transactions->get('foo');

Get a specific transaction by requestId (Transfer, Payment)

You can fetch a transaction by the requestId that you specified on creation. See more at https://developer.revolut.com/docs/api-reference/business/#tag/Payments/operation/getTransaction

use RevolutPHP\Client;

$client = new Client($accessToken);
$transaction = $client->transactions->getByRequestId('inv-123456789');

Cancel a scheduled transaction

See more at https://developer.revolut.com/docs/api-reference/business/#tag/Payments/operation/cancelTransaction

use RevolutPHP\Client;

$client = new Client($accessToken);
$client->transactions->cancel('foo');

Get all transactions

See more at https://developer.revolut.com/docs/api-reference/business/#tag/Payments/operation/getTransactions

use RevolutPHP\Client;

$client = new Client($accessToken);
$transactions = $client->transactions->all();

Get all transactions with filters applied

See more at https://developer.revolut.com/docs/api-reference/business/#tag/Payments/operation/getTransactions

Default 'count' is 100 if you want to retreive more transactions even with dates selected you should specify bigger 'count'. Highiest value of 'count' is 1000.

use RevolutPHP\Client;

$client = new Client($accessToken);

$searchFilters = [
  'from' => '2018-01-01', 
  'to' => '2018-04-01', 
  'count' => 50, 
  'counterparty' => 'foo', 
  'type' => 'transfer'
];

$transactions = $client->transactions->all($searchFilters);

πŸ’Ή Rates

Get exchange rates

See more at https://developer.revolut.com/docs/api-reference/business/#tag/Exchanges

use RevolutPHP\Client;

$client = new Client($accessToken);

$rates = $client->rates->get('USD', 'EUR', 100);

πŸ’± Exchanges

Exchange currency

See more at https://developer.revolut.com/docs/api-reference/business/#tag/Exchanges/operation/exchangeMoney

use RevolutPHP\Client;

$client = new Client($accessToken);

$exchange = [
  'from' => [
    'account_id' => '7998c061-115a-4779-b7c5-7175c6502ea0',
    'currency' => 'USD',
    'amount' => 135.5
  ],
  'to' => [
    'account_id' => '35ba695a-9153-4f68-ac16-b32f228265c9',
    'currency' => 'EUR'
  ],
  'reference' => 'Time to sell',
  'request_id' => 'e0cbf84637264ee082a848b'
];

$response = $client->exchanges->exchange($exchange);

πŸ”— Webhooks

Create a webhook

See more at https://developer.revolut.com/docs/api-reference/business/#tag/Webhooks/operation/setupWebhook

use RevolutPHP\Client;

$client = new Client($accessToken);

$webhook = [
  'url' => 'https://foo.bar',
];

$webhook = $client->webhooks->create($webhook);

Frameworks

If you're looking to use this PHP API Client in a specific PHP framework you currently have the following options:

Framework Package
Symfony https://github.com/sverraest/revolut-php-bundle
Laravel https://github.com/vdbelt/laravel-revolut

Errors

Currently the following errors are defined in the Revolut Business API.

Error Description
400 Bad request Your request is invalid.
401 Unauthorized Your API key is wrong.
403 Forbidden Access to the requested resource or action is forbidden.
404 Not Found The requested resource could not be found.
405 Method Not Allowed You tried to access an endpoint with an invalid method.
406 Not Acceptable You requested a format that isn't JSON.
429 Too Many Requests You're sending too many requests.
500 Internal Server Error We had a problem with our server. Try again later.
503 Service Unavailable We're temporarily offline for maintenance. Please try again later.

About

You can follow me on 🐦 Twitter or βœ‰οΈ email me at simon[-at-]appfleet.uk.


www.appfleet.uk

revolut-php's People

Contributors

ahosker avatar aurawindsurfing avatar fuerbringer avatar sverraest avatar vdbelt avatar xpaw avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar

revolut-php's Issues

Won't install above PHP 7.0

According to the packagist notes, this package should work for PHP >= 7.0. However, the sub-package lcobucci/jwt prevents installation above 7.0, as below:

Problem 1
   - lcobucci/jwt[3.3.0, ..., 3.4.x-dev] require php ^5.6 || ^7.0 -> your php version (8.0.1) does not satisfy that requirement.
   - sverraest/revolut-php dev-master requires vdbelt/oauth2-revolut ^1.0 -> satisfiable by vdbelt/oauth2-revolut[v1.0, v1.0.1, v1.0.2, v1.
0.3].
   - vdbelt/oauth2-revolut v1.0.3 requires lcobucci/jwt ^3.4.5 -> satisfiable by lcobucci/jwt[3.4.5, 3.4.6, 3.4.x-dev].
   - vdbelt/oauth2-revolut v1.0.2 requires lcobucci/jwt ^3.3.1 -> satisfiable by lcobucci/jwt[3.3.1, ..., 3.4.x-dev].
   - vdbelt/oauth2-revolut[v1.0, ..., v1.0.1] require lcobucci/jwt ^3.3 -> satisfiable by lcobucci/jwt[3.3.0, ..., 3.4.x-dev].
   - Root composer.json requires sverraest/revolut-php dev-master -> satisfiable by sverraest/revolut-php[dev-master].

Would appreciate a fix or clarification. Thanks!

Incorrect Request

Hi, at first, thank you for your work !

I'm trying to use your code to connect my Revolut account.
All's working fine on the first connect (i list my accounts successfully), but when i refresh my webpage, using the same code (code is persistant through GET), i can see an error 500 on my webpage, and in apache logs.

PHP Fatal error: Uncaught League\OAuth2\Client\Provider\Exception\IdentityProviderException: Incorrect request token in /var/www/erp/revolut/vendor/vdbelt/oauth2-revolut/src/Provider/Revolut.php:98\nStack trace:\n#0 /var/www/erp/revolut/vendor/league/oauth2-client/src/Provider/AbstractProvider.php(628): League\OAuth2\Client\Provider\Revolut->checkResponse(Object(GuzzleHttp\Psr7\Response), Array)\n#1 /var/www/erp/revolut/vendor/league/oauth2-client/src/Provider/AbstractProvider.php(537): League\OAuth2\Client\Provider\AbstractProvider->getParsedResponse(Object(GuzzleHttp\Psr7\Request))\n#2 /var/www/erp/revolut/vendor/vdbelt/oauth2-revolut/src/Provider/Revolut.php(144): League\OAuth2\Client\Provider\AbstractProvider->getAccessToken(Object(League\OAuth2\Client\Grant\AuthorizationCode), Array)\n#3 /var/www/erp/revolut/oauth.php(14): League\OAuth2\Client\Provider\Revolut->getAccessToken('authorization_c...', Array)\n#4 {main}\n thrown in /var/www/erp/revolut/vendor/vdbelt/oauth2-revolut/src/Provider/Revolut.php on line 98

So, when i authenticate, i am redirected to this php page, and i can get accounts.
When i refresh this same webpage ($_GET["code"] is still here), i get this error.

Any help ?
Thanks !

require "vendor/autoload.php";

$authProvider = new \RevolutPHP\Auth\Provider([
'clientId' => 'myclientid', // As shown when uploading your key
'privateKey' => 'myprivatekey,
'redirectUri' => 'myredirecturi(to this webpage)', // The URL to redirect the user to after the authorisation step
'isSandbox' => false
]);

if($_GET["code"]=='') {
$url = $authProvider->getAuthorizationUrl();
header("location:".$url);
}

$accessToken = $authProvider->getAccessToken('authorization_code', ['code' => $_GET['code']]);

use RevolutPHP\Client;

$client = new Client($accessToken);
$accounts = $client->accounts->all();

print_r($accounts);

Guzzle 7

Hi, we've been using your package to sync Revolut transactions into our system for a while now. Our application is built on top of Laravel 7. Laravel 7 is now deprecated (https://laravelversions.com/7), and we are switching to Laravel 8. Problem emerges from Laravel 8's requirement of Guzzle 7 (https://laravel.com/docs/8.x/upgrade#updating-dependencies) and we cannot upgrade any time soon unless we replace your package which might prove to be a lot more work than we estimated. Since Guzzle 7 is already in version 7.2, do you plan on supporting it?

Authentication Error

Hello, I'm trying to implemen this package in my app.
I wrote the following controller :

class RevolutAuthController extends Controller
{

    protected $authProvider;

    public function __construct()
    {
        $this->authProvider = new RevolutAuthProvider([
            'clientId' => getenv('REVOLUT_CLIENT_ID'),
            'privateKey' => file_get_contents(base_path('/privatecert.pem')),
            'redirectUri' => "http://my_domain/api/v1/revolut/auth/callback",
            'isSandbox' => true
        ]);
    }


    public function redirectToProvider()
    {
        return redirect($this->authProvider->getAuthorizationUrl(['scope' => "READ,WRITE,PAY"]));
    }




    public function handleRevolutCallback(Request $request)
    {
        $accessToken = $this->authProvider->getAccessToken('authorization_code', [
            'code' => $request->get('code')
        ]);

        if ($accessToken->hasExpired()) {
            $newAccessToken = $this->authProvider->getAccessToken('refresh_token', [
                'refresh_token' => $accessToken->getRefreshToken()
            ]);

            $accessToken = $newAccessToken;
        }
    }
}

The redirect to provider metod works properly and generates a link where I can authorize the app, the issue comes when i try to authorize the app with sms in the revolut side.

After filling in the authcode revolut says "Action is forbidden" and does not redirect to the redirect URI provided.

I have also tried to authorise the app manually via the revolut dashoboard and in that case it works properly.

Any idea on where the issue colud be?

Thank you

Payment /pay authorization problem

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

Problem with access to the account

Hey i set everything as you described, i think.

///php code

require "vendor/autoload.php";

$authProvider = new \RevolutPHP\Auth\Provider([
'clientId' => 'BLABLABLAmyid', // As shown when uploading your key
'privateKey' => 'blablabla/pathto my private key/privatekey.pem',
'redirectUri' => 'web link that i indicated into public key', // The URL to redirect the user to after the authorisation step
'isSandbox' => true
]);

$url = $authProvider->getAuthorizationUrl();

$accessToken = $authProvider->getAccessToken('authorization_code', [
'code' => $_GET['code']
]);

but still it's giving this error:
i will hide my path to the privacy reasons with "myDirectoryToSourceCOde*"

Fatal error: Uncaught BadMethodCallException: Required parameter not passed: "code" in myDirectoryToSourceCOdevendor/league/oauth2-client/src/Tool/RequiredParameterTrait.php:35 Stack trace: #0 myDirectoryToSourceCOdevendor/league/oauth2-client/src/Tool/RequiredParameterTrait.php(53): League\OAuth2\Client\Grant\AbstractGrant->checkRequiredParameter('code', Array) #1 myDirectoryToSourceCOdevendor/league/oauth2-client/src/Grant/AbstractGrant.php(76): League\OAuth2\Client\Grant\AbstractGrant->checkRequiredParameters(Array, Array) #2 myDirectoryToSourceCOdevendor/league/oauth2-client/src/Provider/AbstractProvider.php(535): League\OAuth2\Client\Grant\AbstractGrant->prepareRequestParameters(Array, Array) #3 myDirectoryToSourceCOdevendor/vdbelt/oauth2-revolut/src/Provider/Revolut.php(144): League\OAuth2\Client\Provider\AbstractProvider->getAccessToken(Object(League\OAuth2\Client\Grant\AuthorizationCode), Array) #4 /v in myDirectoryToSourceCOdevendor/league/oauth2-client/src/Tool/RequiredParameterTrait.php on line 35

Token issue

Fatal error: Uncaught League\OAuth2\Client\Provider\Exception\IdentityProviderException: The Token can't be used before Fri Jun 12 10:08:12 UTC 2020. in C:\wamp64\www\revolt\vendor\vdbelt\oauth2-revolut\src\Provider\Revolut.php on line 98

I getting this error ..how to solve . my timezone is IST

Class "Lcobucci\JWT\Configuration" not found

It did work but now im getting the following:

 Error 

  Class "Lcobucci\JWT\Configuration" not found

  at vendor/vdbelt/oauth2-revolut/src/Provider/Revolut.php:134
    130β–•      */
    131β–•     public function getAccessToken($grant, array $options = [])
    132β–•     {
    133β–•         $time = new DateTimeImmutable();
  ➜ 134β–•         $config = Configuration::forSymmetricSigner(new Sha256(), $this->getPrivateKey());
    135β–• 
    136β–•         $token = $config->builder()
    137β–•             ->issuedBy(parse_url($this->redirectUri, PHP_URL_HOST))
    138β–•             ->permittedFor('https://revolut.com')

  1   app/Console/Commands/RevolutGet.php:133
      League\OAuth2\Client\Provider\Revolut::getAccessToken()

  2   app/Console/Commands/RevolutGet.php:108
      App\Console\Commands\RevolutGet::generateNewToken()

How does one check for the response

Hi, I using this package with Laravel and all is good, but I need to get the response back from Revolut, so I can save the UUID's they send to out database.

So this is the code I have:

// At the top I have     use RevolutPHP\Client as Revolut;
$pay = new Revolut($this->api_key); 
            $counterparty = $pay->counterparties->create(
                array (
                'company_name' => user()->companies()->first()->name,
                'bank_country' => 'GB',
                'currency' => 'GBP',
                'account_no' => $request->account_no,
                'sort_code' => $request->sort_code,
                "email" => user()->email,
                "phone" => user()->tel,
                'profile_type' => 'business',
                'address' => 
                    array (
                    'street_line1' => user()->companies()->first()->address_line_1,
                    'street_line2' => user()->companies()->first()->address_line_2,
                    'region' => '',
                    'postcode' => user()->companies()->first()->postcode,
                    'city' => user()->companies()->first()->city,
                    'country' => 'GB',
                    ),
                )
            );

Soon as the response is sent back from Revoult I want to be able to grab that data and do what I want with it, how can one achieve this?

Problem with access to the account

I do everything in sandbox mode but I'm blocked at this part: RevolutPHP\Auth\Provider

And I get this error: Undefined array key "code"

Thank you in advance for your help and advice.

New version of this package, help needed?

Hello,

I am interested in this package. I was looking for the "Rates" feature but it's missing from the stable version 1.1.1. When will you make a release with features from master?

Is there anything I can do to have another stable version of this library? Thanks!

counterparties->create does not work

Hello.

Did you check creation counterparty on working account? Very strange that it does not work.

$client->counterparties->create(['company_name' => 'RS PREHODNI DAVČNI PODRAČUN', 'bank_country' => 'SI' , 'currency' => 'EUR',
'address' => ['street_line1' => 'Gregorčičeva ulica 20', 'street_line2' => '1000 Ljubljana'],
'iban' => 'SI56011008883000073', 'bic' => 'BSLJSI2X']);

sends:

Authorization: Bearer oa_prod_qofi3bp****
User-Agent: GuzzleHttp/6.5.5 curl/7.72.0 PHP/7.3.21
Content-Type: application/json
Content-Length: 232

{"company_name":"RS PREHODNI DAV\u010cNI PODRA\u010cUN","bank_country":"SI","currency":"EUR","address":{"street_line1":"Gregor\u010di\u010deva ulica 20","street_line2":"1000 Ljubljana"},"iban":"SI56011008883000073","bic":"BSLJSI2X"}

Revolut responses: {"message":"Required 'country' is missing","code":3000}

I tried

curl -X POST https://b2b.revolut.com/api/1.0/counterparty
-H "Authorization: Bearer oa_prod_qof***"
-H "User-Agent: GuzzleHttp/6.5.5 curl/7.72.0 PHP/7.3.21"
-H "Content-Type: application/json"
--data @- << EOF

{"company_name":"RS PREHODNI DAV\u010cNI PODRA\u010cUN","bank_country":"SI","currency":"EUR","address":{"street_line1":"Gregor\u010di\u010deva ulica 20","street_line2":"1000 Ljubljana"},"iban":"SI56011008883000073","bic":"BSLJSI2X"}

EOF

Result is the same.

But this one works!
curl -X POST https://b2b.revolut.com/api/1.0/counterparty
-H "Authorization: Bearer oa_prod_li***"
--data @- << EOF

{
"company_name": "RS PREHODNI DAVČNI PODRAČUN",
"bank_country": "SI",
"currency": "EUR",
"iban": "SI56011008883000073",
"bic": "BSLJSI2X",
"address": {
"street_line1": "Gregorčičeva ulica 20",
"street_line2": "1000 Ljubljana",
"postcode": "1000",
"city": "Ljubljana",
"country": "SI"
}
}

EOF

The difference only in new line as I see.

The similar sitation with payment.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    πŸ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. πŸ“ŠπŸ“ˆπŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❀️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.