我正在使用 Google 表单记录不同朋友的回答。根据他们的回答,他们将收到不同的账单。我想创建一个 Bash 脚本...
- 每 3 分钟下载一次答案
- 检查过去 3 分钟内是否有新答案
- 计算他们的账单
- 发送一封包含 PayPal 发票的电子邮件。
我遇到了第 4 点的问题。我有一个 Paypal 标准账户。我知道如何使用该email an invoice
选项直接通过电子邮件发送发票。但是,此解决方案不允许我
- 用户回答 Google 表单后自动直接发送发票
- 发送作为 Google 表单答案功能的发票。
请注意,通过身份证号码来追踪付款人非常重要。
我有什么解决方案?例如,我可以生成大约 40 种发票,对应 40 个不同的 URL,然后只需将这些 URL 发送到我的电子邮件中吗?
答案1
这个解决方案不是PayPal,但我认为值得分享。
您可以使用FreeAgent 应用程序接口您可以通过以下方式创建发票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创建发票PayPal 发票 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"