forked from clousale/amazon-sp-api-php
-
Notifications
You must be signed in to change notification settings - Fork 0
/
index.php
35 lines (23 loc) · 960 Bytes
/
index.php
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
<?php
require_once './vendor/autoload.php';
$options = require_once('parameters.php');
$accessToken = \ClouSale\AmazonSellingPartnerAPI\SellingPartnerOAuth::getAccessTokenFromRefreshToken(
$options['refresh_token'],
$options['client_id'],
$options['client_secret']
);
// var_dump($accessToken); die();
$config = \ClouSale\AmazonSellingPartnerAPI\Configuration::getDefaultConfiguration();
$config->setHost($options['endpoint']);
$config->setAccessToken($accessToken);
$config->setAccessKey($options['access_key']);
$config->setSecretKey($options['secret_key']);
$config->setRegion($options['region']);
try {
$apiInstance = new \ClouSale\AmazonSellingPartnerAPI\Api\OrdersApi($config);
$result = $apiInstance->getOrder('TEST_CASE_200');
var_dump($result);
var_dump($result->getPayload()->getAmazonOrderId());
} catch (Exception $e) {
echo 'Exception when calling OrdersV0Api->getOrder: ', $e->getMessage(), PHP_EOL;
}