PHP code example of qskane / easy-amazon-advertising

1. Go to this page and download the library: Download qskane/easy-amazon-advertising 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/ */

    

qskane / easy-amazon-advertising example snippets


use easyAmazonAdv\Factory;

$config = [
    'clientId'      => 'amzn1.application-oa2-client.xxx',
    'clientSecret'  => '3b758af8d13ee02355764e4e864fxxxx',
    'refreshToken'   => 'Atzr|IwEBIL5GyUh_H2fdRJnFOk7mmpluKnm7WWUW0kf0tBxAXFMG5VHyiZuIhrspq6hZRHzPM03RMX7v64KrhXaO9xCtylMUQPcN0LolQhH8PNff76Ve5pS6PO9jtNG9kW1K9YtV1WcJDN3KnGpHjk0dUBtbbrn5uh8EGDDVUR_gpqaHXqqdvZ7vuUXTNzstH-tybiAzspzIPxPf7Ans-uyqPNyNTIIM61vA66fvPkH3-c33iLCzrgRtg_jhzWrZuH4K6INBfR8CjKHcK5oNun4DRTiOnCinvUdbHQPwAeI9m581FzUk2Hp4g5KaXO60A6-4me5EMuGSagWfUvTs1MkB1DgPAs_Do3v0TKKN1L6Vab4YgDu6k-bb5pgor_H_LQ24kbfc2Jdyq9BJkSVAAIP5Hh4y3i1qAh18g94Qq_yLWQOxu8ySawTUSDWOkM3_AH5qFS_Yaegfpc96nZE6_eDnycnnheFnXj14-ghaNsROG4LO2RE4n4xnpj9vx9o5aOFVGhf148Cz_VZjiZCg2t_V0Mru7uYRkwz1OUOxxxxxxxxxxx',
    'region'       => 'NA',
];

$app    = Factory::BaseService($config);
$result = $app->access_token->RefreshToken();

$app->profiles->listProfiles();

[[
  "profileId":1234567890,
  "countryCode":"US",
  "currencyCode":"USD",
  "dailyBudget":10.00,
  "timezone":"America/Los_Angeles",
  "accountInfo":{
  "marketplaceStringId":"ABC123",
  "sellerStringId":"DEF456"
]]

php: >=7.2.0
guzzlehttp/guzzle: 6.4.*
pimple/pimple: ~3.0


$params = [
    [
        "name" => "My Campaign One",
        "tactic" => "remarketing",
        "budgetType": "daily",
        "budget": 3.00,
        "startDate": "20190101",
        "endDate": null,
        "state": "enabled"
    ]
];

$result = $app->campaigns->createCampaigns(params);

[
  [
    "code": "SUCCESS",
    "campaignId": 173284463890123
  ]
]