1. Go to this page and download the library: Download itsoft/revolut library. Choose the download type require.
2. Extract the ZIP file and open the index.php.
3. Add this code to the index.php.
<?php
require_once('vendor/autoload.php');
/* Start to develop here. Best regards https://php-download.com/ */
itsoft / revolut example snippets
$ROOT_PATH = '/www/your-crm...';
ut.txt';
$path2refresh_token = $ROOT_PATH . 'token/revolut_refresh_token.txt';
$a_token = json_decode(file_get_contents($path2token));
$r_token = json_decode(file_get_contents($path2refresh_token));
$params = [
'apiUrl' => 'https://b2b.revolut.com/api/1.0',
'authUrl' => 'https://business.revolut.com/app-confirm',
'clientId' => 'YOUR-CLIENT-ID',
'privateKey' => file_get_contents('your_secret_keys_dir/revolut/privatekey.pem'),
'redirectUri' => 'https://your_site.com/redirect_uri/', //OAuth redirect URI
'accessToken' => $a_token->access_token,
'accessTokenExpires' => $a_token->expires,
'refreshToken' => $r_token->refresh_token,
'refreshTokenExpires' => $r_token->expires,
'saveAccessTokenCallback' => function ($access_token, $expires) use ($path2token) {file_put_contents($path2token, json_encode(['access_token' => $access_token, 'expires' => $expires]));},
'saveRefreshTokenCallback' => function ($refresh_token, $expires) use ($path2refresh_token) {file_put_contents($path2refresh_token, json_encode(['refresh_token' => $refresh_token, 'expires' => $expires]));},
'logErrorCallback' => function ($error){mail('[email protected]', 'Revolut API Error', $error);}
];
// for debug you can use
// $params['apiUrl'] = 'https://sandbox-b2b.revolut.com/api/1.0';
// $params['authUrl'] = 'https://sandbox-business.revolut.com/app-confirm';
$revolut = new \ITSOFT\Revolut\Revolut($params);
$ROOT_PATH = '/www/your-crm...';
evolut.com/api/1.0',
'authUrl' => 'https://business.revolut.com/app-confirm',
'clientId' => 'YOUR-CLIENT-ID',
'privateKey' => file_get_contents('your_secret_keys_dir/revolut/privatekey.pem'),
'redirectUri' => 'https://your_site.com/redirect_uri/', //OAuth redirect URI
'accessToken' => '',
'accessTokenExpires' => '',
'refreshToken' => '',
'refreshTokenExpires' => '',
'saveAccessTokenCallback' => function ($access_token, $expires){},
'saveRefreshTokenCallback' => function ($refresh_token, $expires){},
'logErrorCallback' => function ($error){mail('[email protected]', 'Revolut API Error', $error);}
];
// for debug you can use
// $params['apiUrl'] = 'https://sandbox-b2b.revolut.com/api/1.0';
// $params['authUrl'] = 'https://sandbox-business.revolut.com/app-confirm';
$revolut = new \ITSOFT\Revolut\Revolut($params);