Skip to main content

Expose merchant information for 2CO shopping cart

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 getMerchantInformation 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/rpc/5.0';

$jsonRpcRequest = array (
    'jsonrpc' => '2.0',
    'id' => 1,
    'method' => 'getMerchantInformation',
    'params' => []
);

echo json_encode(callRPC((Object)$jsonRpcRequest, $host));

 

Rate this article:

Need help?

Do you have a question? If you didn’t find the answer you are looking for in our documentation, you can contact our Support teams for more information. If you have a technical issue or question, please contact us. We are happy to help.

Not yet a Verifone customer?

We’ll help you choose the right payment solution for your business, wherever you want to sell, in-person or online. Our team of experts will happily discuss your needs.

Verifone logo