Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
16 changes: 5 additions & 11 deletions standard-integration/public/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -12,9 +12,9 @@
paypal
.Buttons({
// Sets up the transaction when a payment button is clicked
createOrder: function () {
createOrder() {
return fetch("/my-server/create-paypal-order", {
method: "post",
method: "POST",
headers: {
"Content-Type": "application/json",
},
Expand All @@ -33,9 +33,9 @@
.then((order) => order.id);
},
// Finalize the transaction after payer approval
onApprove: function (data) {
onApprove(data) {
return fetch("/my-server/capture-paypal-order", {
method: "post",
method: "POST",
headers: {
"Content-Type": "application/json",
},
Expand All @@ -52,13 +52,7 @@
JSON.stringify(orderData, null, 2)
);
const transaction = orderData.purchase_units[0].payments.captures[0];
alert(
"Transaction " +
transaction.status +
": " +
transaction.id +
"\n\nSee console for all available details"
);
alert(`Transaction ${transaction.status}: ${transaction.id}\n\nSee console for all available details`);
// When ready to go live, remove the alert and show a success message within this page. For example:
// var element = document.getElementById('paypal-button-container');
// element.innerHTML = '<h3>Thank you for your payment!</h3>';
Expand Down