PHP code example of bankofmaldives / bml-connect-php
1. Go to this page and download the library: Download bankofmaldives/bml-connect-php 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/ */
bankofmaldives / bml-connect-php example snippets
use BMLConnect\Client;
$client = new Client('apikey', 'appid');
use BMLConnect\Client;
$client = new Client('apikey', 'appid', 'sandbox');
use BMLConnect\Client;
$options = ['headers' => ['foo' => 'bar']];
$client = new Client('apikey', 'appid', 'sandbox', $options);
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