Expose merchant information for 2CO shopping cart
Last updated: 25-Sep-2019
Rate this article:
Overview
Disclaimer: the following method is intended for internal purposes only.
Use the getMerchantInforamtion method for retrieving vendor information required by the 2CO shopping cart into a single call.
This API method is protected through a special authentication header that the 2CO cart should sent. Click here to learn more about the X - header authentication.
Requirements
Authenticate using the special authentication header.
Response
Info | Description |
---|---|
Company name | Merchant company name. |
Commercial name | Merchant commercial name. |
Demo flag | Y if the vendor status is Pending, else P if the vendor has the "test orders" package active, otherwise N. |
Forced currency code | 3-letter code. |
Shopping cart customization | Shows possible cart customizations. |
Payment methods | Merchant available payment options. |
Override line item limit | - |
Order auth time | Minutes into days (how long it takes for the order to become complete). |
3DS status | true if vendor has Use3DSecure = NO, false otherwise. |
Currencies | Merchant available currencies. |
Countries | Merchant available ordering countries. |
Languages | Merchant available ordering languages. |
Promotions |
Promotions defined on merchant account. |
Secret key | Merchant account secret key. |
Shipping methods | Shipping methods defined on merchant account. |
Request
<?php
function callRPC($Request, $hostUrl, $Debug = false) {
$curl = curl_init($hostUrl);
curl_setopt($curl, CURLOPT_POST, 1);
curl_setopt($curl, CURLOPT_SSL_VERIFYPEER, 0);
curl_setopt($curl, CURLOPT_SSL_VERIFYHOST, 0);
curl_setopt($curl, CURLOPT_SSLVERSION, 0);
curl_setopt($curl, CURLOPT_RETURNTRANSFER, 1);
curl_setopt($curl, CURLOPT_HTTPPROXYTUNNEL, false);
curl_setopt($curl, CURLOPT_PROXY, '');
curl_setopt($curl, CURLOPT_HTTPHEADER, array(
'Content-Type: application/json',
'Accept: application/json',
'X-Avangate-Authentication: type="private" ver="2" app="2co-shopping-cart" merchant="RDGM" date="2018-01-31T13:57:44+00:00" hash="0m3ULy6dZ2xUI8CFtU0ersCootdf6wz8Z1qxN28FdXI="'
));
curl_setopt($curl, CURLOPT_COOKIE, '');
$RequestString = json_encode($Request);
curl_setopt($curl, CURLOPT_POSTFIELDS, $RequestString);
if ($Debug) {
var_dump($RequestString);
}
$ResponseString = curl_exec($curl);
if ($Debug) {
var_dump($ResponseString);
}
if (!empty($ResponseString)) {
$Response = json_decode($ResponseString);
if (isset($Response->result)) {
return $Response->result;
}
if (!is_null($Response->error)) {
var_dump($Request->method, $Response->error);
}
} else {
return null;
}
return null;
}
$host = 'http://api.avangate.com/soap/5.0';
try {
$merchantInformation= $client->getMerchantInformation($sessionID);
}
catch (SoapFault $e) {
echo "MerchantInformation: " . $e->getMessage();
exit;
}
var_dump("merchantInformation", $merchantInformation);
Rate this article: