PHP code example of fulfillment / postage-api

1. Go to this page and download the library: Download fulfillment/postage-api 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/ */

    

fulfillment / postage-api example snippets


use Fulfillment\Postage\Postage;
use Fulfillment\Postage\Models\Request;

$postageWrapper = new PostageClient(__DIR__); //instantiate Postage with a configuration file or array of settings

$postageObj = new Postage($data); //use plain PHP classes to model a the JSON request that should be sent to the API
$postageObj->setShipper = 'YOUR_SHIPPER';

$postageResponse = $postageWrapper->postage->createPostage($postageObj); //make a request, get a response back as a model


$postageWrapper = new PostageClient('absolute/path/to/a/folder')

$config = [
    'username' => '',
    'password' => '',
    'clientId' => '',
    'clientSecret' => '',
    'accessToken' => '',
    'endpoint' => '',
    'jsonOnly' => false,
    'validateRequests' => true
];

$postageWrapper = new PostageClient($config)