有沒有人用特定的選定模板成功創建了PayPal發票? 我似乎無法得到它的工作。PayPal REST API使用模板創建發票
已嘗試在調用中指定template_id,並嘗試將所需模板設置爲默認值。在這兩種情況下,API響應都包含所選的模板ID,但發送發票時,它不會使用所選模板(可以說因爲沒有徽標)。
這個API調用:
curl -v -X POST https://api.paypal.com/v1/invoicing/invoices/ \
-H "Content-Type:application/json" \
-H "Authorization: Bearer <Access-Token>" \
-d '{
"template_id": "TEMP-66B140465N059453G",
"items": [
{
"name": "Part E",
"quantity": 2,
"unit_price": {
"currency": "USD",
"value": "10.15"
}
}
],
"shipping_info": {
"first_name": "John",
"last_name": "Doe",
"business_name": "Not applicable",
"phone": {
"country_code": "001",
"national_number": "5039871234"
},
"address": {
"line1": "1234 Broad St.",
"city": "Portland",
"state": "OR",
"postal_code": "97216",
"country_code": "US"
}
},
"shipping_cost": {
"amount": {
"currency": "USD",
"value": "15.01"
}
},
"allow_tip": false
}'
這是響應:
"id":<Invoice ID>,
"number":"0004",
"template_id":"TEMP-66B140465N059453G",
"status":"DRAFT",
"merchant_info":{},
"shipping_info":{"first_name":"John","last_name":"Doe","business_name":"Not applicable","phone":{"country_code":"001","national_number":"5039871234"},"address":{"line1":"1234 Broad St.","city":"Portland","state":"OR","postal_code":"97216","country_code":"US"}},
"items":[{"name":"Part E","quantity":2.0,"unit_price":{"currency":"USD","value":"10.15"}}],
"invoice_date":"2017-05-30 PDT",
"shipping_cost":{"amount":{"currency":"USD","value":"15.01"}},
"tax_calculated_after_discount":false,
"tax_inclusive":false,
"total_amount":{"currency":"USD","value":"35.31"},
"metadata":{"created_date":"2017-05-30 13:35:39 PDT"},
"allow_tip":false
如果任何人有任何想法,會很高興聽到他們的聲音。
謝謝。
我試過幾乎每一個組合,並無法讓自己的模板工作。我唯一能做的其他事情就是使用模板API來獲取模板的詳細信息,然後用它來填寫發票,但只要指定要使用的模板會更容易,但要談論大量的工作。例如,電話號碼中的文檔也有很多不一致之處。有時他們是字符串,其他對象,但他們應該始終是對象。 – bvstone
有用的信息,@bvstone。感謝您讓我們知道您的測試結果。 –