-
Notifications
You must be signed in to change notification settings - Fork 0
/
pay.php
41 lines (33 loc) · 1.06 KB
/
pay.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
40
41
<html>
<body>
<div style="margin:0 auto" align=center>
<h2>ENTER AMOUNT</h2>
<form method="POST">
<input type="number" min="1000" name="amount" />
<input type="SUBMIT" value="PAY" />
</form>
</div>
</body>
</html>
<?php
if (isset($_POST['amount']) and is_numeric($_POST['amount'])){
$Amount = $_POST['amount'];
// dont't forget to et your Api key
$Api_Key = "e1850164-0c84-4521-ab7a-ea5c2efeb283"; //Required
$Order_ID = time(); // Required
$Callback = 'http://localhost/callback.php?amount=' . $Amount; // Required
$client = new SoapClient('https://api.nextpay.org/gateway/token.wsdl', array('encoding' => 'UTF-8'));
$result = $client->TokenGenerator([
'api_key' => $Api_Key,
'amount' => $Amount,
'order_id' => $Order_ID,
'callback_uri' => $Callback,
]);
$result = $result->TokenGeneratorResult;
if ($result->code == -1) {
header( 'Location: https://api.nextpay.org/gateway/payment/' . $result->trans_id) ;
}else{
print "Error Code: " . $result->code ;
}
}
/* End of file pay.php */