PHP code example of astgroup / laravel-amazon-mws

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

    

astgroup / laravel-amazon-mws example snippets


use LaravelAmazonMws\AmazonOrderList;

$amz = new AmazonOrderList($store); // Store array
$amz->setLimits('Modified', "- 5000 hours");
$amz->setFulfillmentChannelFilter("AFN"); //Amazon-fulfilled orders
$amz->setOrderStatusFilter(
    array("Shipped")
    ); 
$amz->setUseToken(); //Amazon sends orders 100 at a time, but we want them all
$amz->fetchOrders();
$amz->getList();

//Set up the MWS configutation as defined in the LaravelSettings Object by app.

Setting::set("storeName","mystore"); // This will be the key to store the configuration, you pass this as an option to objects you instanstiate with setstore() 
Setting::set("authToken",""); //Mws Auth Token - For third party users.
Setting::set("merchantId","");  //Seller ID
Setting::set("marketplaceId",""); //Marketplace ID 
Setting::set("keyId","");  //Key ID
Setting::set("secretKey",""); //Secret Key 
Setting::set("amazonServiceUrl","");  // Set to your relevant URL if different from default
Setting::set("muteLog","false");  //To log requests, make it true on production to stop logging.

use Mws\Laravel\AmazonOrderList;

$amz = new AmazonOrderList(Setting::get('storeName')); //Store name matches the array key in the settings
$amz->setLimits('Modified', "- 5000 hours");
$amz->setFulfillmentChannelFilter("AFN"); //Amazon-fulfilled orders
$amz->setOrderStatusFilter(
    array("Shipped")
    ); 
$amz->setUseToken(); //Amazon sends orders 100 at a time, but we want them all
$amz->fetchOrders();
$amz->getList();

php artisan vendor:publish