-
Notifications
You must be signed in to change notification settings - Fork 2
Expand file tree
/
Copy pathpay.php
More file actions
153 lines (134 loc) · 4.41 KB
/
Copy pathpay.php
File metadata and controls
153 lines (134 loc) · 4.41 KB
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
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
<?php
?><head>
<!-- Required meta tags -->
<meta charset="utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1, shrink-to-fit=no">
<title>Snap It Out</title>
<link rel="icon" href="img/favicon.png">
<!-- Bootstrap CSS -->
<link rel="stylesheet" href="css/bootstrap.min.css">
<!-- animate CSS -->
<link rel="stylesheet" href="css/animate.css">
<!-- owl carousel CSS -->
<link rel="stylesheet" href="css/owl.carousel.min.css">
<!-- font awesome CSS -->
<link rel="stylesheet" href="css/all.css">
<!-- flaticon CSS -->
<link rel="stylesheet" href="css/flaticon.css">
<link rel="stylesheet" href="css/themify-icons.css">
<!-- font awesome CSS -->
<link rel="stylesheet" href="css/magnific-popup.css">
<!-- swiper CSS -->
<link rel="stylesheet" href="css/slick.css">
<!-- style CSS -->
<link rel="stylesheet" href="css/style.css">
<style>
/* For mobile phones: */
.col-lg-7{
flex: 0 0 100%;
max-width: 100%;
}
.wrapper {
width: 42%;
}
.d-block{
padding: 0px;
padding-top: 15px;
padding-bottom: 15px;
}
@media only screen and (min-width: 768px) {
.wrapper {
width: 85%;
}
.col-lg-7{
flex: 0 0 50.333333%;
max-width: 50.333333%;
}
.d-block{padding: 100px}
}
</style>
</head>
<body>
<!--::header part start::-->
<header class="main_menu home_menu">
<div class="container">
<div class="row align-items-center justify-content-center">
<div class="col-lg-12">
<nav class="navbar navbar-expand-lg navbar-light">
<a class="navbar-brand" href="index.php" > <img src="img/logo.png" alt="logo" > </a>
<button class="navbar-toggler" type="button" data-toggle="collapse"
data-target="#navbarSupportedContent" aria-controls="navbarSupportedContent"
aria-expanded="false" aria-label="Toggle navigation">
<span class="menu_icon"><i class="fas fa-bars"></i></span>
</button>
<div class="collapse navbar-collapse main-menu-item" id="navbarSupportedContent">
</div>
</nav>
</div>
</div>
</div>
</header>
<!-- Header part end-->
<!-- breadcrumb part start-->
<section class="breadcrumb_part" style="height: 130px;">
<div class="container">
<div class="row">
<div class="col-lg-12">
<div class="breadcrumb_iner">
<h2>Payment Gateway</h2>
</div>
</div>
</div>
</div>
</section>
<!-- breadcrumb part end-->
<?php
require('pconfig.php');
require('razorpay-php/Razorpay.php');
session_start();
use Razorpay\Api\Api;
$api = new Api($keyId, $keySecret);
$orderData = [
'receipt' => 3456,
'amount' => $_POST['amount'] * 100,
'currency' => $_POST['currency'],
'payment_capture' => 1
];
$razorpayOrder = $api->order->create($orderData);
$razorpayOrderId = $razorpayOrder['id'];
$_SESSION['razorpay_order_id'] = $razorpayOrderId;
$displayAmount = $amount = $orderData['amount'];
if ($displayCurrency !== 'INR') {
$url = "https://api.fixer.io/latest?symbols=$displayCurrency&base=INR";
$exchange = json_decode(file_get_contents($url), true);
$displayAmount = $exchange['rates'][$displayCurrency] * $amount / 100;
}
$data = [
"key" => $keyId,
"amount" => $amount,
"name" => $_POST['item_name'],
"description" => $_POST['item_description'],
"image" => "",
"prefill" => [
"name" => $_POST['cust_name'],
"email" => $_POST['email'],
"contact" => $_POST['contact'],
],
"notes" => [
"address" => $_POST['address'],
"merchant_order_id" => $_SESSION['id'].$_SESSION['name'],
],
"theme" => [
"color" => "#F37254"
],
"order_id" => $razorpayOrderId,
];
if ($displayCurrency !== 'INR')
{
$data['display_currency'] = $displayCurrency;
$data['display_amount'] = $displayAmount;
}
$json = json_encode($data);
require("checkout/manual.php");
?>
</div>