即将测试PayPal的基本框架 - 加载2按钮:按PayPal付款,并通过信用或借记卡付款。 除了在iPad Air上iOS 12.5.7(我可以在此设备上安装的最佳版本)外,在我测试过的每个设备上工作正常。 带有VER的较新的iPhone。 18工作正常
出于某种原因,当我通过信用卡或借记卡按钮单击付款时,它显示了Circle Spinner(加载信用/借记表单字段),但随后在控制台日志中出现错误:意外令牌“?”和参考错误找不到变量Zombo。如果我点击PayPal的付款,它可以正常工作,只是信用/借记选项失败。 在MacBook Safari上尝试,它的工作正常。 Windows各种浏览器正常工作。
在此上找不到任何东西。 有解决方法吗? 尝试了很多事情,什么都没有用。代码进行测试:
<!-- PayPal SDK with 'components' parameter to show Credit/Debit option -->
<script src='https://www.paypal.com/sdk/js?client-id=12345&components=buttons¤cy=CAD'></script>
<script src="https://ajax.googleapis.com/ajax/libs/jquery/3.6.0/jquery.min.js"></script>
<!-- Container for PayPal button -->
<div id="paypal_container"></div>
<script type="text/javascript">
$(function() {
// Define the PayPal button with integrated Credit/Debit card option
paypal.Buttons({
style: {
shape: 'rect',
color: 'gold',
layout: 'vertical',
label: 'pay', // This label will be shown on the button
},
createOrder: function (data, actions) {
// Set up the order details here (amount, currency, etc.)
return actions.order.create({
intent: "CAPTURE",
purchase_units: [{
amount: {
currency_code: "CAD",
value: "100.00" // Replace with your actual value
}
}]
});
},
onApprove: function (data, actions) {
// Capture the payment when the user approves it
return actions.order.capture().then(function (details) {
alert("Payment successful! Thank you, " + details.payer.name.given_name);
});
},
onError: function (err) {
// Handle any errors during the payment process
console.error("Payment error:", err);
alert("There was an issue processing your payment.");
}
}).render('#paypal_container'); // Render the button inside the container div
});
</script>
this this Works:
改变信用/借记按钮的“旧版本”
onShippingChange: function(data,actions){
//if not needed do nothing..
return actions.resolve();
},