1. Go to this page and download the library: Download kagaroty/dostavista library. Choose the download type require.
2. Extract the ZIP file and open the index.php.
3. Add this code to the index.php.
<?php
require_once('vendor/autoload.php');
/* Start to develop here. Best regards https://php-download.com/ */
kagaroty / dostavista example snippets
// Note, that we use sandbox API URL here, change to production one after tests
$client = new \Dostavista\Dostavista(new \GuzzleHttp\Client, [
'baseUrl' => 'https://robotapitest.dostavista.ru/api/business/1.1',
'token' => '...'
]);
use Dostavista\OrderRequest;
use Dostavista\Point;
use Dostavista\ContactPerson;
$orderRequest = (new OrderRequest('Весы'))
->setVehicleType(6)
->setBackpaymentDetails('Карта Сбербанка XXXX, получатель СЕРГЕЙ ИВАНОВИЧ П')
->setPoints([
(new Point(
'Москва, Магистральный пер., 1',
new DateTime('17:00'),
new DateTime('18:00'),
(new ContactPerson([
'name' => 'Иванов Иван Иванович',
'phone' => '4951234567'
]))
)),
(new Point(
'Москва, Бобруйская, 28',
new DateTime('18:00'),
new DateTime('19:00'),
(new ContactPerson([
'phone' => '9261234567'
]))
))
->setTaking(3000),
]);
$deliveryFee = $client->calculateOrder($orderRequest);
use Dostavista\OrderRequest;
use Dostavista\Point;
use Dostavista\ContactPerson;
$orderRequest = (new OrderRequest('Весы'))
->setVehicleType(6)
->setBackpaymentDetails('Карта Сбербанка XXXX, получатель СЕРГЕЙ ИВАНОВИЧ П')
->setPoints([
(new Point(
'Москва, Магистральный пер., 1',
new DateTime('17:00'),
new DateTime('18:00'),
(new ContactPerson([
'name' => 'Иванов Иван Иванович',
'phone' => '4951234567'
]))
))
->setNote('Комплекс "Сити-Бокс"'),
(new Point(
'Москва, Бобруйская, 28',
new DateTime('18:00'),
new DateTime('19:00'),
(new ContactPerson([
'phone' => '9261234567'
]))
))
->setNote('Дополнительная информация о заказе для курьера: номер офиса или квартиры И Т.Д.')
->setInvisibleMileNavigationInstructions('Инструкция для курьера, как пройти до получателя на месте')
->setTaking(3000),
]);
$orderId = $client->createOrder($orderRequest);
$courier = $client->getCourier(123456);
use Dostavista\CancelRequest;
$client->cancelOrder(new CancelRequest(123456));
Loading please wait ...
Before you can download the PHP files, the dependencies should be resolved. This can take some minutes. Please be patient.