Hi, I've integrated the Smart Payment Buttons in my website. All the payment procedure goes ok, but sometimes it gives an Error while the transaction is processed correctly by PayPal. the /paypal_transaction_check/ function get the response and make a check if $data['data']['status'] from the PayPal response si "COMPLETED". Sometimes the page goes in /checkout/payment_error but the transaction si successful passing "COMPLETED" in the response. It happens also on live environments and only on some cases Can be a Timeout error ? here is the client code paypal.Buttons({ style: { layout: 'vertical', color: 'gold', shape: 'rect', label: 'pay', tagline: false }, createOrder: function(data, actions) { // Set up the transaction return actions.order.create({ application_context:{ brand_name: 'Test Store', locale:'it-IT', shipping_preference:'NO_SHIPPING', user_action:'PAY_NOW' }, intent: "CAPTURE", purchase_units: [{ reference_id: '<?= $order_reference_id ?>', description: 'Cool item', custom_id:'<?= $order_reference_id ?>', amount: { currency_code: 'EUR', value: '99.00' } }], }); }, onApprove: function(data, actions) { // Capture the funds from the transaction $('#paypal-button-container').hide(); $('#payment-wait').show(); return actions.order.capture().then(function(details) { fetch('/paypal_transaction_check/', { method: 'post', headers: { 'content-type': 'application/json' }, body: JSON.stringify({ data: details, order_id: '100100100' }) }).then(response => { if(response.status == 200) { window.location.href = "/checkout/paypal_success/<?= $order_reference_id ?>"; } else { window.location.href = "/checkout/payment_error"; } }); }); }, onCancel: function (data) { // Show a cancel page, or return to cart window.location.href = "/checkout/payment"; }, onError: function (err) { window.location.href = "/checkout/payment_error"; } }).render('#paypal-button-container');
... View more