我正在使用Google表單來記錄不同朋友的答案。根據他們的回答,他們將收到不同的帳單。我想創建一個 Bash 腳本...
- 每 3 分鐘下載一次答案
- 檢查過去3分鐘內是否有新答案
- 計算他們的帳單
- 發送帶有 PayPal 發票的電子郵件。
我對第 4 點有疑問。我了解如何使用該email an invoice
選項直接透過電子郵件發送發票。但是,這個解決方案不允許我
- 用戶回答 Google 表單後直接自動發送發票
- 發送發票,該發票是 Google 表單答案的函數。
請注意,我可以追蹤誰使用 ID 號碼付款,這一點很重要。
我有什麼解決辦法?例如,我可以產生對應 40 個不同 URL 的大約 40 種發票,然後將 URL 傳送到我的電子郵件中嗎?
答案1
這個解決方案不是PayPal,但我認為值得分享。
您可以使用自由代理API您可以在其中透過 建立發票curl
,例如:
curl https://api.sandbox.freeagent.com/v2/invoices \
-H "Authorization: Bearer XXXXXXX" \
-H "Accept: application/xml" \
-H "Content-Type: application/json" \
-X POST \
-d '{
"invoice": {
"contact": "https://api.sandbox.freeagent.com/v2/contacts/1",
"status": "Draft",
"dated_on": "2012-08-16",
"currency": "GBP",
"exchange_rate": "1.0",
"comments": "Added by api",
"omit_header": false,
"payment_terms_in_days": 30,
"invoice_items": [
{
"description": "Test InvoiceItem",
"item_type": "Hours",
"price": "112.0",
"quantity": "1.0"
}
]
}
}'
答案2
CreateInvoice
此範例使用via建立發票貝寶發票 API:
curl -s --insecure
-H "X-PAYPAL-SECURITY-USERID: Your_API_username"
-H "X-PAYPAL-SECURITY-PASSWORD: Your_API_password"
-H "X-PAYPAL-SECURITY-SIGNATURE: Your_API_signature"
-H "X-PAYPAL-REQUEST-DATA-FORMAT: NV"
-H "X-PAYPAL-RESPONSE-DATA-FORMAT: NV"
-H "X-PAYPAL-APPLICATION-ID: Your_AppID" https://svcs.sandbox.paypal.com/Invoice/CreateInvoice
-d
"requestEnvelope.errorLanguage=en_US
&invoice.merchantEmail=merchant%40domain.com
&invoice.payerEmail=jbui-us-business2%40paypal.com
&invoice.currencyCode=USD
&invoice.itemList.item(0).name=Banana+Leaf+--+001
&invoice.itemList.item(0).description=Banana+Leaf
&invoice.itemList.item(0).quantity=1
&invoice.itemList.item(0).unitPrice=1
&invoice.itemList.item(0).taxName=Tax1
&invoice.itemList.item(0).taxRate=10.25
&invoice.paymentTerms=Net10
&invoice.logoUrl=https%3A%2F%2Fwww.example.com%2FYour_logo.jpg"
這個,會發送(SendInvoice
):
curl -s --insecure
-H "X-PAYPAL-SECURITY-USERID: Your_API_username"
-H "X-PAYPAL-SECURITY-PASSWORD: Your_API_password"
-H "X-PAYPAL-SECURITY-SIGNATURE: Your_API_signature"
-H "X-PAYPAL-REQUEST-DATA-FORMAT: NV"
-H "X-PAYPAL-RESPONSE-DATA-FORMAT: NV"
-H "X-PAYPAL-APPLICATION-ID: Your_AppID" https://svcs.sandbox.paypal.com/Invoice/SendInvoice
-d
"requestEnvelope.errorLanguage=en_US
&invoiceID=INV2-RVY9-UWTW-64HZ-BR9W"
若要同時建立和傳送,請使用CreateAndSendInvoice
:
curl -s --insecure
-H "X-PAYPAL-SECURITY-USERID: Your_API_username"
-H "X-PAYPAL-SECURITY-PASSWORD: Your_API_password"
-H "X-PAYPAL-SECURITY-SIGNATURE: Your_API_signature"
-H "X-PAYPAL-REQUEST-DATA-FORMAT: NV"
-H "X-PAYPAL-RESPONSE-DATA-FORMAT: NV"
-H "X-PAYPAL-APPLICATION-ID: Your_AppID" https://svcs.sandbox.paypal.com/Invoice/CreateAndSendInvoice
-d
"requestEnvelope.errorLanguage=en_US
&invoice.merchantEmail=merchant%40domain.com
&invoice.payerEmail=jbui-us-business2%40paypal.com
&invoice.currencyCode=USD
&invoice.itemList.item(0).name=Banana+Leaf+--+001
&invoice.itemList.item(0).description=Banana+Leaf
&invoice.itemList.item(0).quantity=1
&invoice.itemList.item(0).unitPrice=1
&invoice.itemList.item(0).taxName=Tax1
&invoice.itemList.item(0).taxRate=10.25
&invoice.paymentTerms=Net10
&invoice.logoUrl=https%3A%2F%2Fwww.example.com%2FYour_logo.jpg"