2017-09-29 78 views
5

我正在寻找一个简单的JSON捐赠的贝宝定义的例子。这似乎没有涵盖在PayPal文档中。它需要一个简单的参数来指定付款的具体日期,以及每年在此日期重复使用的选项。我尝试了以下操作,但它不允许付款日期或重复发生。需要添加什么?什么是JSON支付贝宝定义的简单,最简单的例子?

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." 
    }] 
}; 

谢谢

回答

0

您可能会发现体面的例子使用JSON沿Paypal official documentation

下面是基于官方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" 
    } 
} 
+0

这不涉及定期或特定的日期,这就是我无法找到 –

1

没有这样的参数来控制付款是否反复出现或将捕获或将来在稍后的时间充电的方式。

为了达到条纹的可能性,您需要改变工作方式。

对于定期结算

对于later capture

  • 创建了一个支付类型的授权
  • 店在响应中返回的捕获URL

    请注意,这个捕获URL是活的一段时间。如果付款在该段时间内未被捕获,则通过重新授权付款,这个捕获网址可以仅刷新一次。

    可悲的是,不提供API自动捕获在以后的时间付款,你可以指定一个像条纹做的。你有责任确保。

    但是,有些服务集成可以扩展PayPal来提供此功能,请参阅Braintree Vault for Paypal)。