When creating an electronic invoice (EN), I get two errors:

1) ContactSender not selected

2) Sender's contact person is not full! You must specify the Sender completely. This contact person will receive a money transfer.

This is due to the fact that I in the request do not pass the identifier of the contacts of the sender, for the reason that I do not know where to get the same identifier.

For work, I use this library .

My request:

include "api2.php"; $np = new Api2('мой ключ'); $senderInfo = $np->getCounterparties('Sender', 1, '', ''); $sender = $senderInfo['data'][0]; $senderWarehouses = $np->getWarehouses($sender['City']); $result = $np->newInternetDocument([ // Данные отправителя 'FirstName' => $sender['FirstName'], 'MiddleName' => $sender['MiddleName'], 'LastName' => $sender['LastName'], 'Description' => $sender['Description'], 'Phone' => '0487447747', 'CitySender' => $sender['City'], 'SenderAddress' => $senderWarehouses['data'][0]['Ref'], 'ContactSender' => ?????????????????????? ], [ // Данные получателя 'FirstName' => 'Сидор', 'MiddleName' => 'Сидорович', 'LastName' => 'Сиродов', 'Phone' => '0509998877', 'City' => 'Киев', 'Region' => 'Киевская', 'Warehouse' => 'Отделение №3: ул. Калачевская, 13 (Старая Дарница)', ], [ 'DateTime' => date('dmY'), 'ServiceType' => 'WarehouseWarehouse', 'PaymentMethod' => 'Cash', 'PayerType' => 'Recipient', 'Cost' => '500', 'SeatsAmount' => '1', 'Description' => 'Кастрюля', 'CargoType' => 'Cargo', 'Weight' => '10', 'VolumeGeneral' => '0.5', 'BackwardDeliveryData' => [ [ 'PayerType' => 'Recipient', 'CargoType' => 'Money', 'RedeliveryString' => 4552, ] ] ] ); 

Well, the question itself, how to get the identifier of the sender's contacts?

    2 answers 2

     $senderCounterpartyExisting = $this->getCounterparties('Sender', 1, $sender['Description'], $sender['CityRef']); if ($senderCounterpartyExisting['data'][0]['Ref']) { $sender['Sender'] = $senderCounterpartyExisting['data'][0]['Ref']; $contactSender = $this->getCounterpartyContactPersons($sender['Sender']); $contactSender = $contactSender['data'][0]['Ref']; } 

    A source

    • I registered this way but received empty ContactSender and SendersPhone cells, is it possible that no contacts are indicated on the website of the new mail? And if possible, where to point them? - Arendach
    • I have no idea - Bookin

    The solution consists of two steps:

    1) Write the code to get the contact ID

      $senderCounterpartyExisting = $this->getCounterparties('Sender', 1, $sender['Description'], $sender['CityRef']); if ($senderCounterpartyExisting['data'][0]['Ref']) { $sender['Sender'] = $senderCounterpartyExisting['data'][0]['Ref']; $contactSender = $this->getCounterpartyContactPersons($sender['Sender']); $contactSender = $contactSender['data'][0]['Ref']; } 

    2) Create a contractor on the New Mail website in Settings> Counterparties