# DeleteInvoice API Operation (/api/nvp-soap/delete-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](/).

Deletes a draft invoice.

If the specified invoice is *not* in the draft state, this API returns an error.

Note that once you've deleted a draft invoice, it can no longer be used. For example, you can no longer access the invoice using `GetInvoiceDetails`.

Since a deleted invoice can't be accessed, you can reuse its invoice number in another invoice.

The difference between `DeleteInvoice` and `CancelInvoice` is that `CancelInvoice` works on invoices already sent, not on invoices in the draft state. `DeleteInvoice`, on the other hand, works only on invoices in the draft state.

## DeleteInvoiceRequest Message [#deleteinvoicerequest-message]

Use the `DeleteInvoiceRequest` message to pass the information required to delete a draft invoice.

### DeleteInvoiceRequest Fields [#deleteinvoicerequest-fields]

| Field             | Description                                                                                                                                        |
| ----------------- | -------------------------------------------------------------------------------------------------------------------------------------------------- |
| `invoiceID`       | `xs:string&#x60; &#x2A;(Required)* The ID of the draft invoice to be deleted. This field cannot be null or blank.                                  |
| `requestEnvelope` | `common:requestEnvelope&#x60; &#x2A;(Required)* Information common to all API requests, such as the language in which error messages are returned. |

### RequestEnvelope Fields [#requestenvelope-fields]

| Field           | Description                                                                                                                                                          |
| --------------- | -------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| `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. |

## DeleteInvoiceResponse Message [#deleteinvoiceresponse-message]

The `DeleteInvoiceResponse` message indicates whether the specified invoice was successfully deleted, or provides information about an error.

### DeleteInvoiceResponse Fields [#deleteinvoiceresponse-fields]

| Field              | Description                                                                                                                                                                                                           |
| ------------------ | --------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| `responseEnvelope` | `common:ResponseEnvelope` Structure containing information common to all API responses, including a timestamp and the response acknowledgment status. See [ResponseEnvelope Fields](#id_resp_env_fields) for details. |

## PPFault Message [#ppfault-message]

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

### FaultMessage Fields [#faultmessage-fields]

| Field              | Description                                                                                                                                                                                                           |
| ------------------ | --------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| `error`            | `common:ErrorData` Detailed error information.                                                                                                                                                                        |
| `responseEnvelope` | `common:ResponseEnvelope` Structure containing information common to all API responses, including a timestamp and the response acknowledgment status. See [ResponseEnvelope Fields](#id_resp_env_fields) for details. |

### 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]

| 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.                                                                      |

## DeleteInvoice API Errors [#deleteinvoice-api-errors]

| Code   | Message                                                                                                | Additional Information |
| ------ | ------------------------------------------------------------------------------------------------------ | ---------------------- |
| 520002 | Internal error.                                                                                        |                        |
| 520003 | Authentication failed. API credentials are incorrect.                                                  |                        |
| 520009 | Account is restricted.                                                                                 |                        |
| 570054 | Invalid token.                                                                                         |                        |
| 570058 | Authentication failed. User account is not confirmed.                                                  |                        |
| 571001 | The specified invoice ID is invalid because the invoice has already been deleted.                      |                        |
| 571002 | The specified invoice cannot be deleted. Only invoices in a draft state can be deleted.                |                        |
| 580022 | This error code corresponds to validation error messages that deal with errors of supplied parameters. |                        |
