---
metadata:
  - name: generator
    content: Diplodoc Platform v5.52.0
alternate:
  - https://yandex.com/dev/direct/doc/dg-v4/en/live/AccountManagement_Invoice.md
  - https://yandex.com/dev/direct/doc/dg-v4/ru/live/AccountManagement_Invoice.md
  - href: en/live/AccountManagement_Invoice.md
    type: text/markdown
    title: Markdown version
  - href: ../llms.txt
    type: text/markdown
    title: llms.txt
---
> **Documentation Index:** Fetch the complete configuration index at https://yandex.com/dev/direct/doc/dg-v4/en/llms.txt

# Invoice
Generates an invoice in HTML format.
Specify the shared accounts and payment amounts when calling this action. The action returns the URL of the invoice. Only the user who the method was called on behalf of can access the invoice (the user must log in on Yandex).

## Recommendations and restrictions

We recommend generating invoices using as few calls of `AccountManagement.Invoice` per day as possible. This recommendation is aimed at improving the performance of the Yandex Direct API. From the point of view of productivity, it is better to create several invoices in a single operation than to use multiple operations to generate each invoice separately.

## Input data

The input data structure in JSON is shown below.


{% note alert %}

It is mandatory to include the `finance_token` and `operation_num` parameters in the request. For information on generating the token, see the section [Working with the shared account](https://yandex.com/dev/direct/doc/dg-v4/en/concepts/shared-account-howto.md).

{% endnote %}


```javascript
{
   "method": "AccountManagement",
   "finance_token": (string),
   "operation_num": (int),
   "param": {
      /* AccountManagementRequest */
      "Action": (string),
      "Payments": [
         {  /* Payment */
            "AccountID": (int),
            "Amount": (float),
            "Currency": (string)
         }
         ...
      ]
   }
}
```

Parameters are described below.


#|
||
**<sup >Parameter</sup>**
|
**<sup >Description</sup>**
|
**<sup >Required</sup>**
||

||
**<sub >AccountManagementRequest object</sub>**
||
||
`Action`
|
Action: Invoice.
|
Yes
||
||
`Payments`
|
Array of `Payment` objects (no more than 50). Each object contains the ID of the shared account and the payment amount.
|
Yes
||

||
**<sub >Payment object</sub>**
||
||
`AccountID`
|
ID of the shared account to add funds to.
|
Yes
||
||
`Amount`
|
The invoice amount in the currency specified in the `Currency` parameter. The value in a real currency should include the client's VAT.

Before creating an invoice, the specified amount is rounded mathematically to the second decimal point (for all currencies, including the tenge).

To get the minimum acceptable value, use the [Dictionaries](https://yandex.com/dev/direct/doc/ref-v5dictionaries/dictionaries.md).[get](https://yandex.com/dev/direct/doc/ref-v5dictionaries/get.md) method for version 5 of the API and specify the dictionary name `Currencies` in the request.
|
Yes
||
||
`Currency`
|
The currency that the amount is shown in.

Acceptable values: RUB, CHF, EUR, KZT, TRY, UAH, USD, BYN. The value must match the currency of the shared account; otherwise, an error is returned with code [245](https://yandex.com/dev/direct/doc/dg-v4/en/reference/ErrorCodes.md#BadCurrency).
|
Yes
||
|#

## Output data

The output data structure in JSON is shown below.


{% note alert %}

An error when generating one of the invoices does not cause the entire operation to be canceled, and does not affect the success of generating the other invoices.

{% endnote %}


```javascript
{
   "data": {
      /* AccountManagementResponse */
      "ActionsResult": [
         {  /* AccountActionResult */
            "URL": (string),
            "Errors": [
               {  /* Error */
                  "FaultCode": (int),
                  "FaultString": (string),
                  "FaultDetail": (string)
               }
               ...
            ]
         }
         ...
      ]
   }
}
```

Parameters are described below.


#|
||
**<sup >Parameter</sup>**
|
**<sup >Description</sup>**
||

||
**<sub >AccountManagementResponse object</sub>**
||
||
`ActionsResult`
|
Array of `AccountActionResult` objects. Each object corresponds to an item in the `Payments` input array and contains:

- The URL of the invoice, if the invoice was created successfully.
- The `Errors` array, if an error occurred.

The items in the array are in the same order as the objects in the `Payments` input array.
||

||
**<sub >AccountActionResult object</sub>**
||
||
`URL`
|
URL of the invoice.
||
||
`Errors`
|
Array of `Error` objects with errors that occurred while adding funds to the account.
||

||
**<sub >Error object</sub>**
||
||
`FaultCode`
|
Error code.
||
||
`FaultString`
|
Textual message about the error.
||
||
`FaultDetail`
|
Detailed description of the reason for the error.
||
|#

## Examples of input data

# Python

```python
{
   'Action': 'Invoice',
   'Payments': [
      {
         'AccountID': 3193244,
         'Amount': 5000.0,
         'Currency': 'RUB'
      }
   ]
}
```

# PHP

```php
array(
   'Action' => 'Invoice',
   'Payments' => array(
      array(
         'AccountID' => 3193244,
         'Amount' => 5000.0,
         'Currency' ='RUB'
      )
   )
)
```

# Perl

```perl
{
   'Action' => 'Invoice',
   'Payments' => [
      {
         'AccountID' => 3193244,
         'Amount' => 5000.0,
         'Currency' ='RUB'
      }
   ]
}
```

