我正在我的网站中集成智能支付按钮,在它正常工作之前,但今天早些时候,我收到了这些错误
我什至在加载文件中的paypal.Buttons().render()函数之前加载了 paypal SDKpaypal.js
<script src="https://www.paypal.com/sdk/js?client-id=<MY_CLIENT_ID_HERE>¤cy=PHP"></script>
<script type="text/javascript" src="paypal.js"></script>
这是我paypal.js文件的内容
paypal.Buttons({
createOrder : function(data, actions){
return actions.order.create({
purchase_units : [{
amount : {
value : amount_to_pay
}
}],
application_context: {
shipping_preference: "NO_SHIPPING",
},
country_code : "PH"
})
},
style: {
color: 'gold',
shape: 'rect',
label: 'buynow',
size: 'responsive',
branding: true
},
onApprove: function(data, actions) {
// Capture the funds from the transaction
return actions.order.capture().then(function(details) {
return fetch('/pay-with-pp', {
method: 'post',
headers: {
'content-type': 'application/json'
},
body: JSON.stringify({
orderID: data.orderID,
product_id : product_id,
_token : token
})
}).then(function(res){
alert('Payment has been made! Please see the delivery status on orders page!');
window.location.href = redirect_url
});
});
},
}).render('#paypal-button-container');
慕侠2389804