> For the complete documentation index, see [llms.txt](https://docs.2checkout.com/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://docs.2checkout.com/channel-manager-api/channel-manager-api/api-2.1/json-rpc-2.1/reference/partner-invoices/create-partner-invoice.md).

# Create partner invoice

Generate a partner invoice for one or more orders, based on their unique reference numbers.

## Requirements

You can include only confirmed/approved orders in partner invoices. To include multiple orders in the same partner invoice, they must share the same currency.

## Request parameters

<table><thead><tr><th width="129.4000244140625">Parameter</th><th>Type / Description</th></tr></thead><tbody><tr><td><code>sessionID</code></td><td><p><strong>Required (string)</strong></p><p>Session identifier, output of the Login method. An exception is thrown if the values are incorrect.</p></td></tr><tr><td><code>Sales</code></td><td><p><strong>Required (array of strings)</strong></p><p>Array with the reference number of the orders you want included on the same partner invoice.</p></td></tr></tbody></table>

### Request sample

```php
<?php

require ('PATH_TO_AUTH');  // Authentication example: https://knowledgecenter.avangate.com/Integration/Channel_Manager_API/JSON-RPC/02Authentication
require ('PATH_TO_SET_PARTNER'); // setPartner example: https://knowledgecenter.avangate.com/Integration/Channel_Manager_API/JSON-RPC/06Reference/Partner/00Set_partner

$sales = array(
'ORDER_REFERENCE_1',
'ORDER_REFERENCE_2'
);

$jsonRpcRequest = array (
'jsonrpc' => '2.0',
'id' => $i++,
'method' => 'createProforma',
'params' => array($sessionID, $sales)
);
var_dump (callRPC((Object)$jsonRpcRequest,$host));
```

## Response parameters

<table><thead><tr><th width="230.2000732421875">Parameters</th><th>Type / Description</th></tr></thead><tbody><tr><td><code>Proforma</code></td><td><strong>Object</strong><br>A partner invoice object with the structure detailed below.</td></tr><tr><td><code>Proforma.Number</code></td><td><strong>String</strong><br>Unique partner invoice identifier</td></tr><tr><td><code>Proforma.CreateDate</code></td><td><strong>String</strong><br>Partner invoice creation date</td></tr><tr><td><code>Proforma.DueDate</code></td><td><strong>String</strong><br>The date before which the partner needs to pay the invoice.</td></tr><tr><td><code>Proforma.Status</code></td><td><p><strong>String</strong></p><p>Partner invoice status. Possible values:</p><ul><li>Unpaid</li><li>Overdue</li><li>Paid</li><li>Canceled</li></ul></td></tr><tr><td><code>Proforma.Currency</code></td><td><strong>String</strong><br>Partner invoice currency ISO code</td></tr><tr><td><code>Proforma.Total</code></td><td><strong>String</strong><br>Total costs of all orders included in the partner invoice</td></tr><tr><td><code>Proforma.PaymentMethod</code></td><td><strong>String</strong><br>Payment method used to pay for the partner invoice. NULL if the invoice was not paid.</td></tr><tr><td><code>Proforma.Orders</code></td><td><strong>String / Array</strong><br>Order references array of strings. A partner invoice only groups approved orders with the same currency.</td></tr><tr><td><code>Proforma.BusinessModel</code></td><td><p><strong>String</strong></p><p>The business model governing the relationship between you and the partner company. Possible values:</p><ul><li>RESELLER: payments made to Avangate as a master reseller</li><li>SERVICE_PROVIDER: direct payments to your accounts via wire transfer</li></ul></td></tr><tr><td><code>Proforma.ProformaPDF</code></td><td><strong>String</strong><br>Partner invoice PDF download link. Valid for 1 hour.</td></tr></tbody></table>

## Errors

<table><thead><tr><th width="201.400146484375">Error</th><th>Description</th></tr></thead><tbody><tr><td><strong>INVALID_ORDER</strong></td><td>You must provide an array with orders</td></tr><tr><td><strong>INVALID_PARTNER</strong></td><td>No partner was set.</td></tr><tr><td><strong>INVALID_PARTNER</strong></td><td>This partner does not have rights to create a partner invoice.</td></tr><tr><td><strong>INVALID_ORDER</strong></td><td>We cannot create partner invoices for some of your orders.</td></tr><tr><td><strong>INVALID_ORDER</strong></td><td>Some of your orders already have a partner invoice invoice.</td></tr><tr><td><strong>INVALID_ORDER</strong></td><td>The order is not approved. We cannot create a partner invoice.</td></tr><tr><td><strong>INVALID_ORDER</strong></td><td>Your orders must all have the same currency. They now have:</td></tr></tbody></table>


---

# Agent Instructions
This documentation is published with GitBook. GitBook is the documentation platform designed so that both humans and AI agents can read, navigate, and reason over technical content effectively. Learn more at gitbook.com.

## Querying This Documentation
If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter, and the optional `goal` query parameter:

```
GET https://docs.2checkout.com/channel-manager-api/channel-manager-api/api-2.1/json-rpc-2.1/reference/partner-invoices/create-partner-invoice.md?ask=<question>&goal=<endgoal>
```

`ask` is the immediate question: it should be specific, self-contained, and written in natural language.
`goal` is optional and describes the broader end goal you are ultimately trying to accomplish on behalf of the user. GitBook uses it to tailor the answer towards what is most useful for that goal.

The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
