PHP code example of tink / omnipay-mobikwik
1. Go to this page and download the library: Download tink/omnipay-mobikwik 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/ */
tink / omnipay-mobikwik example snippets
$gateway = Omnipay::create('Mobikwik_Express');
$gateway->setMid('MBK9002');
$gateway->setKey('xxxxx');
$gateway->setEnvironment('test');
$params = [
'email' => "[email protected] ",
'orderId' => 'order' . time(),
'amount' => 0.01,
'redirecturl' => "http://example.com/callback",
'showmobile' => 'true',
'version' => 2,
];
$response = $gateway->purchase($params)->send();
$response->redirect();
$gateway->setMid('MBK9002');
$gateway->setKey('xxxxx');
$gateway->setEnvironment('test');
$response = $gateway->completePurchase(['request_params' => $_REQUEST ])->send();
if ($response->isPaid()) { // 成功
...
} elseif ($response->isFailure()) { // 失败
...
} else { // 进行中
...
}
$gateway->setMid('MBK9002');
$gateway->setKey('xxxxx');
$gateway->setEnvironment('test');
$response = $gateway->queryOrder(['orderId' => 'xxx'])->send();
if ($response->isPaid()) {
...
} elseif ($response->isFailure()) {
...
} else {
...
}
$gateway = Omnipay::create('Mobikwik_Express');
$gateway->setMid('MBK9002');
$gateway->setKey('xxxxx');
$gateway->setEnvironment('test');
$params = [
'orderId' => 'order0011521618722233',
'amount' => 0.01
];
$response = $gateway->refund($params)->send();
if ($response->isPaid()) { // 成功
...
} elseif ($response->isFailure()) { // 失败
...
} else { // 进行中
...
}