2017-09-29 57 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)。