- Create customized invoices with flexible payment terms
- Automatically send invoices to customers
- Support partial payments and tips
- Track payment status in real-time
- Reduce manual billing processes
Prerequisites
Complete the steps in Get started with PayPal REST APIs to obtain:- Your personal and business sandbox accounts.
- Your access token.
- Your sandbox business email for the
Invoicer
API object address.
You can test calls to the Invoicing API with the Get an access token tool or you can use Postman to explore. See the following steps to create, review, and send your invoice using the Invoicing API.
1. Create a draft invoice
Copy and modify the following sample code to draft an invoice. This sample request creates an invoice with the following details:- Sender: David Larusso. Includes address, email, and phone number.
- Recipient: Stephanie Meyers. Includes address, email, and phone number.
- Items: One $50 yoga mat and one $10 t-shirt.
- Minimum partial payment: $20.
- Tip option: Enabled.
- Packing charge: $10. Includes sales tax.
- Shipping charge: $10. Includes sales tax.
- Discount: 5%.
Sample request
Sample response
Modify the code
Update the following values:- Replace
ACCESS-TOKEN
with your access token. - Update
merchant@example.com
ininvoicer: email_address
to your sandbox business account email. Ensure it matches the sandbox account linked to your access token. Use your live PayPal business email in production. - Replace
payer@example.com
inprimary_recipients: email_address
with a sandbox personal account email. - Change
invoice_date
anddue_date
to a current or future date inYYYY-MM-DD
format. If you specify aterm_type
, ensure the due date falls within the term. - Optionally, customize other invoice parameters to fit your needs.
- An invoice in your sandbox business account with a
Draft
status. You can verify this by logging into your sandbox account. - An HTTP status code
201 Created
. - A JSON response containing the invoice ID. In the sample response, the ID is
INV2-W44B-KRGF-JM6R-26VU
.
2. Send the invoice
Copy and modify the following sample code to send the invoice.Sample request
Sample response
Modify the code
Update the following values:- Replace
ACCESS-TOKEN
with your access token. - Replace
INVOICE-ID
with the invoice ID returned when you created the invoice.
- HTTP status code
200 OK
. - A JSON response with invoice details.
Unpaid (Sent)
in your sandbox business account, and PayPal sends the invoice by email if you enable email notifications in the send request body.
PayPal tracks payments that users make with the Pay Now button. For offline payments, such as checks or wire transfers, record the payment manually in your account.