API documentation

URL:

Authentication:

https://www.gccmerchant.com/api

Authentication is done using an API key and a secret. To generate this pair, go to the API page

Say the client wants to make a request to

POST https://www.gccmerchant.com/api/

With a payload of

{
"request": "/order/new",
"nonce": "1234",
"option1": ...
}

The nonce provided must be strictly increasing.

To authenticate a request, use the following:

payload = parameters-dictionary -> JSON encode -> base64
signature = HMAC-SHA384(payload, api-secret) as hexadecimal
send (api-key, payload, signature)

These are encoded as HTTP headers named:

X-GCC-APIKEY
X-GCC-PAYLOAD
X-GCC-SIGNATURE

Parameters nomenclature

Requests parameters for POST requests (authenticated) (presented below in the "Request" sections) are part of the PAYLOAD, not GET parameters.

Requests parameters for GET requests (non-authenticated) are GET parameters, appended to the call URL like this:

/call/?parameter=value

Create Invoice :

POST /create_invoice
Request
Key Type Description
price_currency [float] what client can use to pay this invoice, for now it will be GCC overtime
base_price [string] amount to pay
base_price_currency [string] What kind of currency in EUR/USD/GCC/BTC Customer shop using for this request
callback_url [url] where to send ping-back about invoice status changing
redirect_url [url] where to redirect shop client
order_id [int] where to redirect shop client
refund_address [string] An address to return funds to the customer in the event of cancellation/refunding it
item_description [string] Optional description of item
Response
Key Type Description
id [string] A unique id for the invoice
status [string] The status (state) of the invoice
payment_address [string] The address to pay the invoice in GCC
price [string] A price to pay, calculated in GCC
crypto_balance_due [string] This is equal to price, unless the invoice was underpaid and a balance remains
price_currency [string] The currency the invoice is to be paid. (mostly it is GCC)
base_price [string] The value of good or shop being purchased.
base_price_currency [string] The value of good or shop being purchased (EUR/USD/GCC/BTC)
service_fee_rate [string] Per transaction service fee. 0.01 = 1%
spot_rate [string] exchange rate based on GCC Merchant Price ie. 25.00 GCC/USD
inverse_spot_rate [string] exchange rate based on GCC Merchant Price ie. 0.002 USD/GCC
crypto_url [string] Wallet friendly url - this can be used to generate payable QR Code.
gateway_url [string] URL to this invoice on the hosted gateway. Redirect shop client here, or use an iframe
redirect_url [string] Valid url where the customer will be sent after a payment through the hosted gateway
order_id [string] Identifier for tracking the order from customer shop system
item_description [string] Optional description of item
refund_address [string] An address to return funds to the customer in the event of
callback_url [string] Valid url where the webhook notifications will be sent after a payment through the hosted gateway
merchant_id [string] Unique identifier for the issuing customer shop

Check invoice:

POST /check_invoice
Request
Key Type Description
invoice_id [string] Invoice id is the unique number of get from create invoice method response
Response
Key Type Description
id [string] A unique id for the invoice
status [string] The status (state) of the invoice
payment_address [string] The address to pay the invoice in GCC
price [string] A price to pay, calculated in GCC
crypto_balance_due [string] This is equal to price, unless the invoice was underpaid and a balance remains
price_currency [string] The currency the invoice is to be paid. (mostly it is GCC)
base_price [string] The value of good or shop being purchased.
base_price_currency [string] The value of good or shop being purchased (EUR/USD/GCC/BTC)
service_fee_rate [string] Per transaction service fee. 0.01 = 1%
spot_rate [string] exchange rate based on GCC Merchant Price ie. 25.00 GCC/USD
inverse_spot_rate [string] exchange rate based on GCC Merchant Price ie. 0.002 USD/GCC
crypto_url [string] Wallet friendly url - this can be used to generate payable QR Code.
gateway_url [string] URL to this invoice on the hosted gateway. Redirect shop client here, or use an iframe
redirect_url [string] Valid url where the customer will be sent after a payment through the hosted gateway
order_id [string] Identifier for tracking the order from customer shop system
item_description [string] Optional description of item
refund_address [string] An address to return funds to the customer in the event of
callback_url [string] Valid url where the webhook notifications will be sent after a payment through the hosted gateway
merchant_id [string] Unique identifier for the issuing customer shop

Create Wallet:

POST /create_wallet
Request
Key Type Description
callback [string] (optional)Callback url for get the notification
Response
Key Type Description
result [string] "success" or "error"
address [string] The deposit address (or error message if result = "error")

Outgoing Payments:

POST /send
Request
Key Type Description
address [string] Withdraw address
amount [float] amount you need to send to withdraw address
Response
Key Type Description
result [string] "success" or "error"
tx_hash [string] Transaction id of the particular transaction

Wallet balance:

POST /balance
Response
Return the current balance of the wallet

Listing wallet address:

POST /list_wallet
Response
Key Type Description
address [string] Wallet address

List transactions:

POST /list
Response
Return the transaction list

PHP Example

<?
 
    $key    = "yB8FTD7Lhj3DFG8AuayTiHcj87UTUWEsxN7qqfcIzgleWtOqEm";
    $secret = "jX4wgcEb6y7K1Fx96YojGXz2cvv0Wang7rNoErzK0Hu1n2bt0A";

 
    // generate a nonce to avoid problems with 32bits systems
    $mt = explode(' ', microtime());
    $req['request'] = "/create_wallet";
  
    $req['nonce']   = $mt[1].substr($mt[0], 2, 6);
  
    
    // generate the POST data string
    $post_data = base64_encode(json_encode($req));
    
    $sign = hash_hmac('sha384', $post_data, $secret);
    
    // generate the extra headers
    $headers = array(
            'X-GCC-APIKEY: '.$key,
            'X-GCC-PAYLOAD: '.$post_data,
            'X-GCC-SIGNATURE: '.$sign,
    );
    
    // curl handle (initialize if required)
    static $ch = null;
    if (is_null($ch)) {
        $ch = curl_init();
        curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
        curl_setopt($ch, CURLOPT_USERAGENT,
        'Mozilla/4.0 (compatible; Bter PHP bot; '.php_uname('a').'; PHP/'.phpversion().')'
        );
    }
 
    curl_setopt($ch, CURLOPT_URL, "https://www.gccmerchant.com/api/create_wallet");
    curl_setopt($ch, CURLOPT_POSTFIELDS, $post_data);
    curl_setopt($ch, CURLOPT_HTTPHEADER, $headers);
    curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, FALSE);
    

    $res = curl_exec($ch); 

    if ($res === false) throw new Exception('Curl error: '.curl_error($ch));

    echo json_decode($res);
?>
							
All Rights Reserved by GCC Merchant