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.
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.
{
"method": "AccountManagement",
"finance_token": (string),
"operation_num": (int),
"param": {
/* AccountManagementRequest */
"Action": (string),
"Payments": [
{ /* Payment */
"AccountID": (int),
"Amount": (float),
"Currency": (string)
}
...
]
}
}
Parameters are described below.
Parameter |
Description |
Required |
AccountManagementRequest object |
||
|
Action: Invoice. |
Yes |
|
Array of |
Yes |
Payment object |
||
|
ID of the shared account to add funds to. |
Yes |
|
The invoice amount in the currency specified in the 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.get method for version 5 of the API and specify the dictionary name |
Yes |
|
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. |
Yes |
Output data
The output data structure in JSON is shown below.
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.
{
"data": {
/* AccountManagementResponse */
"ActionsResult": [
{ /* AccountActionResult */
"URL": (string),
"Errors": [
{ /* Error */
"FaultCode": (int),
"FaultString": (string),
"FaultDetail": (string)
}
...
]
}
...
]
}
}
Parameters are described below.
Parameter |
Description |
AccountManagementResponse object |
|
|
Array of
The items in the array are in the same order as the objects in the |
AccountActionResult object |
|
|
URL of the invoice. |
|
Array of |
Error object |
|
|
Error code. |
|
Textual message about the error. |
|
Detailed description of the reason for the error. |
Examples of input data
Python
{
'Action': 'Invoice',
'Payments': [
{
'AccountID': 3193244,
'Amount': 5000.0,
'Currency': 'RUB'
}
]
}
PHP
array(
'Action' => 'Invoice',
'Payments' => array(
array(
'AccountID' => 3193244,
'Amount' => 5000.0,
'Currency' ='RUB'
)
)
)
Perl
{
'Action' => 'Invoice',
'Payments' => [
{
'AccountID' => 3193244,
'Amount' => 5000.0,
'Currency' ='RUB'
}
]
}