【问题标题】:What is a simple, minimal example of a JSON payment paypal definition?什么是 JSON 支付 paypal 定义的简单、最小示例?
【发布时间】:2018-03-11 07:07:45
【问题描述】:

我正在寻找一个简单的 JSON 示例,用于捐赠的 paypal 定义。 PayPal 文档中似乎没有涵盖这一点。它需要一个简单的参数来指定付款的特定日期,并且需要一个选项让它每年在这个日期重复。我尝试了以下方法,但它不允许付款日期或重复。需要添加什么?

var create_payment_json = {
    "intent": "sale",
    "payer": {
        "payment_method": "paypal"
    },
    "redirect_urls": {
        "return_url": "http://return.url",
        "cancel_url": "http://cancel.url"
    },
    "transactions": [{
        "item_list": {
            "items": [{
                "name": "item",
                "sku": "item",
                "price": "1.00",
                "currency": "USD",
                "quantity": 1
            }]
        },
        "amount": {
            "currency": "USD",
            "total": "1.00"
        },
        "description": "This is the payment description."
    }]
};

谢谢

【问题讨论】:

    标签: javascript json node.js paypal payment


    【解决方案1】:

    您可以在 Paypal official documentation 中找到与 Json 一起的不错示例。

    以下是基于官方PayPal payment page的示例。

    curl -v -X POST https://api.sandbox.paypal.com/v1/payments/payment \
    -H "Content-Type:application/json" \
    -H "Authorization: Bearer Access-Token" \
    -d '{
      "intent": "sale",
      "payer": {
        "payment_method": "paypal"
      },
      "transactions": [
        {
          "amount": {
            "total": "30.11",
            "currency": "USD",
            "details": {
              "subtotal": "30.00",
              "tax": "0.07",
              "shipping": "0.03",
              "handling_fee": "1.00",
              "shipping_discount": "-1.00",
              "insurance": "0.01"
            }
          },
          "description": "This is the payment transaction description.",
          "custom": "EBAY_EMS_SOMENUMBER",
          "invoice_number": "INV000001",
          "payment_options": {
            "allowed_payment_method": "INSTANT_FUNDING_SOURCE"
          },
          "soft_descriptor": "ECHI5786786",
          "item_list": {
            "items": [
              {
                "name": "dontation",
                "description": "dontation",
                "quantity": "1",
                "price": "10",
                "tax": "0.00",
                "sku": "1",
                "currency": "USD"
              }
            ]
          }
        }
      ],
      "note_to_payer": "Thankyour for your donation.",
      "redirect_urls": {
        "return_url": "https://example.com",
        "cancel_url": "https://example.com"
      }
    }
    

    【讨论】:

    • 这不涉及循环或特定日期,这是我找不到的
    【解决方案2】:

    没有这样的参数来控制付款是重复还是在以后的某个时间被捕获或收费

    为了实现 Stripe 中的可能性,您需要采取不同的工作方式。

    对于定期结算

    对于later capture

    • 创建授权类型的支付
    • 存储响应中返回的捕获 URL

      请注意捕获 URL 会存在一段时间。如果在该时间段内未捕获付款,则可以通过重新授权付款来刷新此捕获 url 一次。

      遗憾的是,Paypal 没有提供 API 来在以后自动捕获付款,您可以像 Stripe 那样指定它。您有责任确保这一点。

      但是,存在扩展 Paypal 以提供此功能的服务集成,请参阅 Braintree Vault for Paypal)。

    【讨论】:

      猜你喜欢
      • 2011-10-12
      • 2016-12-09
      • 2012-04-12
      • 2011-01-31
      • 2015-10-31
      • 1970-01-01
      • 2016-03-04
      • 2013-05-07
      • 2011-04-26
      相关资源
      最近更新 更多