Integration - API

Before you start

In order to use EgoPay API you need:

  1. Attach your website to EgoPay. Read more how to attach your website to EgoPay.
  2. Go to Merchant ➞ API.
  3. On the list click Add new and follow on screen instructions
  4. When you have created API, click on information icon to get your API Key and Password
  5. API Integration info button

  6. In your website source code, where you are integrating API paste the APY Key and Password

JSON API

EgoPay API supports JSON format. If you use PHP language to integrate EgoPay API.

If you are using other programming language, you should note that, in order to use EgoPay API you must make the request to the server. JSON endpoint url is https://www.egopay.com/api/json

Important! If you using your own implementation of EgoPay API calls, it is important not to forget to include User-Agent header with all requests. Without it, you will not get the response. In short, without this header, all your API requests will be dropped.

PHP

Usage

EgoPay mainly supports PHP. To get started, simply download the SCI library from downloads section. After you have downloaded library files, extract it to your web application directory and include required files. To get more specific instructions keep reading the manual, every method or usage has it's own code snippet that will get you started.

The basic usage is explained in the following example. Every operation supported by EgoPay API should be used in the same way.

# Initialize composer autoloader
require_once __DIR__ . "vendor/autoload.php";
# Create EgoPay Authorization providing your username, api key and password
$auth = new EgoPayAuth('YOUR_USERNAME', 'API_KEY', 'API_PASSWORD');
# Create JSON API Agent
$api = new EgoPayJsonApiAgent($auth);
try {
    # to execute a specific operation call appropriate function
    $response = $api->getBalance();
} catch (EgoPayApiException $e) {
    # check the error code with $e->getCode();
    # the message for this error $e->getMessage();
}
# Preview the response
var_dump($response);

If you are having trouble with cURL complaining about SSL verification you can disable SSL peer verification by calling this function:

// ...
$api->setVerifyPeer(false);
// ...

NOTICE: If you choose to disable SSL peer verification you are taking a risk of compromising the response of EgoPay API

C#

Usage

EgoPay now supports C# SCI implementation. In order to use it, please download the the library from downloads section. After you have downloaded library files, open it. There you will find two directories, one is EgoPayLib and other Libs.

  1. From EgoPayLib folder select your net version and include the EgoPayLib.dll to your project
  2. From the Libs directory find json directory, select your net version and include the Newtonsoft.Json.dll file to you project

From this point you are ready to use the C# SCI implementation.

Scroll Up