首页 > 解决方案 > Paypal Checkout Button 未将自定义文件传递给 IPN 消息

问题描述

我正在我的网站上更新 PayPal 系统,用新的 PayPal Checkout 替换旧的 PayPal 按钮,并且在尝试将自定义字段从按钮脚本传递到 IPN 消息时遇到问题,该消息用于使用客户的付款更新我的数据库:我收到了包含所有权限 $_POST 字段/值的 IPN 消息,但始终保持为空的 $_POST['custom'] 字段除外。我正在使用沙盒商家和客户帐户,这是我的按钮代码:

<script src='https://www.paypal.com/sdk/js?client-id=xxxxx&currency=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> 

标签: paypalpaypal-sandboxpaypal-ipnpaypal-adaptive-paymentsexpress-checkout

解决方案


替换为custom_id, 如购买单元的Checkout Orders API 参考中所述

custom将被忽略


推荐阅读