-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathpayment.php
More file actions
110 lines (101 loc) · 4.21 KB
/
Copy pathpayment.php
File metadata and controls
110 lines (101 loc) · 4.21 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
<?php
//Get the variables from file index.php thanks to super variable POST
$firstname = $_POST['firstname'];
$lastname = $_POST['lastname'];
$email = $_POST['email'];
$amount = $_POST['amount'];
$savecard = $_POST['savecard'];
require_once('payplug-php/lib/init.php');
require_once('config.php');
if (isset($savecard)) {
$payment = \Payplug\Payment::create(array(
'amount' => $amount*100,
'currency' => 'EUR',
'save_card' => true,
'customer' => array(
'email' => $email,
'first_name' => $firstname,
'last_name' => $lastname
),
"hosted_payment" => array(
"return_url" => 'https://lightbox.rico.solutions/return.html',
"cancel_url" => 'https://lightbox.rico.solutions/cancel.html'
),
'notification_url' => 'https://lightbox.rico.solutions/notifications.php'
));
} else {
$payment = \Payplug\Payment::create(array(
'amount' => $amount*100,
'currency' => 'EUR',
'save_card' => false,
'customer' => array(
'email' => $email,
'first_name' => $firstname,
'last_name' => $lastname
),
"hosted_payment" => array(
"return_url" => 'https://lightbox.rico.solutions/return.html',
"cancel_url" => 'https://lightbox.rico.solutions/cancel.html'
),
'notification_url' => 'https://lightbox.rico.solutions/notifications.php'
));
}
?>
<!DOCTYPE html>
<html lang="en">
<head>
<title>PayPlug lightbox example</title>
<meta charset="utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1, user-scalable=no">
<link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.5/css/bootstrap.min.css">
<link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.5/css/bootstrap-theme.min.css">
<script src="https://ajax.googleapis.com/ajax/libs/jquery/1.11.3/jquery.min.js"></script>
<script src="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.5/js/bootstrap.min.js"></script>
<link href="//netdna.bootstrapcdn.com/font-awesome/4.4.0/css/font-awesome.css" rel="stylesheet">
<link href="styles.css" rel="stylesheet">
<script type="text/javascript" src="https://api.payplug.com/js/1.0/form.js"></script>
<script type="text/javascript">
document.addEventListener('DOMContentLoaded', function() {
[].forEach.call(document.querySelectorAll("#signupForm"), function(el) {
el.addEventListener('submit', function(event) {
var payplug_url = '<?= $payment->hosted_payment->payment_url ?>';
Payplug.showPayment(payplug_url);
event.preventDefault();
})
})
})
</script>
</head>
<body>
<div class="container">
<div class="row">
<div class="col-md-6 col-md-offset-3">
<h1><i class="fa fa-cog fa-spin fa-2x fa-fw"></i><span class="sr-only">Loading...</span>PayPlug lightbox example</h1>
<hr />
<p><strong>Thank you for trying my lightbox!</strong></p>
<p><?php echo "Dear ".$firstname." ".$lastname.","; ?></p>
<p><?php echo "you will be charged ".$amount."€!<br />Please click on the button below." ?></p>
<hr />
</div>
<div class="col-md-6 col-md-offset-3">
<form action="" method="post" id="signupForm" class="formulaire" novalidate>
<p>
<button type="submit" class="btn btn-success">Try the lightbox</button>
</p>
</form>
<hr />
<p><a href="https://www.payplug.com/docs/api/apiref.html#api-testing" target="_blank">Please click here to get Test card numbers</a></p>
</div>
</div>
</div>
</body>
<br /><br /><br /><br />
<footer>
<div>
<a href="https://www.payplug.com" target="_blank">
<!--Center the image and make it responsive by the use of class="center-block img-responsive" -->
<img src="https://s3-eu-west-1.amazonaws.com/payplug-badges/en/badge_narrow.png" class="center-block img-responsive" width="240px" border="0"/>
</a>
</div>
</footer>
</html>