<div id="paypal-express-cart-payments"></div> <script> paypal.Buttons({ style: { label: 'checkout', tagline: false, size: 'responsive', height:55, layout: 'horizontal', }, commit: true, env: 'production', onClick: () => {}, createOrder: async function() { LoadingMask(true); return fetch('/modules/paypal/api/?mod=order-create&express_checkout=cart', { method: 'post', body: '', headers: { 'content-type': 'application/json' } }).then(function(res) { return res.json(); }).then(function(data) { return data.id; }).finally(function() { LoadingMask(false); }); }, onApprove: function(data, actions) { LoadingMask(true); return actions.order.get().then(function(orderDetails) { return fetch( '/modules/paypal/api/?mod=expresscart-callback&express_checkout=cart&token=' + orderDetails.id, { method: 'GET', headers: { 'content-type': 'application/json' } }).then(function(res) { return res.json(); }).then(function(data) { if (data.redirect) { setTimeout(function() { LoadingMask(true); }, 100); window.location.href = data.redirect; } else { // 兜底:仍跳 /checkout 让客户继续付款(带 token 走 PayPal session 恢复) console.error('No redirect URL received'); window.location.href = '/checkout?express_checkout=cart&token=' + encodeURIComponent(orderDetails.id); } }).catch(function(error) { // fetch 中断/超时 — 直接跳 /checkout,避免客户停在 cart 页重复点击 console.error('Error processing payment:', error); window.location.href = '/checkout?express_checkout=cart&token=' + encodeURIComponent(orderDetails.id); }); }) }, onCancel: function(data) { console.log(data); }, onError: function(err) { console.log(err); } }).render('#paypal-express-cart-payments'); </script>

SIGN IN

Register Account

By creating an account you will be able to shop faster, be up to date on an order's status, and keep track of the orders you have previously made.