---
metadata:
  - name: generator
    content: Diplodoc Platform v5.50.2
alternate:
  - https://yandex.com/dev/direct/doc/dg-v4/en/reference/PayCampaigns.md
  - https://yandex.com/dev/direct/doc/dg-v4/ru/reference/PayCampaigns.md
---
> **Documentation Index:** Fetch the complete configuration index at https://yandex.com/dev/direct/doc/dg-v4/en/llms.txt

# PayCampaigns
Paying for campaigns using an advertising agency's credit limit.

{% note 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](https://yandex.com/dev/direct/doc/migration/concepts/methods.md).

{% endnote %}


The [PayCampaigns (Live)](https://yandex.com/dev/direct/doc/dg-v4/en/live/PayCampaigns.md) version also exists for this method.

Credit is given to advertising agencies who have signed special credit agreements. The [GetCreditLimits](https://yandex.com/dev/direct/doc/dg-v4/en/reference/GetCreditLimits.md) 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.


{% note alert %}

Direct advertisers can pay for a campaign only when it has been approved by a moderator (see the campaign parameter StatusModerate).

{% endnote %}


## Recommendations and restrictions


{% note alert %}

All campaigns specified in the same method call must be of the same type. [More information about campaign types](https://yandex.com/dev/direct/doc/dg/objects/campaign.md)

{% endnote %}


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](https://yandex.com/dev/direct/doc/dg-v4/en/reference/CreateInvoice.md)), transferring funds ([TransferMoney](https://yandex.com/dev/direct/doc/dg-v4/en/reference/TransferMoney.md)), and delayed payment ([PayCampaigns](https://yandex.com/dev/direct/doc/dg-v4/en/reference/PayCampaigns.md)).

Exceeding these limits results in the error [56](https://yandex.com/dev/direct/doc/dg-v4/en/reference/ErrorCodes.md#ErrorCode56).


## Input data {#input}

The input data structure in JSON is shown below.


{% note alert %}

It is mandatory to include the `finance_token` and `operation_num` parameters in the request. For more information, see the [Accessing finance methods](https://yandex.com/dev/direct/doc/dg-v4/en/concepts/finance-token.md).

{% endnote %}


```javascript
{
   "method": "PayCampaigns",
   "finance_token": (string),
   "operation_num": (int),
   "param": {
      /* PayCampaignsInfo */
      "Payments": [
         {  /* PayCampElement */
            "CampaignID": (int),
            "Sum": (float)
         }
         ...
      ],
      "ContractID": (string),
      "PayMethod": (string)
   }
}
```

Parameters are described below.


#|
||
**<sup >Parameter</sup>**
|
**<sup >Description</sup>**
|
**<sup >Required</sup>**
||

||
**<sub >PayCampaignsInfo object</sub>**
||
||
`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
||

||
**<sub >PayCampElement object</sub>**
||
||
`CampaignID`
|
The campaign ID.
|
Yes
||
||
`Sum`
|
The amount in Yandex units to be paid by credit.
|
Yes
||
|#


## Output data {#output}

Returns 1 if successful, as shown in the following example.

```javascript
{
   "data": 1
}
```

For an invalid request, possible error codes are [355](https://yandex.com/dev/direct/doc/dg-v4/en/reference/ErrorCodes.md#errorCode355), [356](https://yandex.com/dev/direct/doc/dg-v4/en/reference/ErrorCodes.md#errorCode355), and [357](https://yandex.com/dev/direct/doc/dg-v4/en/reference/ErrorCodes.md#errorCode357).


## Examples of input data {#examples}

## Python

```python
{
   'Payments': [
      {'CampaignID': 3193279, 'Sum': 1200.0},
      {'CampaignID': 3193478, 'Sum': 700.0}
   ],
   'ContractID': '23452345/67',
   'PayMethod': 'Bank'
}
```

## PHP

```php
array(
   'Payments' => array(
      array('CampaignID' => 3193279, 'Sum' =1200.0)
      array('CampaignID' => 3193478, 'Sum' =700.0)
   ),
   'ContractID' => '23452345/67',
   'PayMethod' ='Bank'
)
```

## Perl

```perl
{
   'Payments' => [
      {'CampaignID' => 3193279, 'Sum' =1200.0}
      {'CampaignID' => 3193478, 'Sum' =700.0}
   ],
   'ContractID' => '23452345/67',
   'PayMethod' ='Bank'
}
```


