PayCampaigns
Paying for campaigns using an advertising agency's credit limit.
Alert
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 PayCampaigns (Live) version also exists for this method.
Credit is given to advertising agencies who have signed special credit agreements. The GetCreditLimits method returns information about available credit.
When paying for campaigns by credit, a print version of the invoice is generated automatically; it can be obtained via the Yandex Direct interface.
Alert
Direct advertisers can pay for a campaign only when it has been approved by a moderator (see the campaign parameter StatusModerate).
Recommendations and restrictions
Alert
All campaigns specified in the same method call must be of the same type. More information about campaign types
We recommend paying for campaigns using as few calls of the PayCampaign
method per day as possible. This recommendation is aimed at improving the performance of the Yandex Direct API. In terms of productivity, it is better to pay for several campaigns at once using a single method call than to make multiple calls to pay for each campaign individually.
Restrictions on method calls:
- A single user can call the method 1000 times per day.
- A single campaign can have no more than 30 transactions per day, including generating invoices (CreateInvoice), transferring funds (TransferMoney), and delayed payment (PayCampaigns).
Exceeding these limits results in the error 56.
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 more information, see the Accessing finance methods.
{
"method": "PayCampaigns",
"finance_token": (string),
"operation_num": (int),
"param": {
/* PayCampaignsInfo */
"Payments": [
{ /* PayCampElement */
"CampaignID": (int),
"Sum": (float)
}
...
],
"ContractID": (string),
"PayMethod": (string)
}
}
Parameters are described below.
Parameter |
Description |
Required |
PayCampaignsInfo object |
||
|
Array of |
Yes |
|
The number of the credit agreement. |
Yes |
|
How credit will be repaid. Affects how the invoice is generated. Currently, this parameter must have the value “Bank”, which indicates a bank transfer. |
Yes |
PayCampElement object |
||
|
The campaign ID. |
Yes |
|
The amount in Yandex units to be paid by credit. |
Yes |
Output data
Returns 1 if successful, as shown in the following example.
{
"data": 1
}
For an invalid request, possible error codes are 355, 356, and 357.
Examples of input data
Python
{
'Payments': [
{'CampaignID': 3193279, 'Sum': 1200.0},
{'CampaignID': 3193478, 'Sum': 700.0}
],
'ContractID': '23452345/67',
'PayMethod': 'Bank'
}
PHP
array(
'Payments' => array(
array('CampaignID' => 3193279, 'Sum' =1200.0)
array('CampaignID' => 3193478, 'Sum' =700.0)
),
'ContractID' => '23452345/67',
'PayMethod' ='Bank'
)
Perl
{
'Payments' => [
{'CampaignID' => 3193279, 'Sum' =1200.0}
{'CampaignID' => 3193478, 'Sum' =700.0}
],
'ContractID' => '23452345/67',
'PayMethod' ='Bank'
}