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 improving the performance 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.

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

Parameters are described below.

Parameter

Description

Required

AccountManagementRequest object

Action

Action: Deposit.

Yes

Payments

Array of Payment objects (no more than 50). Each object contains the ID of the shared account and the payment amount.

Yes

Payment object

AccountID

ID 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

Origin

Deposit method: Overdraft.

For payment using overdraft

Contract

The 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

Alert

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.

Parameter

Description

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

AccountID

ID of the shared account.

Errors

Array of Error objects with errors that occurred while adding funds to the account.

Error object

FaultCode

Error code.

FaultString

Textual message about the error.

FaultDetail

Detailed 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'
      }
   ]
}