PHP code example of toancong / amazon-mws-laravel

1. Go to this page and download the library: Download toancong/amazon-mws-laravel 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/ */

    

toancong / amazon-mws-laravel example snippets


$config = [
    'merchantId' => '',
    'marketplaceId' => '',
    'keyId' => '',
    'secretKey' => '',
    'amazonServiceUrl' => '',
];

use KeithBrink\AmazonMws\AmazonOrderList;

function getAmazonOrders() {
    $amz = new AmazonOrderList("myStore"); //store name matches the array key in the config file
    $amz->setLimits('Modified', "- 24 hours");
    $amz->setFulfillmentChannelFilter("MFN"); //no Amazon-fulfilled orders
    $amz->setOrderStatusFilter(
        array("Unshipped", "PartiallyShipped", "Canceled", "Unfulfillable")
        ); //no shipped or pending
    $amz->setUseToken(); //Amazon sends orders 100 at a time, but we want them all
    $amz->fetchOrders();
    return $amz->getList();
}

use KeithBrink\AmazonMws\AmazonFeed;

function sendInventoryFeed($feed) {
    $config = [
        'merchantId' => '',
        'marketplaceId' => '',
        'keyId' => '',
        'secretKey' => '',
        'amazonServiceUrl' => '',
    ];

    $amz = new AmazonFeed("myStore"); //store name matches the array key in the config file
    $amz->setConfig($config);
    $amz->setFeedType("_POST_INVENTORY_AVAILABILITY_DATA_"); //feed types listed in documentation
    $amz->setFeedContent($feed);
    $amz->submitFeed();
    return $amz->getResponse();
}