-
Notifications
You must be signed in to change notification settings - Fork 1
/
payment.php
136 lines (57 loc) · 2.29 KB
/
payment.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
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
<!DOCTYPE HTML>
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<title>
Processing
</title>
</head>
<body>
<center>
<img src="http://www.gwcpgh.org/images/logo.jpg">
<p>Processing...</p>
</center>
<form action="https://globalgatewaye4.firstdata.com/pay" method="POST" name="myForm" id="myForm">
<?php
$x_amount = $_POST["x_amount"];
$x_user1 = $_POST["x_user1"];
$x_user2 = $_POST["x_user2"];
$x_user3 = $_POST["x_user3"];
// Take x_login from Payment Page ID in Payment Pages interface
// Take transaction_key from Payment Pages configuration interface
switch ($x_amount) {
case 10:
$x_login="WSP-SUSTA-ordy5QAxqw";
$transaction_key = "u7f8uX0mnJvWSVRf~YDa";
break;
case 25:
$x_login="WSP-SUSTA-6Ep7kwAxrA";
$transaction_key = "~oS~uDWd8uH75uWXEFef";
break;
case 35:
$x_login="WSP-SUSTA-raM6tAAxrg";
$transaction_key = "BffNUCFePVjvv0mmLD1p";
break;
}
$x_currency_code = "USD"; // Needs to agree with the currency of the payment page
srand(time()); // initialize random generator for x_fp_sequence
$x_fp_sequence = rand(1000, 100000) + 123456;
$x_fp_timestamp = time(); // needs to be in UTC. Make sure webserver produces UTC
// The values that contribute to x_fp_hash
$hmac_data = $x_login . "^" . $x_fp_sequence . "^" . $x_fp_timestamp . "^" . $x_amount . "^" . $x_currency_code;
$x_fp_hash = hash_hmac('MD5', $hmac_data, $transaction_key);
echo ('<input name="x_login" value="' . $x_login . '" type="hidden">' );
echo ('<input name="x_amount" value="' . $x_amount . '" type="hidden">' );
echo ('<input name="x_fp_sequence" value="' . $x_fp_sequence . '" type="hidden">' );
echo ('<input name="x_fp_timestamp" value="' . $x_fp_timestamp . '" type="hidden">' );
echo ('<input name="x_fp_hash" value="' . $x_fp_hash . '" size="50" type="hidden">' );
echo ('<input name="x_currency_code" value="' . $x_currency_code . '" type="hidden">');
echo ('<input name="x_user1" value="' . $x_user1 . '" type="hidden">');
echo ('<input name="x_user2" value="' . $x_user2 . '" type="hidden">');
echo ('<input name="x_user3" value="' . $x_user3 . '" type="hidden">');
?>
<input type="hidden" name="x_show_form" value="PAYMENT_FORM"/>
</form>
<script type='text/javascript'>document.myForm.submit();</script>
</body>
</html>