select-co/module-sage200-api

Magento 2 connector to interact with Sage200 API

Installs: 5

Dependents: 0

Suggesters: 0

Security: 0

Stars: 0

Watchers: 0

Forks: 1

Open Issues: 0

Type:magento2-module

pkg:composer/select-co/module-sage200-api

1.0.2 2025-10-20 08:21 UTC

This package is auto-updated.

Last update: 2025-10-20 13:31:50 UTC


README

Github license Open issues Open Pull Requests Last commit

An unofficial API client to interact with the Sage200 API.

Requirements

  • Sage200
    • Sage200 API setup and configured.
    • Developer subscription key
    • Client ID & Client Secret
  • Magento 2 (tested with 2.3.5)
  • PHP ^7.3

Sage 200 API Credentials Request Form

Admin configuration for Refresh Token Expiry Days must match the value on Sage 200 API Credentials Request Form.

The callback URL entered on the request form must be https://{SUBDOMAIN}.{DOMAIN}/{ADMIN_ROUTE}/s200/oauth/callback

e.g. https://shop.example.com/admin_5fj7t/s200/oauth/callback

Authentication

This client uses league/oauth2-client for authentication using the Authorization Code Grant and credentials provided in Admin configuration.

For more information, please refer to the official Sage200 API Documentation.

Installation

Add GitHub repo to your composer.json repositories.

{
  "repositories": [
    {
      "type": "vcs",
      "url": "https://github.com/SelectCo/magento2-module-sage200-api.git"
    }
  ]
}

Require package with composer.

composer require select-co/module-sage200-api

Configuration

Admin configurations must be set before use.

  • API OAuth Details
    • Client Id
    • Client Secret
    • Developer Subscription Key
    • X-Site Id
    • X-Company Id

Default values used for:-

  • Sage200 Base Url
  • Authorise URL
  • Access Token URL
  • Resource Owner URL
  • Scope Access

Token Management

Token management is done through Admin => System => Other Settings => Sage200 Token Management where you can refresh, or get a new token.

Details of a valid token are displayed here with available companies.

CLI/Console Commands

  • sage200:token:check

    • Checks whether the current access token and refresh token are valid and reports time to expiry.
    • Usage: bin/magento sage200:token:check
  • sage200:token:refresh

    • Tries to refresh the access token using the stored refresh token and outputs new expiry times.
    • Usage: bin/magento sage200:token:refresh

Cron

  • The module includes a scheduled job that:
    • Refreshes the access token automatically when it has less than 30 minutes remaining. This can be changed in the Admin configuration.
    • Sends email notifications when the access token is missing/expired or the refresh token is nearing expiry, according to Admin configuration.
  • Ensure Magento cron is configured on your environment.

Usage

$results = json_decode(
    $this->connector->send(
        'sop_orders',
        'GET',
        $query
    ), true
);
$results = json_decode(
    $this->connector->send(
      'sop_orders/' . $id,
      'GET',
      $query
    ), true
);

Changelog

Please see CHANGELOG for more information on what has changed recently.

Resources

Sage 200 API Documentation

License

MIT. See LICENSE.

Support

If you have a feature request or spotted a bug or a technical problem, create a GitHub issue.