【问题标题】:paypal payment api doesn't work with property "payee"贝宝支付 api 不适用于财产“收款人”
【发布时间】:2018-02-09 17:36:52
【问题描述】:

我已经查看了人们一直说这个问题重复的问题,但我不知道如何用我的代码处理它。我需要一个解释。谢谢

我是 paypal API 的新手,所以我现在有点困惑。创建交易仅在我没有指定收款人属性时才有效,但是当没有指定收款人时,贝宝如何知道向谁汇款?

这是代码

$(function() {
    paypal.Button.render({
        env: 'sandbox', // Or 'sandbox'
        client: {
            sandbox:    'xxxxxx',
            production: 'xxxxxx'
        },

        commit: false, // Show a 'Pay Now' button

        payment: function(data, actions) {
            return actions.payment.create({
                payment: {
                    transactions: [
                        {
                            amount: { total: '5.00', currency: 'USD' },
                            description: "TEST",
                            payee: { email: "seller-inventory@gmail.com" }
                        }
                    ]
                }
            });
        },

        onAuthorize: function(data, actions) {
            return actions.payment.execute().then(function(payment) {
                console.log("payment", payment)
            });
        }

    }, '#paypal');
}) 

错误代码:

【问题讨论】:

标签: javascript paypal paypal-sandbox paypal-rest-sdk


【解决方案1】:

在交易对象中,您需要有包含您要出售的物品的物品列表。邮件也需要存在。

如果您不指定邮件 paypal,请将钱发送给已生成客户端 ID 密钥的人。

另外物品的金额和货币需要与金额金额和货币相匹配

试试这个(更改沙箱 id 并且收款人电子邮件需要存在于 paypal 中):

$(function() {
    paypal.Button.render({
        env: 'sandbox', // Or 'sandbox'
        client: {
            sandbox:    'yourclientid',
            production: 'xxxxxx'
        },

        commit: false, // Show a 'Pay Now' button

        payment: function(data, actions) {
            return actions.payment.create({
                payment: {
                    transactions: [
                        {
                            amount: { total: '5.00', currency: 'USD' },                                
                            payee: { email: "seller-inventory@gmail.com" },
                            item_list: {
                               items: [
                                  {
                                    name: "hat",
                                    sku: "1",
                                    price: "5.00",
                                    currency: "USD",
                                    quantity: "1",
                                    description: "Brown hat."

                                  }]}
                        }
                    ]
                }
            });
        },

        onAuthorize: function(data, actions) {
            return actions.payment.execute().then(function(payment) {
                console.log("payment", payment)
            });
        }

    }, '#paypal');
}) 

【讨论】:

    猜你喜欢
    • 2016-01-29
    • 2013-09-22
    • 2014-03-13
    • 2017-09-18
    • 2023-03-15
    • 2013-09-21
    • 2011-05-06
    • 2013-02-10
    • 2013-12-12
    相关资源
    最近更新 更多