paypal.Buttons({
createOrder: function(data, actions) {
// This function sets up the details of the transaction, including the amount and line item details.
return actions.order.create({
purchase_units: [{
amount: {
value: "<?php echo($_SESSION["total_price"]); ?>"
}
}]
});
},
onApprove: function(data, actions) {
// This function captures the funds from the transaction.
return actions.order.capture().then(function(details) {
// This function shows a transaction success message to your buyer.
alert('Transaction completed by ' + details.payer.name.given_name);
});
}
}).render('.Paypal');
该按钮在页面重新加载时呈现,但在首次访问该页面时显示 NOT 。
value: "<?php echo($_SESSION["total_price"]); ?>"
我觉得PHP代码在呈现之前就没有到达目的地,从而导致错误
有什么想法吗?
非常感谢帮助