PayCampaigns
Paying for campaigns using an advertising agency's credit limit.
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.
Direct advertisers can pay for a campaign only when it has been approved by a moderator (see the campaign parameter StatusModerate).
Recommendations and restrictions
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.
{
"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 | ||
---|---|---|
Payments | Array of PayCampElement objects. Each object specifies the campaign and the amount to be paid by credit. | Yes |
ContractID | The number of the credit agreement. | Yes |
PayMethod | 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 | ||
CampaignID | The campaign ID. | Yes |
Sum | The amount in Yandex units to be paid by credit. | Yes |
Parameter | Description | Required |
PayCampaignsInfo object | ||
---|---|---|
Payments | Array of PayCampElement objects. Each object specifies the campaign and the amount to be paid by credit. | Yes |
ContractID | The number of the credit agreement. | Yes |
PayMethod | 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 | ||
CampaignID | The campaign ID. | Yes |
Sum | The amount in Yandex units to be paid by credit. | Yes |
Output data
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'
}