-
Notifications
You must be signed in to change notification settings - Fork 2
/
demo.php
39 lines (29 loc) · 835 Bytes
/
demo.php
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
<?php
require __DIR__.'/vendor/autoload.php';
use Omnipay\Omnipay;
$gateway = Omnipay::create('Esewa_Secure');
$gateway->setMerchantCode('epay_payment');
$gateway->setTestMode(true);
$response = $gateway->purchase([
'amount' => 100,
'deliveryCharge' => 0,
'serviceCharge' => 0,
'taxAmount' => 0,
'totalAmount' => 100,
'productCode' => 'ABAC2098',
'returnUrl' => 'https://merchant.com/payment/1/complete',
'failedUrl' => 'https://merchant.com/payment/1/failed',
])->send();
if ($response->isRedirect()) {
$response->redirect();
}
// Verify Payment
$response = $gateway->verifyPayment([
'amount' => 100,
'referenceNumber' => 'GDFG89',
'productCode' => 'ABAC2098',
])->send();
if ($response->isSuccessful()) {
// Success
}
// Failed