shopgate/connect-integration-sdk-php

A PHP framework supporting the integration with the Shopgate Connect Platform.


README

Build Status Coverage Status License GitHub (pre-)release

The Shopgate Connect Integration SDK is a compilation of classes to manage the communication between your shop system and Shopgate Connect.

Create a developer account at https://developer.shopgate.com

Requirements

  • PHP 5.6 and above

Installation

composer require shopgate/connect-integration-sdk-php

Or download and unzip from the releases page.

Migration to 2.x

If you're upgrading from 1.x to 2.x, read the migration guide.

Quick Start

Order creation example (see Order API docs for full request spec):

<?php
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'      => 'my.address@my-domain.com',
    '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);
}

Configuration Parameters

  • clientId (string) - oAuth2 client ID
  • clientSecret (string) - oAuth2 client secret
  • merchantCode (string) - merchant code provided to you upon registration
  • username - (string) - the email address of the user called "Api Credentials" at Shopgate Next Admin
  • password - (string) - the password of the user called "Api Credentials" at Shopgate Next Admin
  • env (string, default: production) - one of "dev", "staging", "production"

Changelog

See CHANGELOG.md file for more information.

Contributing

See CONTRIBUTING.md file for more information.

About Shopgate

Shopgate is the leading mobile commerce platform.

License

The Shopgate Connect Integration SDK is available under the Apache License, Version 2.0.

See the LICENSE.md file for more information.

Advanced

"baseUri" Configuration

For testing against an echo service the baseUri config can be overridden. It defaults to https://{service}.shopgate{env}.io/{version}/merchants/{merchantCode}/, supporting template variables:

  • service - the service name, different for each request
  • env - the Shopgate environment-dependent domain suffix; this will automatically be replaced with one of "dev", "pg" (staging) or "" (production)
  • version - the API version, may be different for each request
  • merchantCode - the merchant code set in the configuration