merchium/merchium-sdk

v1.0.2 2015-09-24 11:44 UTC

This package is not auto-updated.

Last update: 2025-05-06 07:09:04 UTC


README

Hello and welcome to Merchium PHP SDK, a Merchium app development toolkit for PHP developers.

Merchium PHP SDK consists of the MerchiumClient.php PHP library and an example app (see it described in the docs).

MerchiumClient.php

Use the MerchiumClient.php library to interact with the Merchium REST API. The library contains a single class MerchiumClient which offers methods for API interaction.

You can find the current library version in the MerchiumClient::LIB_VERSION constant.

The MerchiumClient Class Methods

  1. __construct($app_key, $shared_secret, $shop_domain = '', $access_token = '')—class constructor.
  1. setAccessToken($shop_domain)—set the API access token value.
  • $shop_domain—unique store domain at mymerchium.com (e.g. mystore.mymerchium.com).
  1. setShopDomain($access_token)—set the store domain value.
  • $access_token—API access token.
  1. getInstallationUrl($scope, $redirect_uri = '')—get the app installation link (see Authorization. AccessToken). Normally, you don't need to call this method manually, because the Marketplace generates the link itself.
  • $scope—permission scope list.
  • $redirect_uri—post-install redirect URI .
  1. requestAccessToken($code)—send a request to get an API access token.
  1. getRequest($path, $params)—send a request to get object data.
  1. createRequest($path, $params)—send a request to create an object.
  1. updateRequest($path, $params)—send a request to update object data.
  1. deleteRequest($path)—send a request to delete an object.
  1. testRequest()—send a test request, e.g. to check the connection.

  2. validateSignature($get)—validate the signature of an incoming request (see Authorization. AccessToken).

  • $get—request params, usually a $_GET array.
  1. getLastErrorStatus()—get the last error code from the API response. See Error Codes.

  2. getLastError()—get the last error message from the API response. See Error Codes.

Errors Returned by the API

See Error Codes.

Errors Returned by the Library

  • Curl PHP module not found—the curl PHP extension not found.
  • Сurl error(CODE): ERROR—errors returned by the curl extension.
  • Could not JSON-encode the request data—error during JSON encoding.
  • Could not JSON-decode the response—error during deconding of the server returned JSON data.
  • Empty response—empty response from the server.