PayPal Payment (via HTML button) not always going through

bezalelk
Contributor
Contributor

Hi,

 

I am accepting payments on my Wix site using HTML (element) code for the PayPal button and payment (code below). After the payment, the HTML code send a message to the page, and when the page gets it, I execute custom code that displays a unique message.

Lately the users have been notifying me that after they put all the info in, the PayPal popup closes and nothing happens.

I look on my PayPal account (business account) and I dont see the payment, but I do see the API call.

 

Does someone know why this happens and how I can fix this?

 

TIA,

 

 

<head>
<meta name="viewport" content="width=device-width, initial-scale=1"> <!-- Ensures optimal rendering on mobile devices. -->
<meta http-equiv="X-UA-Compatible" content="IE=edge" /> <!-- Optimal Internet Explorer compatibility -->
<script src="https://www.paypalobjects.com/api/checkout.js"></script>
</head>

<body>

<div id="paypal-button-container"></div>
<script>
paypal.Button.render({
env: 'production', // sandbox | production
client: {
sandbox: '<Sandbox client-ID>',
production: '<Production client-ID>'
},
commit: true, // Optional: show a 'Pay Now' button in the checkout flow
payment: function (data, actions) {
return actions.payment.create({
payment: {
transactions: [
{
amount: {
total: '9.99',
currency: 'USD'
}
}
]
}
});
},
onApprove: function (data, actions) {
// Get the payment details
return actions.order.capture()
.then(function (details) {
// Show a success page to the buyer
window.parent.postMessage("Payment Approved", "https://wpcjerusalem.wixsite.com/wpcjerusalem/register-for-rental");
});
},
onCancel: function(data, actions) {
// Show a cancel page, or return to cart
},
// --------- onError ---
onError: function(err) {
// Show an error page
console.log()('PayPal: An error has occurred! ');
}
}, '#paypal-button-container');
</script>
</body>

 

 

Login to Me Too
0 REPLIES 0

Haven't Found your Answer?

It happens. Hit the "Login to Ask the community" button to create a question for the PayPal community.