paypal - Paypal Checkout Button 未将自定义文件传递给 IPN 消息
问题描述
我正在我的网站上更新 PayPal 系统,用新的 PayPal Checkout 替换旧的 PayPal 按钮,并且在尝试将自定义字段从按钮脚本传递到 IPN 消息时遇到问题,该消息用于使用客户的付款更新我的数据库:我收到了包含所有权限 $_POST 字段/值的 IPN 消息,但始终保持为空的 $_POST['custom'] 字段除外。我正在使用沙盒商家和客户帐户,这是我的按钮代码:
<script src='https://www.paypal.com/sdk/js?client-id=xxxxx¤cy=EUR' data-sdk-integration-source='button-factory'></script>
<script>
paypal.Buttons({
style: {
shape: 'rect',
color: 'gold',
layout: 'horizontal',
label: 'pay',
tagline: true
},
createOrder: function(data, actions) {
return actions.order.create({
purchase_units: [{
amount: {
value: '1'
},
custom: '35627187'
}]
});
},
onApprove: function(data, actions) {
return actions.order.capture().then(function(details) {
alert('Transaction completed by ' + details.payer.name.given_name + '!');
});
}
}).render('#paypal-button-container');
</script>
解决方案
替换为custom_id
, 如购买单元的Checkout Orders API 参考中所述
custom
将被忽略
推荐阅读
- javafx - 如何在combox javafx中删除边框
- sql-server - 编码(?)问题通过 pyodbc/Python3 从 SQL Server 获取二进制数据(图像类型列)
- web - 是否应该允许用户硬删除内容?
- html - 为什么 HTML 和 BODY 元素会重叠?
- html - mat-tab-group 超出父 div 宽度
- html - 页脚社交图标不会对齐
- angular - selectedIndex 不适用于多个 mat-tab-group
- javascript - Jquery“rermoveClass”不适用于弹出窗口(使用elementor wordpress完成)
- java - 无法在 Android 11 上以编程方式拍照 - 意图返回已取消状态
- api - 私有 API 也应该是 REST API?