merchium / merchium-sdk
Merchium PHP SDK
Requires
- php: >=5.3.0
- lib-curl: *
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
__construct($app_key, $shared_secret, $shop_domain = '', $access_token = '')
—class constructor.
$app_key
—the App key app param (see the app page in your Merchium partner panel).$shared_secret
—the Client secret app param (see Регистрация учетной записи партнера и создание приложения).$shop_domain
—unique store domain at mymerchium.com (e.g. mystore.mymerchium.com).$access_token
—API access token.
setAccessToken($shop_domain)
—set the API access token value.
$shop_domain
—unique store domain at mymerchium.com (e.g. mystore.mymerchium.com).
setShopDomain($access_token)
—set the store domain value.
$access_token
—API access token.
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 .
requestAccessToken($code)
—send a request to get an API access token.
$code
—temporary code, (see Authorization. AccessToken).
getRequest($path, $params)
—send a request to get object data.
$path
—path to the object, i.e. part of the URL after http://STORE_NAME.mymerchium.com/api/.$params
—request params.
createRequest($path, $params)
—send a request to create an object.
$path
—path to the object, i.e. part of the URL after http://STORE_NAME.mymerchium.com/api/.$params
—request params.
updateRequest($path, $params)
—send a request to update object data.
$path
—path to the object, i.e. part of the URL after http://STORE_NAME.mymerchium.com/api/.$params
—request params.
deleteRequest($path)
—send a request to delete an object.
$path
—path to the object, i.e. part of the URL after http://STORE_NAME.mymerchium.com/api/.
-
testRequest()
—send a test request, e.g. to check the connection. -
validateSignature($get)
—validate the signature of an incoming request (see Authorization. AccessToken).
$get
—request params, usually a$_GET
array.
-
getLastErrorStatus()
—get the last error code from the API response. See Error Codes. -
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.