PHP code example of codefit / wolt-api-client

1. Go to this page and download the library: Download codefit/wolt-api-client 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/ */

    

codefit / wolt-api-client example snippets


use Wolt\Api\OrderClient;
use Wolt\Api\MenuClient;

// Initialize Order client
$orderClient = new OrderClient('your-client-id', 'your-client-secret');

// Initialize Menu client
$menuClient = new MenuClient('your-client-id', 'your-client-secret');

// Get order details
$order = $orderClient->getOrder('order-id');

// Mark order as ready
$orderClient->markOrderReady('order-id');

// Mark order as delivered
$orderClient->markOrderDelivered('order-id');

// Reject order
$orderClient->rejectOrder('order-id', 'Out of stock');

// Get menu for a venue
$menu = $menuClient->getMenu('venue-id');

// Update menu
$menuClient->updateMenu('venue-id', [
    // Menu data structure
]);

// Update item availability
$menuClient->updateItemAvailability('venue-id', 'item-id', false);

// Update item price
$menuClient->updateItemPrice('venue-id', 'item-id', 9.99);

use Wolt\Api\Exception\AuthenticationException;
use GuzzleHttp\Exception\GuzzleException;

try {
    $order = $orderClient->getOrder('order-id');
} catch (AuthenticationException $e) {
    // Handle authentication errors
} catch (GuzzleException $e) {
    // Handle API request errors
}