# CreateProfileRequest

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

Обязательные параметры запроса: INN, ORGANISATION\_SHORT\_NAME, EMAIL, URL, UNITID - номер юнита группы “Зарегистрированные клиенты”.

Ответ содержит номер созданного личного кабинета (юнита) клиента.

```java
Запрос:
{  
   "Envelope":{  
      "Header":{  
         "Security":{  
            "UsernameToken":{  
               "Username":"Username",
               "Password":"Password"
            }
         }
      },
      "Body":{  
         "CreateProfileRequest":{  
            "unitId":НОМЕР ЮНИТА ГРУППЫ "ЗАРЕГИСТРИРОВАННЫЕ ПАРТНЕРЫ ПЛОЩАДКИ",
            "profileType":"organization",
            "profile":{  
               "attribute":[  
                  {  
                     "key":"ORGANIZATION_NAME_SHORT",
                     "value":"ООО Маркетплейс"
                  },
                  {  
                     "key":"INN",
                     "value":"1234567890"
                  },
                  {  
                     "key":"CONTACT_EMAIL",
                     "value":"test@test.ru"
                  },
                  {  
                     "key":"URL",
                     "value":"payanyway.marketplace.ru"
                  }
               ]
            }
         }
      }
   }
}

Ответ:
{  
   "Envelope":{  
      "Body":{  
         "CreateProfileResponse":12345
      }
   }
}

```

```php
<?php
if (isset($_POST['org_name_short']) && isset($_POST['org_inn']) && isset($_POST['org_email']) && isset($_POST['org_url'])) {

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

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

        $request = new \Moneta\Types\CreateProfileRequest();
        $request->unitId = 1111111111;
        $request->profileType = \Moneta\Types\ProfileType::organization;

        $profile = new \Moneta\Types\Profile();

        //краткое название организации
        $attribute = new \Moneta\Types\KeyValueApprovedAttribute();
        $attribute->approved = false;
        $attribute->key = "ORGANIZATION_NAME_SHORT";
        $attribute->value = $_POST['org_name_short'];
        $profile->addAttribute($attribute);

        //ИНН организации
        $attribute = new \Moneta\Types\KeyValueApprovedAttribute();
        $attribute->approved = false;
        $attribute->key = "INN";
        $attribute->value = $_POST['org_inn'];
        $profile->addAttribute($attribute);

        //контактный e-mail
        $attribute = new \Moneta\Types\KeyValueApprovedAttribute();
        $attribute->approved = false;
        $attribute->key = "CONTACT_EMAIL";
        $attribute->value = $_POST['org_email'];
        $profile->addAttribute($attribute);

        //адрес сайта организации
        $attribute = new \Moneta\Types\KeyValueApprovedAttribute();
        $attribute->approved = false;
        $attribute->key = "URL";
        $attribute->value = $_POST['org_url'];
        $profile->addAttribute($attribute);

        $request->profile = $profile;

        //создание новой организации(продавца)
        $result = $monetaSdk->monetaService->CreateProfile($request);

        if (is_array($result) || (strlen($result) !== strlen(intval($result)))) {
            throw new Exception(print_r($result, true));
        }

        echo "UNIT ID нового продавца: $result<br/><br/>";
        echo "Запишите UNIT ID нового продавца. Он понадобится для совершения дальнейших шагов.";

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

} else {
    echo '
        <form method="post">
            Краткое название организации:<br/>
            <input type="text" name="org_name_short" placeholder="ООО &#34;Маркетплейс&#34;"/><br/><br/>
            
            ИНН организации:<br/>
            <input type="text" name="org_inn"/><br/><br/>
            
            Контактный e-mail:<br/>
            <input type="text" name="org_email"/><br/><br/>
            
            Url сайта:<br/>
            <input type="text" name="org_url" placeholder="http://example.ru"/><br/><br/>
            
            <input type="submit" value="Создать профиль организации"/>
        </form>
    ';
}
```

Полученное значение unitid маркетплейсу необходимо сохранить в своей системе учета.

Каждому юниту (unitid) соответствует базовый профиль (profileid), его значение можно получить в ответе на запрос CheckProfileRequest.

Все запросы маркетплейс отправляет с помощью интерфейса 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/createprofilerequest.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.
