zaruto / bml-connect-php
BML Connect API 的 PHP 绑定
v2.1.0
2021-09-13 07:30 UTC
Requires
- php: >= 7.0
- guzzlehttp/guzzle: ~6.0|~7.0
Requires (Dev)
- phpstan/phpstan: ^0.9.2
- phpunit/phpunit: ~5.0
- roave/security-advisories: dev-master
- squizlabs/php_codesniffer: ^3.1
This package is auto-updated.
Last update: 2024-09-12 16:20:42 UTC
README
用于 Bank of Maldives Connect API 的 PHP API 客户端和绑定
使用此 PHP API 客户端,您可以与 Bank of Maldives Connect API 进行交互
- 💳 交易
安装
需要 PHP 8.0 或更高版本
推荐通过 Composer 安装 bml-connect-php
首先,安装 Composer
$ curl -sS https://getcomposer.org/installer | php
然后,安装最新的 bml-connect-php
$ composer require zaruto/bml-connect-php
最后,您需要在您的 PHP 应用程序中引入库
require "vendor/autoload.php";
开发
- 在创建 PR 之前,运行
composer test
和composer phpcs
以检测任何明显的问题。 - 请在 问题 部分创建针对此特定 API 绑定的 issue。
- 直接联系 银行马尔代夫 以获取 Bank of Maldives Connect API 支持。
快速入门
BMLConnect\Client
首先从 商户门户 获取您的 生产
或 沙箱
API 密钥。
如果您想获取 生产
客户端
use BMLConnect\Client; $client = new Client('apikey', 'appid');
如果您想获取 沙箱
客户端
use BMLConnect\Client; $client = new Client('apikey', 'appid', 'sandbox');
如果您想传递额外的 GuzzleHTTP 选项
use BMLConnect\Client; $options = ['headers' => ['foo' => 'bar']]; $client = new Client('apikey', 'appid', 'sandbox', $options);
可用的 API 操作
以下是通过 API 客户端可用的 Bank of Maldives Connect API 的 API 操作。
下面提供有关每个资源的更多详细信息。
💳 交易
创建一个具有或不具有特定支付方式的新交易。
使用说明
💳 交易
使用特定支付方式创建交易
use BMLConnect\Client; $client = new Client('apikey', 'appid'); $json = [ "provider" => "alipay", // Payment method enabled for your merchant account such as bcmc, alipay, card "currency" => "MVR", "amount" => 1000, // 10.00 MVR "redirectUrl" => "https://foo.bar/order/123" // Optional redirect after payment completion ]; $transaction = $client->transactions->create($json); header('Location: '. $transaction["url"]); // Go to transaction payment page
不使用支付方式创建交易,将重定向到支付方式选择屏幕
use BMLConnect\Client; $client = new Client('apikey', 'appid'); $json = [ "currency" => "MVR", "amount" => 1000, // 10.00 MVR "redirectUrl" => "https://foo.bar/order/987" // Optional redirect after payment completion ]; $transaction = $client->transactions->create($json); header('Location: '. $transaction["url"]); // Go to payment method selection screen
关于
⭐ 在 https://dashboard.merchants.bankofmaldives.com.mv 上注册为商户,并在几秒钟内开始接收付款。