简体   繁体   English

使用 REST API 进行 PayPal 批量支付

[英]PayPal mass payment with REST API

Is there a way to execute a mass payment from the application to several other accounts by e-mail addresses using the new REST API?有没有办法使用新的 REST API 通过电子邮件地址从应用程序向其他几个帐户执行批量付款? I can do this with Classic API, but am not sure how to achieve the same with REST API.我可以用 Classic API 做到这一点,但我不确定如何用 REST API 实现同样的效果。

I am working with PayPal SDK for C#.我正在使用 PayPal SDK for C#。

I have found this related post: Paypal REST API Adaptive / Multiple Payments (change payee) .我找到了这个相关的帖子: Paypal REST API Adaptive / Multiple Payments (change payee) However, some code samples would be nice.但是,一些代码示例会很好。

The PayPal C# SDK does not currently allow making these calls (11.11.2013.). PayPal C# SDK 当前不允许进行这些调用 (11.11.2013.)。 The API itself has the functionality that allows setting the payee for the payment, however this functionality is still incomplete as the PayPal REST API is in beta. API 本身具有允许设置付款收款人的功能,但是由于 PayPal REST API 处于测试阶段,因此该功能仍然不完整。

Usage of PayPal Classic API is advised here as it is stable and tested.此处建议使用 PayPal Classic API,因为它稳定且经过测试。

PayPal just made a REST version of Payouts available. PayPal 刚刚提供了一个 REST 版本的 Payouts。 Here is the Payouts Overview. 是付款概览。

To get access:要获得访问权限:

  • Go to your dashboard.转到您的仪表板。
  • Go to My account .转到我的帐户
  • Find the Payouts capability and click Get Started .找到Payouts 功能并点击Get Started

This is Jason, the developer of the PayPal .NET SDK on GitHub.这是 GitHub 上PayPal .NET SDK的开发者 Jason。 Payouts API support (formerly known as Mass Payments) is now available in version 1.2 of the PayPal .NET SDK. Payouts API支持(以前称为 Mass Payments)现在在 PayPal .NET SDK 的1.2版中可用。 You can get the SDK binaries by downloading them directly from GitHub or using NuGet .您可以通过直接从GitHub下载或使用NuGet来获取 SDK 二进制文件。

There's also a Samples project included with the SDK on GitHub that shows how to create batch payouts as well as retrieve the details of a batch payout or individual payout item . GitHub 上的 SDK 中还包含一个Samples 项目,该项目展示了如何创建批量付款以及检索批量付款单个付款项目的详细信息

If there's a use case that isn't in the samples and you'd like to have added, feel free to open an issue on GitHub with a description of the use case or send a pull request, and I'd be more than happy to get it added.如果有一个用例不在示例中并且您想添加,请随时在 GitHub 上打开一个带有用例描述的问题或发送拉取请求,我会非常高兴添加它。 :) :)

As per the latest version of REST API here are the details根据最新版本的 REST API,这里是详细信息

Doc Link: https://developer.paypal.com/docs/api/payments.payouts-batch/v1/#payouts_post文档链接: https : //developer.paypal.com/docs/api/payments.payouts-batch/v1/#payouts_post

REST API [POST]: https://api.sandbox.paypal.com/v1/payments/payouts REST API [POST]: https : //api.sandbox.paypal.com/v1/payments/payouts

Body:身体:

{
  "sender_batch_header": {
    "sender_batch_id": "Payouts_2018_100007",
    "email_subject": "You have a payout!",
    "email_message": "You have received a payout! Thanks for using our service!"
  },
  "items": [
    {
      "recipient_type": "EMAIL",
      "amount": {
        "value": "9.87",
        "currency": "USD"
      },
      "note": "Thanks for your patronage!",
      "sender_item_id": "201403140001",
      "receiver": "receiver@example.com",
      "alternate_notification_method": {
        "phone": {
          "country_code": "91",
          "national_number": "9999988888"
        }
      },
      "notification_language": "fr-FR"
    }
  ]
}

Sample response:示例响应:

{
  "batch_header": {
    "sender_batch_header": {
      "sender_batch_id": "Payouts_2018_100008",
      "email_subject": "You have a payout!",
      "email_message": "You have received a payout! Thanks for using our service!"
    },
    "payout_batch_id": "5UXD2E8A7EBQJ",
    "batch_status": "PENDING"
  }
}

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM