TransferMoney (Live)

Transfers funds between campaigns.

When calling this method, specify one or more campaigns to deduct funds from, and one or more campaigns to transfer funds to. The total sum of deducted funds and the total sum of credited funds must be the same. If the totals don't match, error 353 occurs.

There is a slight delay before transferring funds, usually no more than five minutes.

Restrictions

Restrictions on method calls:

  • A single user can call the method 1000 times per day.
  • A single campaign can have funds added to it no more than 30 times per day. This restriction does not apply to deducting funds.

Exceeding these limits results in the error 56.

When using this method, the same financial restrictions apply as when transferring funds in the Yandex.Direct interface (see the section Transferring funds between campaigns).

One of the restrictions is that you are not allowed to transfer out funds that came from certain Yandex marketing programs, such as coupons or discounts. In such cases, the amount being deducted is automatically reduced to the amount that is allowed to be transferred out of the campaign, and this smaller amount is credited to the other campaign. If several campaigns are specified for crediting funds to, the amount they receive is decreased such that the credited amounts maintain the same proportion as the amounts that were originally specified.

Currency restrictions

Attention. Transferring funds between campaigns in different currencies is not supported.

All campaigns that funds are deducted from or credited to must be in the same currency.

Transfer amounts (the Sum parameter) should be specified in the campaign currency (by setting the corresponding value for the Currency parameter). All amounts must be specified in the same currency.

New in the Live 4 version

The Currency input parameter is required.

Added the Currency input parameter.

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 more information, see the Accessing finance methods.
{
   "method": "TransferMoney",
   "finance_token": (string),
   "operation_num": (int),
   "param": {
      /* TransferMoneyInfo */
      "FromCampaigns": [
         {  /* PayCampElement */
            "CampaignID": (int),
            "Sum": (float),
            "Currency": (string)
         }
         ...
      ],
      "ToCampaigns": [
         {  /* PayCampElement */
            "CampaignID": (int),
            "Sum": (float),
            "Currency": (string)
         }
         ...
      ]
   }
}

Parameters are described below.

Parameter Description Required
TransferMoneyInfo object
FromCampaigns

Array of PayCampElement objects. Each object specifies the campaign to deduct funds from, and the amount to deduct.

Yes
ToCampaigns

Array of PayCampElement objects. Each object specifies the campaign to add funds to, and the amount to credit.

Yes
PayCampElement object
CampaignID The campaign ID. Yes
Sum

The amount (in the currency specified in the Currency parameter) to deduct from or credit to a campaign (depending on whether the object is part of the FromCampaigns array or the ToCampaigns array).

Before deducting or crediting the amount, it is mathematically rounded to the second decimal point (for all currencies, including the tenge).

If the value is expressed in a real currency, it does not include VAT.

To find out the amount available to transfer, use the GetCampaignsParams (Live) method (SumAvailableForTransfer parameter).

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 campaign currency; otherwise, an error is returned with code 245.

Yes

Output data

Returns the value 1 when funds were transfered successfully, as shown below. If unsuccessful, an error message is returned.

{ "data": 1 }

Examples of input data

Python

{
   'FromCampaigns': [
      {'CampaignID': 1327837, 'Sum': 25000, 'Currency': 'RUB'}
   ],
   'ToCampaigns': [
      {'CampaignID': 1327944, 'Sum': 20000, 'Currency': 'RUB'},
      {'CampaignID': 1327953, 'Sum': 5000, 'Currency': 'RUB'}
   ]
}

PHP

array(
   'FromCampaigns' => array(
      array('CampaignID' => 1327837, 'Sum' => 25000, 'Currency' => 'RUB')
   ),
   'ToCampaigns' => array(
      array('CampaignID' => 1327944, 'Sum' => 20000, 'Currency' => 'RUB'),
      array('CampaignID' => 1327953, 'Sum' => 5000, 'Currency' => 'RUB')
   )
)

Perl

{
   'FromCampaigns' => [
      {'CampaignID' => 1327837, 'Sum' => 25000, 'Currency' => 'RUB'}
   ],
   'ToCampaigns' => [
      {'CampaignID' => 1327944, 'Sum' => 20000, 'Currency' => 'RUB'},
      {'CampaignID' => 1327953, 'Sum' => 5000, 'Currency' => 'RUB'}
   ]
}