我一直在尝试通过使用Paypal结帐方法来结帐
<div id="paypal-button-container"></div>
并首次正常运行,但现在出现了
{name: "UNSUPPORTED_MEDIA_TYPE", message: "The request payload is not supported",…}
debug_id: "cabbf1f81533"
details: []
links: []
message: "The request payload is not supported"
name: "UNSUPPORTED_MEDIA_TYPE"'
这是我正在使用的脚本:
<script>
$(document).ready(function(){
var courseid="<?=$model->id ?>";
var coursecharges="<?=$model->fee ?>";
var coursefee=parseFloat(coursecharges).toFixed(2)
// Render the PayPal button into #paypal-button-container
const baseOrderAmount ="<?=$model->fee ?>";
paypal.Buttons({
// Set up the transaction
createOrder: function(data, actions) {
return actions.order.create({
purchase_units: [{
amount: {
value: "<?=$model->fee ?>"
}
}]
});
},
// Finalize the transaction
onApprove: function(data, actions) {
return actions.order.capture().then(function(details) {
// Show a success message to the buyer
alert('done');
console.log(details);
});
}
}).render('#paypal-button-container');
});
</script>
请帮我解决此问题。
答案 0 :(得分:0)
在“捕获”呼叫中,我得到相同的结果:https://www.sandbox.paypal.com/v2/checkout/orders/EC-xxxxxxx/capture
paypal.Buttons({
createOrder: function () {
var result = createPaypalOrder(); // Create order with php SDK
return result['id']; // EC-xxxxxxx
}
}).render('#buttonToPay');
我看到带有付款方式的弹出窗口。我点击确认按钮。弹出窗口关闭并执行http调用,返回415错误
对“捕获” URL的调用是由贝宝完成的,那么如何正确设置媒体类型?
这个Paypal UNSUPPORTED_MEDIA_TYPE似乎是没有sdk的通话。