Deposit

Adds funds to shared accounts using an advertising agency's credit limit, or the advertiser's overdraft.

This action allows advertising agencies and direct advertisers to add funds to the account balance with deferred payment (see the section Paying by credit and overdraft).

Recommendations and restrictions

A direct advertiser can add funds to the shared account only if there is at least one campaign that has passed moderation.

We recommend adding funds to shared accounts using the fewest possible AccountManagement.Deposit operations per day. This recommendation is aimed at increasing the productivity of the Yandex.Direct API. From the point of view of productivity, it is better to make deposits to several accounts in a single operation than to use multiple operations to make each deposit separately.

Input data

The input data structure in JSON is shown below.

Attention. 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),
            "Origin": (string),
            "Contract": (string),
            "Currency": (string)
         }
         ...
      ]
   }
}

Parameters are described below.

ParameterDescriptionRequired
AccountManagementRequest object
ActionAction: Deposit.Yes
PaymentsArray of Payment objects (no more than 50). Each object contains the ID of the shared account and the payment amount.Yes
Payment object
AccountIDID of the shared account to add funds to.Yes
Amount

The deposit amount in the currency specified in the Currency parameter. The value in a real currency should include the client's VAT.

The specified amount is mathematically rounded to the second decimal place (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 Currencies in the request.

Yes
OriginDeposit method: Overdraft.For payment using overdraft
ContractThe number of the credit agreement.For payment using credit
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.

Yes

Output data

Attention. An error when depositing funds to one of the accounts does not cause the entire operation to be canceled, and does not affect the success of depositing funds to the other accounts.

The output data structure in JSON is shown below.

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

Parameters are described below.

ParameterDescription
AccountManagementResponse object
ActionsResult

Array of AccountActionResult objects Each object corresponds to an item in the Payments input array and contains:

  • The ID of the shared account, if the deposit to the shared account was successful.
  • 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.

AccountActionResult object
AccountIDID of the shared account.
ErrorsArray of Error objects with errors that occurred while adding funds to the account.
Error object
FaultCodeError code.
FaultStringTextual message about the error.
FaultDetailDetailed description of the reason for the error.

Examples of input data

Python

{
   'Action': 'Deposit',
   'Payments': [
      {
         'AccountID': 3193244,
         'Amount': 5000.0,
         'Origin': 'Overdraft',
         'Currency': 'RUB'
      },
      {
         'AccountID': 3193279,
         'Amount': 1200.0,
         'Contract': '23452345/67',
         'Currency': 'USD'
      }
   ]
}

PHP

array(
   'Action' => 'Deposit',
   'Payments' => array(
      array(
         'AccountID' => 3193244,
         'Amount' => 5000.0,
         'Origin' => 'Overdraft',
         'Currency' => 'RUB'
      ),
      array(
         'AccountID' => 3193279,
         'Amount' => 1200.0,
         'Contract' => '23452345/67',
         'Currency' => 'USD'
      )
   )
)

Perl

{
   'Action' => 'Deposit',
   'Payments' => [
      {
         'AccountID' => 3193244,
         'Amount' => 5000.0,
         'Contract' => 'Overdraft',
         'Currency' => 'RUB'
      },
      {
         'AccountID' => 3193279,
         'Amount' => 1200.0,
         'Contract' => '23452345/67',
         'Currency' => 'RUB'
      }
   ]
}