hmimeee/revolut
最新稳定版本:1.0
Composer 安装命令:
composer require hmimeee/revolut
包简介
A package to integrate Revolut payment gateway. Revolut is a British financial technology company that offers banking services, but as of December 2022 does not have a UK banking licence.
README 文档
README
A package to integrate Revolut payment gateway. Revolut is a British financial technology company that offers banking services, but as of December 2022 does not have a UK banking licence.
Read the documentation below to integrate the library for your PHP Application.
Requirements
PHP 5.6.0 and later.
Composer
You can install the bindings via Composer. Run the following command:
composer require hmimeee/revolut
To use the bindings, use Composer's autoload:
require_once('vendor/autoload.php');
Dependencies
The bindings require the following extensions in order to work properly:
If you use Composer, these dependencies should be handled automatically. If you install manually, you'll want to make sure that these extensions are available.
Getting Started
Simple usage looks like:
$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@example.com', //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']; }
Webhook Endpoint Preparing
A Post request will be sent from Revolut along with the data below:
{
"event": "ORDER_COMPLETED",
"order_id": "9fc01989-3f61-4484-a5d9-ffe768531be9",
"merchant_order_ext_ref": "Test #3928"
}
Now match with the Order ID and take your further action like the code below:
if($_POST['event'] == 'ORDER_COMPLETED') { //Match that previous $orderId with $_POST['order_id'], and take proper action. }
💥 Boom! You've done everything.
统计信息
- 总下载量: 16
- 月度下载量: 0
- 日度下载量: 0
- 收藏数: 0
- 点击次数: 1
- 依赖项目数: 0
- 推荐数: 0
其他信息
- 授权协议: MIT
- 更新时间: 2023-02-07