library merchium-sdk
Merchium PHP SDK
merchium/merchium-sdk
Merchium PHP SDK
- Friday, November 25, 2016
- by vsguts
- Repository
- 13 Watchers
- 15 Stars
- 20 Installations
- PHP
- 0 Dependents
- 0 Suggesters
- 2 Forks
- 0 Open issues
- 4 Versions
- 0 % Grown
Merchium PHP SDK
Hello and welcome to Merchium PHP SDK, a Merchium app development toolkit for PHP developers., (*1)
Merchium PHP SDK consists of the MerchiumClient.php PHP library and an example app (see it described in the docs)., (*2)
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., (*3)
You can find the current library version in the MerchiumClient::LIB_VERSION constant., (*4)
The MerchiumClient Class Methods
-
__construct($app_key, $shared_secret, $shop_domain = '', $access_token = '')—class constructor., (*5)
-
$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., (*6)
-
$shop_domain—unique store domain at mymerchium.com (e.g. mystore.mymerchium.com).
-
setShopDomain($access_token)—set the store domain value., (*7)
-
$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., (*8)
-
$scope—permission scope list.
-
$redirect_uri—post-install redirect URI .
-
requestAccessToken($code)—send a request to get an API access token., (*9)
-
getRequest($path, $params)—send a request to get object data., (*10)
-
$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., (*11)
-
$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., (*12)
-
$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., (*13)
-
$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., (*14)
-
validateSignature($get)—validate the signature of an incoming request (see Authorization. AccessToken)., (*15)
-
$get—request params, usually a $_GET array.
-
getLastErrorStatus()—get the last error code from the API response. See Error Codes., (*16)
-
getLastError()—get the last error message from the API response. See Error Codes., (*17)
Errors Returned by the API
See Error Codes., (*18)
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.