-
Notifications
You must be signed in to change notification settings - Fork 0
/
logik.js
52 lines (43 loc) · 1.77 KB
/
logik.js
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
function produktzeigen(nr) {
if(nr === 1) {
document.getElementById("schuh").style.display = "none";
document.getElementById("tshirt").style.display = "block";
}
if(nr === 2) {
document.getElementById("schuh").style.display = "block";
document.getElementById("tshirt").style.display = "none";
}
}
function initPayPalButton() {
paypal.Buttons({
style: {
shape: 'pill',
color: 'blue',
layout: 'vertical',
label: 'paypal',
},
createOrder: function(data, actions) {
return actions.order.create({
purchase_units: [{"description":"Schuh","amount":{"currency_code":"EUR","value":10}}]
});
},
onApprove: function(data, actions) {
return actions.order.capture().then(function(orderData) {
// Full available details
console.log('Capture result', orderData, JSON.stringify(orderData, null, 2));
// Show a success message within this page, e.g.
const element = document.getElementById('paypal-button-tshirt');
element.innerHTML = '';
element.innerHTML = '<h3>Thank you for your payment!</h3>';
const xhttp = new XMLHttpRequest();
xhttp.open("GET", "testphp.php");
xhttp.send();
// Or go to another URL: actions.redirect('thank_you.html');
});
},
onError: function(err) {
console.log(err);
}
}).render('#paypal-button-tshirt');
}
initPayPalButton();