什么是JSON支付贝宝定义的简单,最小的例子?

我正在寻找一个简单的JSON示例的捐赠的贝宝定义。 这似乎没有在贝宝文档中介绍。 它需要一个简单的参数来指定付款的具体date,以及每年在这个date重复使用的选项。 我已经尝试了以下,但它不允许付款date或重复。 需要添加什么?

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

谢谢

没有这样的参数来控制支付是否反复发生,或者将来以这种方式在以后的时间被捕获或收取

为了达到Stripe中可能的外观,你需要工作不同。

对于定期结算

  • 创build一个以定期付款为特色的计费计划 。
  • 为客户创build一个计费协议。 执行此协议会使循环计费stream程处于运行状态。

为了以后捕获

  • 创build一个types授权的支付
  • 存储响应中返回的捕获URL

    请注意,捕获url在一段时间内是有效的。 如果在该段时间内没有获取付款,则可以通过重新授权付款来刷新该捕获url一次。

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

    但是,有服务集成扩展了PayPal来提供这种function, 请参阅Braintree Vault for Paypal )。

您可以在PayPal官方文档中find与Json一起的体面示例。

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