1. Go to this page and download the library: Download hmimeee/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/ */
hmimeee / revolut example snippets
$revolut = getRevolut([
'env' => 'sandbox', //or, live
'key' => 'Your marchant secret key here'
]);
$response = $revolut->createOrder([
'amount' => 1210, //The amount must be the smallest currency unit like (from $12.10 to 1210)
'currency' => 'GBP',
'description' => 'An example order', //Can skip it as it's optional.
'name' => 'John Doe', //Can skip it as it's optional.
'email' => '[email protected]', //Can skip it as it's optional.
]);
if ($response['status']) {
$orderId = $response['data']->id; //Keep the Order ID to verify the payment in the Webhook Endpoint.
header("location:" . $response['data']->checkout_url);
} else {
echo $response['message'];
}
if($_POST['event'] == 'ORDER_COMPLETED') {
//Match that previous $orderId with $_POST['order_id'], and take proper action.
}
Loading please wait ...
Before you can download the PHP files, the dependencies should be resolved. This can take some minutes. Please be patient.