# CreateBankAccountRequest

Создание банковских реквизитов в личном кабинете (юните) клиента маркетплейса

```javascript
Запрос:
{  
   "Envelope":{  
      "Header":{  
         "Security":{  
            "UsernameToken":{  
               "Username":"Username",
               "Password":"Password"
            }
         }
      },
      "Body":{  
         "CreateBankAccountRequest":{  
            "unitId":12345,
           "attribute":             [
                              {
                  "value": "00000000000000000000",
                  "key": "ACCOUNT"
               },
                              {
                  "value": "000000000",
                  "key": "BIK"
               }
            ]
            }
         }

Ответ:

{  
   "Envelope":{  
      "Body":{  
         "CreateBankAccountResponse":{  
            "id":2105
         }
      }
   }
}
```

```php
<?php
if (isset($_POST['unit_id']) && isset($_POST['submit'])) {

    $sdkAppFileName = __DIR__ . "/../moneta-sdk-lib/autoload.php";
    include_once($sdkAppFileName);

    try {
        $monetaSdk = new \Moneta\MonetaSdk();
        $monetaSdk->checkMonetaServiceConnection();

        $request = new \Moneta\Types\CreateBankAccountRequest();
        $request->unitId = $_POST['unit_id'];

        //Номер расчётного счёта
        $attribute = new \Moneta\Types\KeyValueApprovedAttribute();
        $attribute->approved = false;
        $attribute->key = "ACCOUNT";
        $attribute->value = $_POST['account'];
        $request->addAttribute($attribute);

        //БИК банка
        $attribute = new \Moneta\Types\KeyValueApprovedAttribute();
        $attribute->approved = false;
        $attribute->key = "BIK";
        $attribute->value = $_POST['bik'];
        $request->addAttribute($attribute);

        //создание банковских реквизитов
        $result = $monetaSdk->monetaService->CreateBankAccount($request);

        if(!is_array($result) || !$result['id']){
            throw new Exception(print_r($result, true));
        }

        echo "Идентификатор банковских реквизитов в системе MONETA.RU: ".$result['id'];

    } catch (Exception $e) {
        echo "Произошла ошибка:<br />";
        echo "<pre>" . $e->getMessage() . "</pre>";
    }

} else {
    echo '
        <form method="post">
            unit ID организации (площадки):<br/>
            <input type="text" name="unit_id" required="required"/><br/><br/>

            Номер расчётного счёта:<br/>
            <input type="text" name="account" required="required" placeholder="12345678901234567890"/><br/><br/>

            БИК банка:<br/>
            <input type="text" name="bik" required="required" placeholder="123456789"/><br/><br/>
            
            <input type="submit" name="submit" value="Сохранить банковские реквизиты"/>
        </form>
    ';
}
```

Все запросы маркетплейс отправляет с помощью интерфейса MONETA.MerchantAPI.

{% hint style="info" %}
Интерфейс [MONETA.MerchantAPI](http://www.moneta.ru/doc/MONETA.MerchantAPI.v2.ru.pdf) представляет собой Web-сервис, описанный по спецификации Web Services Description Language [(WSDL)](https://service.moneta.ru/services.wsdl), использующий протокол Simple Object Access Protocol (SOAP) для передачи информации.
{% endhint %}


---

# Agent Instructions: Querying This Documentation

If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://docs.payanyway.ru/marketplace/zaprosy-dlya-registracii-ip-i-yul/13.-registraciya-prodavcov-ploshadki-v-sisteme-moneta.ru/13.5.-zaprosy-dlya-podklyucheniya-prodavca-k-sisteme-moneta.ru/createbankaccountrequest.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
