-
Notifications
You must be signed in to change notification settings - Fork 2
/
Copy pathstep2_checkout_start.php
59 lines (49 loc) · 1.5 KB
/
step2_checkout_start.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
<?php
/*
* This file provides an example about how to start Aplazame checkout
*
* NOTE: Contents of this file are displayed on customer browser. USE THE PUBLIC KEY (not the private key)
*/
/*
* Aplazame's PUBLIC key.
* You can find your keys on your Aplazame's control panel (https://vendors.aplazame.com/)
*/
$publicKey = '<aplazame PUBLIC API key>';
/*
* Enable test mode (`Aplazame\Api\Client::ENVIRONMENT_SANDBOX`) or
* production mode (`Aplazame\Api\Client::ENVIRONMENT_PRODUCTION`)
*/
$environment = Aplazame\Api\Client::ENVIRONMENT_SANDBOX;
/*
* Use the ID generated by Aplazame at step1
*/
$aplazameCheckoutId = '<checkout id from step1>'
?>
<html>
<head>
<script
src="https://aplazame.com/static/aplazame.js"
data-aplazame="<?php echo $publicKey; ?>"
data-sandbox="<?php echo ($environment === Aplazame\Api\Client::ENVIRONMENT_SANDBOX) ? 'true' : 'false'; ?>"
></script>
</head>
<body>
<h1>
Aplazame checkout
</h1>
<!-- This fragment is for to assist you about to debug issues. Don't deploy to production! -->
<script>
var display_error = function (event) {
var error_container = document.getElementById("error_container");
console.error(event);
error_container.innerHTML = event.message
};
window.addEventListener('error', display_error);
</script>
<div id="error_container" style="color: red;"></div>
<!-- End fragment -->
<script>
aplazame.checkout("<?php echo $aplazameCheckoutId; ?>")
</script>
</body>
</html>