【问题标题】:Create PayPal Payment to account through email in order form通过电子邮件在订单中创建 PayPal 付款到帐户
【发布时间】:2021-07-14 05:17:23
【问题描述】:

目前,我将 paypal-rest-api 用于 node.js 并使用 paypal.payment.create()。但是,为此,卖家需要有一个企业帐户,因为您需要在开发者页面上输入来自应用程序的令牌和 Id。

我在其他方法中看到卖家使用他们的电子邮件让客户通过订单/付款方式付款 - 而不是使用令牌和 ID。


为了进一步阐述,目前我必须使用

var paypal = require('paypal-rest-sdk');
paypal.configure({
    'mode': 'live', //sandbox or live
    'client_id': 'CLIENT_ID',
    'client_secret': 'CLIENT_SECRET'
});

但是,在使用的 json 对象中,有一种方法可以让帐户电子邮件付款。例如

var create_payment_json = {
    "intent": "sale",
    "business": "myemail@gmail.com",
    "payer": {
        "payment_method": "paypal"
    },
    "redirect_urls": {
        "return_url": `return`,
        "cancel_url": `cancel`
    },
    "transactions": [{
        "item_list": {
            "items": itemsList
        },
        "amount": {
            "currency": "USD",
            "total": total.toFixed(2),
            "details": {
                "subtotal": subPrice.toFixed(2).toString(),
                "tax": "0.00",
                "shipping": "0.00",
                "discount": sortedDiscount.toFixed(2),
            }
        },
        "description": `Store payment.`
    }]
};

提前致谢。

【问题讨论】:

    标签: node.js npm paypal paypal-rest-sdk


    【解决方案1】:

    使用您自己的凭据并在请求中指定 payee,如下所述:https://developer.paypal.com/docs/checkout/integration-features/pay-another-account/

    由于您使用的是已弃用的 PayPal-Node-SDK 和已弃用的 v1/payments API,因此参数名称将为 transactions[0]->payee,如 API 参考中所示:https://developer.paypal.com/docs/api/payments/v1/#definition-transaction

    (对于新的集成,您应该使用当前的 Checkout-NodeJS-SDK 和 v2/checkout/orders API)

    【讨论】:

    • 您好,谢谢您的回复。但是,这是否允许我不必指定 CLEINT 信息而只需使用电子邮件?
    • 我没有完全指定帖子的那部分。很难用某种方式解释
    • 要在创建付款或订单时指定不同的收款人,请将收款人对象添加到交易负载中,并包含用于接收付款的帐户的 email_address 或商家 ID。
    • 了解,但这是否允许我在paypal.configure 中不指定'client_id': 'CLIENT_ID','client_secret': 'CLIENT_SECRET'。正在寻找解决方案,因为我无法在没有企业帐户的情况下创建应用程序。
    • 使用您自己的凭据。如果您的帐户不是业务类型,请升级它。
    猜你喜欢
    • 2018-07-27
    • 2017-05-22
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2012-04-15
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多