-
Notifications
You must be signed in to change notification settings - Fork 70
/
process-a-payment-embedded.html
42 lines (40 loc) · 1.34 KB
/
process-a-payment-embedded.html
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
<!DOCTYPE html>
<html>
<head>
<title>HPP embed Demo</title>
<meta charset="UTF-8">
<style>
#targetIframe {
min-height: 600px;
min-width: 350px;
}
</style>
<script src="//ajax.googleapis.com/ajax/libs/jquery/1.12.4/jquery.min.js"></script>
<script src="./../../dist/rxp-js.js"></script>
<script>
RealexHpp.setHppUrl('https://pay.sandbox.realexpayments.com/pay');
// Enable the logger. Should be used for debugging only.
RealexHpp.setConfigItem('enableLogging', true);
window.addEventListener(RealexHpp.constants.logEventName, function(e) {
console.log(e.detail);
});
// get the HPP JSON from the server-side SDK
$(document).ready(function () {
$.getJSON("./proxy-request.php?slug=process-a-payment", function (jsonFromServerSdk) {
RealexHpp.embedded.init(
"payButtonId",
"targetIframe",
"./response.php", // merchant url
jsonFromServerSdk // form data
);
$('body').addClass('loaded');
});
});
</script>
</head>
<body>
<input type="submit" id="payButtonId" value="Checkout Now" />
<br />
<iframe id="targetIframe" style="display:none;"></iframe>
</body>
</html>