TransferMoney

Transfers funds between campaigns.

Attention.

Disabled method. Use version 5 of the API.

For information about the compatibility of methods between versions 4 and 5, see the Migration guide.

The TransferMoney (Live) version also exists for this method.

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.

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)
         }
         ...
      ],
      "ToCampaigns": [
         {  /* PayCampElement */
            "CampaignID": (int),
            "Sum": (float)
         }
         ...
      ]
   }
}

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 Yandex units that is being deducted from or credited to a campaign (depending on whether the object is part of the FromCampaigns array or the ToCampaigns array).

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

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': 2500}
   ],
   'ToCampaigns': [
      {'CampaignID': 1327944, 'Sum': 2000},
      {'CampaignID': 1327953, 'Sum': 500}
   ]
}

PHP

array(
   'FromCampaigns' => array(
      array('CampaignID' => 1327837, 'Sum' => 2500)
   ),
   'ToCampaigns' => array(
      array('CampaignID' => 1327944, 'Sum' => 2000),
      array('CampaignID' => 1327953, 'Sum' => 500)
   )
)

Perl

{
   'FromCampaigns' => [
      {'CampaignID' => 1327837, 'Sum' => 2500}
   ],
   'ToCampaigns' => [
      {'CampaignID' => 1327944, 'Sum' => 2000},
      {'CampaignID' => 1327953, 'Sum' => 500}
   ]
}