Warning: file_get_contents(/data/phpspider/zhask/data//catemap/9/javascript/374.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Javascript 什么是JSON支付paypal定义的简单、最小示例?_Javascript_Json_Node.js_Paypal_Payment - Fatal编程技术网

Javascript 什么是JSON支付paypal定义的简单、最小示例?

Javascript 什么是JSON支付paypal定义的简单、最小示例?,javascript,json,node.js,paypal,payment,Javascript,Json,Node.js,Paypal,Payment,我正在寻找一个简单的JSON示例,用于捐款的paypal定义。PayPal文档中似乎没有涵盖这一点。它需要一个简单的参数,用于支付的特定日期,以及在该日期每年重复出现的选项。我尝试了以下方法,但它不允许付款日期或重复。需要补充什么 var create_payment_json = { "intent": "sale", "payer": { "payment_method": "paypal" }, "redirect_urls": {

我正在寻找一个简单的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."
    }]
};

谢谢

您可以在中找到与Json一起的好例子

以下是基于官方数据的示例


没有这样的参数来控制付款是重复发生的,还是以后会以这种方式捕获或收取费用

为了在Stripe中实现可能的外观,您需要进行不同的工作

用于定期计费

  • 根据该计费计划为客户创建计费协议。设置正在运行的定期计费过程
对于

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

    请注意此捕获URL在特定时间段内处于活动状态。如果在该时间段内未捕获付款,则通过重新授权付款,此捕获url仅可刷新一次

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

    但是,有一些服务集成扩展了Paypal以提供此功能,请参阅)


这不涉及定期或特定日期,这是我找不到的
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"
  }
}