Developers - 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
    API Integration info button
  5. In your website source code, where you are integrating API paste the APY Key and Password

 

JSON and SOAP

EgoPay API, support JSON and SOAP formats. In this documentation JSON adapter is used. If you use PHP language to integrate EgoPay API, SOAP adapter usage is the same. Simply change the EgoPayJsonApiAgent to EgoPaySoapApiAgent. All function calls are the same.

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 request url is https://www.egopay.com/api/json/

For SOAP calls, the EgoPay siap url is https://www.egopay.com/api/soap/ and the EgoPay soap wsdl file can be found at https://www.egopay.com/api/soap?wsdl

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.

 

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.

<?php
    // Include EgoPay Api Lib
    require_once "path/to/EgoPay/api/api.php";
    // Create EgoPay Authorization object providing your username, api key
    // and api password
    $oAuth = new EgoPayAuth('YOUR_USERNAME', 'API_KEY', 'API_PASSWORD');
    // Create JSON API Agent
    $oEgoPayJsonAgent = new EgoPayJsonApiAgent($oAuth);    
    try {
        // to execute a specific operation call appropriate function
        $response = $oEgoPayJsonAgent->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:

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

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

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.

 

Whats next?

Continue reading about one of the topics below:

Payments API Subscriptions API