1. Go to this page and download the library: Download beepsolutions/beep-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/ */
beepsolutions / beep-php example snippets
use BeepPHP\Client;
$client = new Client('apikey', 'appid');
use BeepPHP\Client;
$client = new Client('apikey', 'appid', 'sandbox');
use BeepPHP\Client;
$options = ['headers' => ['foo' => 'bar']];
$client = new Client('apikey', 'appid', 'sandbox', $options);
use BeepPHP\Client;
$client = new Client('apikey', 'appid');
$json = [
"provider" => "alipay", // Payment method enabled for your merchant account such as bcmc, alipay, card
"currency" => "GBP",
"amount" => 1000, // 10.00 GBP
"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 for e-commerce or use the qrcode to display on external screens
use BeepPHP\Client;
$client = new Client('apikey', 'appid');
$json = [
"currency" => "SGD",
"amount" => 1000, // 10.00 SGD
"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
use BeepPHP\Client;
$client = new Client('apikey', 'appid');
$transactions = $client->transactions->list(['page' => 2]); // get the second page of transactions
use BeepPHP\Client;
$client = new Client('apikey', 'appid');
$transactions = $client->transactions->get('12356'); // get the transaction with id 123456