PHP code example of shopgate / connect-integration-sdk

1. Go to this page and download the library: Download shopgate/connect-integration-sdk 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/ */

    

shopgate / connect-integration-sdk example snippets



use Shopgate\ConnectSdk\ShopgateSdk;

$order = [
    'localeCode' => 'de-de',
    'currencyCode' => 'EUR',
    'addressSequences' => [...],
    'primaryBillToAddressSequenceIndex' => 0,
    'lineItems' => [...],
    'subTotal' => 109.99,
    'total' => 115.89,
    'submitDate' => '2019-09-02T09:02:57.733Z',
    'imported' => true
];

$config = [
    'merchantCode'  => 'MERCHANT_CODE',
    'clientId'      => 'my-client',
    'clientSecret'  => '*******',
    'username'      => '[email protected]',
    'password'      => '*******',
    'env'           => 'pg' // Optional. "dev", "pg" or empty (= production)
];

$sgSdk = new ShopgateSdk($config);

try {
    $response = $sgSdk->getOrderService()->addOrders([$order]);
    var_dump($resonse);
} catch (\Exception $e) {
    var_dump($e);
}
composer