# CreateInvoice API operation (/api/nvp-soap/create-invoice)



> **Note:** **Important:** The Adaptive Platform API is not available for new integrations. PayPal provides this documentation to support existing integrations. If you're starting an integration, [we recommend our latest solutions](/).

Creates an invoice. The call includes merchant, payer, and API caller information, in addition to invoice detail. The response to the call contains an invoice ID and URL.

## Example [#example]

This example creates an invoice using `CreateInvoice`.

<div className="pl-[1.625rem]" />

```bash lineNumbers
curl https://svcs.sandbox.paypal.com/Invoice/CreateInvoice \
  -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: <var>Your_AppID</var>"  \
  -d requestEnvelope.errorLanguage=en_US \
  -d invoice.merchantEmail=merchant%40domain.com \
  -d invoice.payerEmail=jbui-us-business2%40paypal.com \
  -d invoice.currencyCode=USD \
  -d invoice.itemList.item(0).name=Banana+Leaf+--+001 \
  -d invoice.itemList.item(0).description=Banana+Leaf \
  -d invoice.itemList.item(0).quantity=1 \
  -d invoice.itemList.item(0).unitPrice=1 \
  -d invoice.itemList.item(0).taxName=Tax1 \
  -d invoice.itemList.item(0).taxRate=10.25 \
  -d invoice.paymentTerms=Net10 \
  -d invoice.logoUrl=https%3A%2F%2Fexample.com%2FYour_logo.jpg
```

## CreateInvoiceRequest message [#createinvoicerequest-message]

Use the `CreateInvoiceRequest` message to create an invoice. The merchant issuing the invoice, and the partner, if any, making the call, must have a PayPal account in good standing.

### RequestEnvelope fields [#requestenvelope-fields]

| Field           | Description                                                                                                                                                                                                                                                                                                                                                                  |
| --------------- | ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| `detailLevel`   | `common:DetailLevelCode&#x60; &#x2A;(Optional)* Level of detail required by the client application pertaining to a particular data component. The detail level is specified as a detail level code, which has all the enumerated values of the detail level for the component. By default, the detail level code is `ReturnAll`, which provides the maximum level of detail. |
| `errorLanguage` | `xs:string&#x60; &#x2A;(Required)* RFC 3066 language in which error messages are returned; by default it is `en_US`, which is the only language currently supported.                                                                                                                                                                                                         |

### CreateInvoiceRequest fields [#createinvoicerequest-fields]

| Field             | Description                                                                                                                                           |
| ----------------- | ----------------------------------------------------------------------------------------------------------------------------------------------------- |
| `invoice`         | `inv:InvoiceType&#x60; &#x2A;(Required)* Merchant, payer, and invoice information.                                                                    |
| `requestEnvelope` | `common:requestEnvelope&#x60; &#x2A;(Required)* Information common to each API operation, such as the language in which an error message is returned. |

### InvoiceType fields [#invoicetype-fields]

| Field                        | Description                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                    |
| ---------------------------- | ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| `merchantEmail`              | `xs:string&#x60; &#x2A;(Required)* Merchant email address.                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                     |
| `payerEmail`                 | `xs:string&#x60; &#x2A;(Optional)* Payer email address. This value is optional if the invoice is in a draft state. However, this value is required for sending an invoice.                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                     |
| `number`                     | `xs:string&#x60; &#x2A;(Optional)* Unique identifier for the invoice.                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                          |
| `merchantInfo`               | `inv:BusinessInfoType` Company information of the merchant company sending the invoice.                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                        |
| `itemList`                   | `inv:InvoiceItemListType&#x60; &#x2A;(Optional)* List of items included in this invoice. This list is optional if the invoice is in a draft state. However, this value is required for sending an invoice.                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                     |
| `taxCalculatedAfterDiscount` | `xs:boolean&#x60; &#x2A;(Optional)* Indicates whether tax is calculated before or after a discount. If false (the default), the tax is calculated before a discount. If true, the tax is calculated after a discount.                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                          |
| `currencyCode`               | `xs:string&#x60; &#x2A;(Required)* Currency used for all invoice item amounts and totals.                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                      |
| `invoiceDate`                | `xs:dateTime&#x60; &#x2A;(Optional)* Date on which the invoice is enabled.                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                     |
| `dueDate`                    | `xs:dateTime&#x60; &#x2A;(Optional)* Date on which the invoice payment is due.                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                 |
| `paymentTerms`               | `inv:PaymentTermsType&#x60; &#x2A;(Optional)* Terms under which payment is due, specified as one of the following values:<br />`DueOnReceipt` — Payment is due when the payer receives the invoice.`DueOnDateSpecified` — Payment is due on the date specified in the invoice.`Net10` — Payment is due 10 days from the invoice date.`Net15` — Payment is due 15 days from the invoice date.`Net30` — Payment is due 30 days from the invoice date.`Net45` — Payment is due 45 days from the invoice date.`NoDueDate` — No payment due date is displayed for the invoice; if a value is specified in the `dueDate` field, the value is ignored.                                                                                                |
| `discountPercent`            | `xs:decimal&#x60; &#x2A;(Optional)* Discount percent applied at the invoice level (not at the item level). Also see the descriptions of the discount fields in the **InvoiceItemType Fields**.                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                 |
| `discountAmount`             | `xs:decimal&#x60; &#x2A;(Optional)* Invoice-level discount amount, calculated after the item-level discounts. The overall discount on an invoice is equal to the addition of the invoice-level and item-level discounts. Note that if `discountPercent` is provided, `discountAmount` is ignored. Also see the descriptions of the discount fields in the **InvoiceItemType Fields**.                                                                                                                                                                                                                                                                                                                                                          |
| `taxInclusive`               | `xs:boolean&#x60; &#x2A;(Optional)* Determines whether the item amount is tax inclusive or tax exclusive. An item amount is the unit price multiplied by the quantity. By default, the `taxInclusive` field is `false`.To specify `true` or `false` in the `taxInclusive` field, please use the following definitions:<br /> **Tax exclusive:** The stated tax is added on top of the item or shipping amount.**Tax inclusive:** The item or shipping amount already includes the stated tax.If the `taxInclusive` field is `true`, the tax is calculated as follows:<br /> `[Item Amount] - ([Item Amount]/(1+[Tax %])`<br /> If the `taxInclusive` field is `false`, the tax is calculated as follows:<br /> `[Item Amount] * [Tax %]`<br /> |
| `terms`                      | `xs:string&#x60; &#x2A;(Optional)* General terms for the invoice. Maximum length: 4000 characters.                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                             |
| `note`                       | `xs:string&#x60; &#x2A;(Optional)* Note to the payer company. Maximum length: 4000 characters.                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                 |
| `merchantMemo`               | `xs:string&#x60; &#x2A;(Optional)* Memo for bookkeeping that is private to the merchant.                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                       |
| `billingInfo`                | `inv:BusinessInfoType&#x60; &#x2A;(Optional)* Billing information for the payer.                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                               |
| `shippingInfo`               | `inv:BusinessInfoType&#x60; &#x2A;(Optional)* Shipping information for the payer.                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                              |
| `shippingAmount`             | `xs:decimal&#x60; &#x2A;(Optional)* Cost of shipping.                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                          |
| `shippingTaxName`            | `xs:string&#x60; &#x2A;(Optional)* Name of the applicable tax on shipping cost.                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                |
| `shippingTaxRate`            | `xs:decimal` (Optional) Rate of the applicable tax on shipping cost.                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                           |
| `logoURL`                    | `xs:string&#x60; &#x2A;(Optional)* Complete URL to an external image used as the logo, if any.                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                 |
| `referrerCode`               | `xs:string&#x60; &#x2A;(Optional)* Build Notification (BN) code for tracking transactions with a particular partner.                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                           |

### BusinessInfoType fields [#businessinfotype-fields]

| Field          | Description                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                   |
| -------------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| `firstName`    | `xs:string&#x60; &#x2A;(Optional)* First name of the company contact.                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                         |
| `lastName`     | `xs:string&#x60; &#x2A;(Optional)* Last name of the company contact.                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                          |
| `businessName` | `xs:string&#x60; &#x2A;(Optional)* Company business name.                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                     |
| `phone`        | `xs:string&#x60; &#x2A;(Optional)* Phone number for contacting the company.                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                   |
| `fax`          | `xs:string&#x60; &#x2A;(Optional)* Fax number used by the company.                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                            |
| `website`      | `xs:string&#x60; &#x2A;(Optional)* Website used by the company.                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                               |
| `language`     | `xs:string&#x60; &#x2A;(Optional)* The language of invoices for a payer who does not have a PayPal account, or a unilateral payer. If you omit the `language` field, a unilateral payer receives invoices in the merchant's language.<br /> If the payer has a PayPal account, this field is ignored and the payer's language is used.<br /> Specify the `language` field in the `billingInfo` container. This field affects the invoice emails and the payer's invoice view. Maximum length: Five characters.<br /> You can specify one of these values:<br /> `da_DK` — Danish`de_DE` — German`en_AU` — English (Australia)`en_GB` — English (U.K.)`en_US` — English (U.S.)`es_ES` — Spanish (Modern)`es_XC` — Spanish (Mexico)`fr_CA` — French (Canadian)`fr_FR` — French (France)`fr_XC` — French`he_IL` — Hebrew`id_ID` — Indonesian`it_IT` — Italian`ja_JP` — Japanese`nl_NL` — Dutch`no_NO` — Norwegian`pl_PL` — Polish`pt_BR` — Portuguese (Brazilian)`pt_PT` — Portuguese`ru_RU` — Russian`sv_SE` — Swedish`th_TH` — Thai`zh_CN` — Simplified Chinese`zh_HK` — Traditional Chinese (Hong Kong)`zh_TW` — Chinese (Taiwan)`zh_XC` — Simplified Chinese |
| `taxId`        | `xs:string&#x60; &#x2A;(Optional)* Tax ID of the merchant.                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                    |
| `customValue`  | `xs:string&#x60; &#x2A;(Optional)* Custom value to be displayed in the contact information details.                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                           |
| `address`      | `common:BaseAddress&#x60; &#x2A;(Optional)* Street address of the company.                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                    |

### BaseAddress fields [#baseaddress-fields]

| Field                 | Description                                                           |
| --------------------- | --------------------------------------------------------------------- |
| `line1`               | `xs:string&#x60; &#x2A;(Required)* First line of the address.         |
| `line2`               | `xs:string&#x60; &#x2A;(Optional)* Second line of the street address. |
| `city`                | `xs:string&#x60; &#x2A;(Required)* City of the address.               |
| `state`               | `xs:string&#x60; &#x2A;(Optional)* State for the address.             |
| `postalCode`          | `xs:string&#x60; &#x2A;(Optional)* Postal code of the address.        |
| `postalCodeExtension` | `xs:string&#x60; &#x2A;(Optional)* Extension to the postal code.      |
| `countryCode`         | `xs:string&#x60; &#x2A;(Required)* Country code of the address.       |
| `type`                | `xs:string&#x60; &#x2A;(Optional)* Type of address.                   |

### InvoiceItemListType fields [#invoiceitemlisttype-fields]

| Field  | Description                                                |
| ------ | ---------------------------------------------------------- |
| `item` | `inv:InvoiceItemType&#x60; &#x2A;(Required)* Invoice item. |

### InvoiceItemType fields [#invoiceitemtype-fields]

| Field             | Description                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                         |
| ----------------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| `name`            | `xs:string&#x60; &#x2A;(Required)* SKU or name of the item. Maximum length: 60 characters.                                                                                                                                                                                                                                                                                                                                                                                                                          |
| `description`     | `xs:string&#x60;, &#x2A;(Optional)* Item description. Maximum length: 1000 characters.                                                                                                                                                                                                                                                                                                                                                                                                                              |
| `date`            | `xs:dateTime` (Optional) Date on which the product or service was provided.                                                                                                                                                                                                                                                                                                                                                                                                                                         |
| `quantity`        | `xs:decimal&#x60; &#x2A;(Required)* Item count. Valid values are 0 to 10000.                                                                                                                                                                                                                                                                                                                                                                                                                                        |
| `unitPrice`       | `xs:decimal&#x60; &#x2A;(Required)* Price of the item, in the currency specified by the invoice.                                                                                                                                                                                                                                                                                                                                                                                                                    |
| `discountPercent` | `xs:decimal&#x60; &#x2A;(Optional)* A discount percent applied at the item level (not at the invoice level). Enables separate discounts for individual items on an invoice. This discount is compounded with any discounts specified at the invoice level (see all the discount fields listed under the **InvoiceType Fields**, above). Minimum value: 0. Maximum value: 100.                                                                                                                                       |
| `discountAmount`  | `xs:decimal&#x60; &#x2A;(Optional)* A discount amount applied at the item level (not at the invoice level). Enables separate discounts for individual items on an invoice. This discount is compounded with any discounts specified at the invoice level (see all the discount fields listed under the **InvoiceType Fields**, above). If `discountPercent` is provided at the item level, `discountAmount` at the item level is ignored. Not greater than the item amount. Minimum value: 0. Maximum value: 10000. |
| `taxName`         | `xs:string&#x60; &#x2A;(Optional)* Name of the applicable tax. **Required** if `taxRate` is specified.                                                                                                                                                                                                                                                                                                                                                                                                              |
| `taxRate`         | `xs:decimal&#x60; &#x2A;(Optional)* Rate of the applicable tax. **Required** if `taxName` is specified.                                                                                                                                                                                                                                                                                                                                                                                                             |

## CreateInvoiceResponse message [#createinvoiceresponse-message]

The `CreateInvoiceResponse` message contains information returned in response to a `CreateInvoiceRequest` message. The response contains an invoice ID and the URL to the invoice on the PayPal system.

### ResponseEnvelope fields [#responseenvelope-fields]

| Field           | Description                                                                                                                                                                                                                                                                                                                                    |
| --------------- | ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| `ack`           | `common:AckCode` Acknowledgment code. Value is:<br />`Success` — The operation completed successfully.`Failure` — The operation failed.`SuccessWithWarning` — The operation completed successfully; however, there is a warning message.`FailureWithWarning `— The operation failed with a warning message.                                    |
| `build`         | `xs:string` Build number. It is used only by PayPal Merchant Technical Support.                                                                                                                                                                                                                                                                |
| `correlationId` | `xs:string` Correlation identifier. It is a 13-character, alphanumeric string (for example, `db87c705a910e`) that is used only by PayPal Merchant Technical Support. > **Note:** &#x2A;*Note:** You must log and store this data for every response you receive. PayPal Technical Support uses the information to assist with reported issues. |
| `timestamp`     | `xs:datetime` Date on which the response was sent, for example: `2012-04-02T22:33:35.774-07:00` > **Note:** &#x2A;*Note:** You must log and store this data for every response you receive. PayPal Technical Support uses the information to assist with reported issues.                                                                      |

### CreateInvoiceResponse fields [#createinvoiceresponse-fields]

| Field              | Description                                                                                                          |
| ------------------ | -------------------------------------------------------------------------------------------------------------------- |
| `responseEnvelope` | `common:ResponseEnvelope` Common response information, including a timestamp and the response acknowledgment status. |
| `invoiceId`        | `xs:string` ID of the created invoice.                                                                               |
| `invoiceNumber`    | `xs:string` Invoice number of the created invoice.                                                                   |
| `invoiceURL`       | `xs:string` URL location where merchants view the invoice details.                                                   |
| `totalAmount`      | `xs:long` The total amount of the invoice.                                                                           |

## PPFault message [#ppfault-message]

The `PPFaultMessage` returns `ErrorData` and the `ResponseEnvelope` information to your application if an error occurs.

### FaultMessage fields [#faultmessage-fields]

| Field              | Description                                                                                                          |
| ------------------ | -------------------------------------------------------------------------------------------------------------------- |
| `error`            | `common:ErrorData` Detailed error information.                                                                       |
| `responseEnvelope` | `common:ResponseEnvelope` Common response information, including a timestamp and the response acknowledgment status. |

### ErrorData fields [#errordata-fields]

| Field         | Description                                                                                                                                                                                                                        |
| ------------- | ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| `category`    | `common:ErrorCategory` The location where the error occurred. Value is:<br />`System` — The system encountered errors; try again`Application` — The application encountered errors; try again`Request` — The request was incorrect |
| `domain`      | `xs:string` The domain to which this service belongs.                                                                                                                                                                              |
| `errorId`     | `xs:long` A 6-digit number that uniquely identifies a particular error.                                                                                                                                                            |
| `exceptionID` | This field is not used.                                                                                                                                                                                                            |
| `message`     | `xs:string` A description of the error.                                                                                                                                                                                            |
| `parameter`   | `common:ErrorParameter` Represents contextual information about the error.                                                                                                                                                         |
| `severity`    | `common:ErrorSeverity` The severity of the error encountered. Value is:<br />`Error` — Processing of the request was interrupted`Warning` — Processing of the request was completed                                                |
| `subdomain`   | This field is not used.                                                                                                                                                                                                            |

### ResponseEnvelope fields [#responseenvelope-fields-1]

| Field           | Description                                                                                                                                                                                                                                                                                                                                    |
| --------------- | ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| `ack`           | `common:AckCode` Acknowledgment code. Value is:<br />`Success` — The operation completed successfully.`Failure` — The operation failed.`SuccessWithWarning` — The operation completed successfully; however, there is a warning message.`FailureWithWarning `— The operation failed with a warning message.                                    |
| `build`         | `xs:string` Build number. It is used only by PayPal Merchant Technical Support.                                                                                                                                                                                                                                                                |
| `correlationId` | `xs:string` Correlation identifier. It is a 13-character, alphanumeric string (for example, `db87c705a910e`) that is used only by PayPal Merchant Technical Support. > **Note:** &#x2A;*Note:** You must log and store this data for every response you receive. PayPal Technical Support uses the information to assist with reported issues. |
| `timestamp`     | `xs:datetime` Date on which the response was sent, for example: `2012-04-02T22:33:35.774-07:00` > **Note:** &#x2A;*Note:** You must log and store this data for every response you receive. PayPal Technical Support uses the information to assist with reported issues.                                                                      |

## CreateInvoice API errors [#createinvoice-api-errors]

| Code   | Message                                                                                                                                                  | Additional Information |
| ------ | -------------------------------------------------------------------------------------------------------------------------------------------------------- | ---------------------- |
| 520002 | Internal error.                                                                                                                                          |                        |
| 520003 | Authentication failed. API credentials are incorrect.                                                                                                    |                        |
| 520009 | Account is restricted.                                                                                                                                   |                        |
| 570045 | The number of items exceeds this allowed limit.                                                                                                          |                        |
| 570046 | The due date occurs before the invoice date.                                                                                                             |                        |
| 570048 | A tax name can only be associated with one unique tax rate on a single invoice; the following tax name is associated to different rates on this invoice. |                        |
| 570049 | The total amount for the invoice cannot be negative.                                                                                                     |                        |
| 570050 | The merchant's PayPal account cannot be the same as the payer's account; merchant and payer email addresses presently link to the same account.          |                        |
| 570051 | Invoice cannot have more than 10 different taxes.                                                                                                        |                        |
| 570054 | Invalid token.                                                                                                                                           |                        |
| 570058 | Authentication failed. User account is not confirmed.                                                                                                    |                        |
| 570059 | Invoice number is too long.                                                                                                                              |                        |
| 580022 | This error code corresponds to validation error messages that deal with errors of supplied parameters.                                                   |                        |
| 580045 | Merchant does not have a PayPal account associated with this email address.                                                                              |                        |
| 580046 | An invoice already exists for the merchant with this invoice number.                                                                                     |                        |
