PHP code example of zero-to-prod / spapi-tokens

1. Go to this page and download the library: Download zero-to-prod/spapi-tokens 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/ */

    

zero-to-prod / spapi-tokens example snippets


use Zerotoprod\SpapiTokens\SpapiTokens;

$response = SpapiTokens::createRestrictedDataToken(
    'access_token',
    'path',
    ['dataElements'],
    'targetApplication',
    'user-agent',
    'https://sellingpartnerapi-na.amazon.com/tokens/2021-03-01/restrictedDataToken'
);

$response['response']['restrictedDataToken'];
$response['response']['expiresIn'];