Prerequisites
- PayPal business account with Invoicing enabled.
- Obtain your sandbox credentials and access token. Refer to Get Started with PayPal REST APIs for more information.
- (Optional) Use a test email you can access, not your PayPal business email.
What you’ll build
After completing this quick start, you will have:- Created a draft invoice in your sandbox account
- Sent the invoice to a sandbox customer email address
- Confirmed the invoice status has changed to
UNPAID
Flow summary
- Your server sends a
POSTrequest to create a draft invoice. - PayPal creates the invoice resource and returns an invoice ID.
- Your server sends a
POSTrequest to send the invoice. - PayPal delivers the invoice to the recipient and updates the status.
- You verify the invoice appears as
UNPAIDin your sandbox account.
Quick start
Step 1: Get your token
Open the dashboard, then create or select an app. Copy the Client ID and Secret. Use these credentials to generate an access token, and include that token in theAuthorization header for every request.
Note: ReplaceCLIENT_IDandCLIENT_SECRETwith your sandbox app credentials from the dashboard.
Expected result
- A successful token request returns the status
200 OK. - Copy the
access_tokenvalue from the response body. You’ll use this value in Steps 2 and 3.
Step 2: Create a draft invoice
Create a draft invoice in a single API call. The invoice is not visible to your customer yet. This step generates the invoice with all required details, such as customer, items, and amount, before sending to the customer. The invoice workflow is: Draft → Sent → Viewed → Paid (or Cancelled/Overdue). This example creates a draft invoice. Save the returnedid, then call the send invoice endpoint when you’re ready to request payment.
Note: ReplaceACCESS_TOKENwith your token from Step 1, and replacecustomer@example.comwith your sandbox personal account email.
Expected result
- A successful request returns the status
201 Created. - The response body contains an
hreflink with your invoice ID (INV2-XXXX-XXXX-XXXX-XXXX). - The invoice appears in your sandbox account with
Draftstatus. - The invoice is not yet visible to the customer.
Step 3: Send the invoice
In your sandbox account, send the draft invoice you created in the previous step. This moves the invoice fromDRAFT to SENT status, and PayPal sends a secure payment link in the email to your customer. Use the id from step 2 and pass it as the invoice_id path parameter. To change details in the sent invoice, update the specific details using the PUT method and send_to_recipient: true to notify the customer.
Note: After you send an invoice, you can’t delete it. You can only cancel it to mark it as no longer active.
Expected result
- A successful request returns the status
200 OK. - The invoice status changes to
UNPAIDin your sandbox account. - PayPal sends the invoice to the customer email address provided in Step 2.
- The customer receives a payment link to pay through PayPal’s hosted payment page.
Verify it works
You should see:- Invoice appears in your sandbox PayPal business account under Invoicing.
- Invoice status shows as
UNPAID. - The customer email address you provided has received a payment notification.
- The invoice ID returned in Step 2 matches the invoice visible in the dashboard.
See also
- Invoicing API reference for full operation and schema reference.