-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathExecutePayment.php
42 lines (34 loc) · 965 Bytes
/
ExecutePayment.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
<?php
require_once dirname(__FILE__) . "/backend/paypaldb.php";
$paypal = new PayPalDB();
if(isset($_GET['success'])) {
if(isset($_GET['token'])) {
$token = $_GET['token'];
} else {
redirect();
}
if($_GET['success'] == 'true') {
if(isset($_GET['paymentId']) && isset($_GET['PayerID']) && isset($_GET['token']))
{
$paymentId = $_GET['paymentId'];
$payerId = $_GET['PayerID'];
$token = $_GET['token'];
$paypal = new PayPalDB();
$paypal->paymentSuccess($paymentId, $payerId, $token);
//TODO: redirect to thankyou-page
redirect('#Danke');
exit(0);
} else {
echo "Missing Parameters..";
exit(1);
}
} else {
$paypal->cancelPayment($token);
redirect('#Anmeldung');
}
}
redirect();
function redirect($param) {
header('Location: /'.$param);
exit();
}