Este exemplo cria uma fatura usando CreateInvoice
via API de faturamento do PayPal :
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"
Este, iria enviá-lo ( 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"
Para criar e enviar ao mesmo tempo, use 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"