How to use API

Introduction

ETHGATE Receive Payments API is the fastest and easiest way to start accepting online automated payments using Ethereum.
We support GET or POST requests which allow you to be run in a minutes.
The most difficult thing with receiving ETH is the need of uniq address for each of your customers - otherwise you won't be able to track the sales. Our API takes care of generating and tracking the addressed used. Once the payment is received we will notify your server via a simple callback.

How to start

Once you have registered with us you have provided your own ETH wallet address for payouts.
We generate you the uniq token for API requests. It can be found at your account

Generate new address

This method gives you the ability to create unique ETH address to be represented for customer.
For any payments sent to this address, you will be sent an HTTP notification to the provided callback script.
https://ethgate.com/api.php?token=$your_token&callback=$your_callback_url&amount=$expected_amount_in_usd


The reply from this script will provide you the generated ETH address.

Integration samples

  • PHP
  • Console CURL

Integrate with PHP:


		// you generate your order id if needed
		$order_num = 'whatever your shop provides to recognize this order at your side during callback e.g. 111222222';

		// amount of the order in USD
		$amount = '110.25';

		// your secret key for the callback script at your side
                $secret = '111XXXXXXX2XXXXXXX3XXXXX';

		// your token API key given at your Profile
                $my_token = 'jyjg23422ysgbjcfs783227yrsdjksd';

		// your call back URL where to we pass the transaction information upon funds receving.
                $my_callback_url = 'https://your.domain/payment.php?invoice_id='.$order_num.'&secret='.$secret;

		// our API URL
                $root_url = 'https://ethgate.com/api.php';

		// creating parameters query string
                $parameters = 'token='.$my_token.'&callback='. urlencode($my_callback_url).'&amount='.$amount;

		// setting TIME OUT for HTTP request for 20 seconds
		$reqcon = stream_context_create(array(
			'http' => array(
		        'timeout' => 20
		        )
		)) ;


                $response = file_get_contents($root_url . '?' . $parameters , 0, $reqcon);

                if( preg_match("/^error/i", $response ) )
                        {
		// doing something on the error occurience.
				echo 'ERROR';
                        }
                elseif($response != '')
                        {
		// all is fine you have got your address to pay
				echo $response;
			}
		else
			{
		// there was fatal error
				echo 'FATAL';
			}
	

Integrate with HTTP curl:


		curl https:;/ethgate.com/api.php?token=YOUR_TOKEN_HERE&amount=0.00&callback=YOUR_URL_ENCODED_CALLBACK_URL