ep4n

System Overview.

EasyPayForNet Business system offers online shopping malls an option to add EasyPayForNet Business products to their malls. Based on the agreement made with EasyPayForNet Business merchant relationship department, a specific list of EasyPayForNet Business local products will be allowed to be purchased on Agent site by their customers

Upon signing the contract with EasyPayForNet Business, Agent site is handed the following keys for the staging environment:

Username: Acts as the username for the Agent site while viewing Agent dashboard in EasyPayForNet Business system.
Password: it should be used to view Agent dashboard on EasyPayForNet Business system.
Public Key: which Used as Agent site identifier in all communication between EasyPayForNet Business and the Agent site
Secret Key: a key shared between EasyPayForNet Business and the Agent site; it will be used by the Agent site in generating the Agent site signature (hash code) and must not be communicated over http.

Notes & Recommendations

Data synchronization or “retrieve product list” methods can be considered a high traffic operation – depending on the amount of products retrieved on response, hence it is recommended to cache response results and to call this method over long intervals such as daily or weekly basis. “Purchase product” operation will be executed based on EasyPayForNet Business system prices, hence if a product price was updated on EasyPayForNet Business system after last time Agent site performed data synchronization process, transaction will be executed on new prices, it is the Agent site responsibility to take care of updated prices. To avoid any inconvenience based on the above fact, “Get Product Info Availability” method should be called prior to “purchasing product” method to validate prices integrity and items availability.

Staging Path: (For Staging)


//Api For Testing
https://staging.api.ep4n.dev/v1/

Production Path: (For Production)


//Will Provided by EasyPay For Net API Integration team after completed tests of Staging
https://api.ep4n.app/v1/

1-Get Account Balance.

checking your account balance.

Http Url:

    
Path + GetAccountBalance
//Example https://staging.api.ep4n.dev/v1/GetAccountBalance    
    

Signature Hash:


// secret_key = "G3l8Xl9WCypnww4aGRsAF3efRBBpQFiGHWsxRqWAOi0cUE7r2GkaxIEziJfExjIHN4Wq2PUvvADutOFNxuwsXtQUl58irAiBDizD6dWpYy7augE0mWJPKnVCN8pE8jzW"
// public_key = "1636574141"
sign = strtoupper(hash('sha256', $public_key . ":" . $secret_key));

Request Example:


{
    "public_key": "1636574141",
    "sign": "CD28F518DA6F4DB6A0F266546807E1664C13A0A500FBF023BD858690F26CD73B",
}

Request Parameters Description.

Arguments Data Type Description
public_key String Public Key Provided by EasyPayForNet API Integration Team
sign String Signature Hash as explained (Uppercase of sha256 Hash concatenation of public_key + ":" + secret_key)

Code Example:

    
    
$path = "https://staging.api.ep4n.dev/v1/"; $url = $path . "GetAccountBalance"; $public_key = 1636574141; $secret_key = "G3l8Xl9WCypnww4aGRsAF3efRBBpQFiGHWsxRqWAOi0cUE7r2GkaxIEziJfExjIHN4Wq2PUvvADutOFNxuwsXtQUl58irAiBDizD6dWpYy7augE0mWJPKnVCN8pE8jzW"; $signMessage = $public_key . ":" .$secret_key; $signHash = hash('sha256', $signMessage); $sign = strtoupper($signHash); $post_array = ["public_key" => $public_key, "sign" => $sign]; $ch = curl_init(); curl_setopt($ch, CURLOPT_URL, $url); curl_setopt($ch, CURLOPT_RETURNTRANSFER, TRUE); curl_setopt($ch, CURLOPT_HEADER, FALSE); curl_setopt($ch, CURLOPT_POST, TRUE); curl_setopt($ch, CURLOPT_POSTFIELDS, json_encode($post_array)); curl_setopt($ch, CURLOPT_HTTPHEADER, array( "Content-Type: application/json" )); $response = curl_exec($ch); curl_close($ch); var_dump($response);
    
    
// Cdn Of Axios Library https://cdn.jsdelivr.net/npm/axios/dist/axios.min.js // Cdn Of Hash Library https://cdnjs.cloudflare.com/ajax/libs/jsSHA/3.2.0/sha.min.js function GetAccountBalance() { let path = "https://staging.api.ep4n.dev/v1/" let url = path + "GetAccountBalance"; let public_key = "1636574141"; let secret_key = "G3l8Xl9WCypnww4aGRsAF3efRBBpQFiGHWsxRqWAOi0cUE7r2GkaxIEziJfExjIHN4Wq2PUvvADutOFNxuwsXtQUl58irAiBDizD6dWpYy7augE0mWJPKnVCN8pE8jzW" // Signature Code let signature = public_key + ":" + secret_key; // Hash Signature Code Then Convert It To Uppercase let sha256 = new jsSHA('SHA-256', 'TEXT'); sha256.update(signature); let sign = sha256.getHash("HEX").toUpperCase(); axios.post(url, { // Request Data 'public_key': public_key, 'sign' : sign }) .then(response => { // Response console.log(response.data) // Response Value console.log(response.data.response) // Response Data console.log(response.data.result) }) .catch(error => { // Catch Error if Found console.log(error.response.data) }) } GetAccountBalance()
    
    
import java.io.BufferedReader; import java.io.IOException; import java.io.InputStreamReader; import java.io.OutputStream; import java.net.HttpURLConnection; import java.net.URL; import java.security.MessageDigest; import java.security.NoSuchAlgorithmException; import java.util.Locale; public class "GetAccountBalance" { public static void main(String[] args) throws IOException { try { String Path = "https://staging.api.ep4n.dev/v1/"; String Url = Path + "GetAccountBalance"; String public_key = "1636574141"; String secret_key = "G3l8Xl9WCypnww4aGRsAF3efRBBpQFiGHWsxRqWAOi0cUE7r2GkaxIEziJfExjIHN4Wq2PUvvADutOFNxuwsXtQUl58irAiBDizD6dWpYy7augE0mWJPKnVCN8pE8jzW"; String sign_message = public_key + ":" + secret_key; final MessageDigest digest = MessageDigest.getInstance("SHA-256"); //convert sign_message to SHA 256 final byte[] hash = digest.digest(sign_message.getBytes("UTF-8")); final StringBuilder hexString = new StringBuilder(); for (int i = 0; i < hash.length; i++) { final String hex = Integer.toHexString(0xff & hash[i]); if (hex.length() == 1) hexString.append('0'); hexString.append(hex); } String sign = hexString.toString().toUpperCase(Locale.ROOT); //convert SHA 256 to UpperCase String postData = "{}"; URL obj = new URL(Url); HttpURLConnection con = (HttpURLConnection) obj.openConnection(); con.setRequestProperty("Accept", "application/json"); con.setRequestMethod("POST"); con.setDoOutput(true); OutputStream os = con.getOutputStream(); os.write(postData.getBytes()); os.flush(); os.close(); int responseCode = con.getResponseCode(); // POST Response Code if (responseCode == HttpURLConnection.HTTP_OK) { //success BufferedReader in = new BufferedReader(new InputStreamReader( con.getInputStream())); String inputLine; StringBuffer response = new StringBuffer(); while ((inputLine = in.readLine()) != null) { response.append(inputLine); } in.close(); System.out.println(response.toString()); // print result } } catch (IOException | NoSuchAlgorithmException e) { e.printStackTrace(); } } }
    
    
import requests import hashlib Path = "https://staging.api.ep4n.dev/v1/" URL = Path + "GetAccountBalance" public_key = "1636574141" secret_key = "G3l8Xl9WCypnww4aGRsAF3efRBBpQFiGHWsxRqWAOi0cUE7r2GkaxIEziJfExjIHN4Wq2PUvvADutOFNxuwsXtQUl58irAiBDizD6dWpYy7augE0mWJPKnVCN8pE8jzW" sign = hashlib.sha256(public_key + ":" + secret_key).hexdigest() PaymentData = { 'public_key': public_key, 'sign' : sign } status_request = requests.post(url = URL, params = json.dumps(PaymentData)) status_response = status_request.json()
    
    
import UIKit import Alamofire import CryptoKit class GetAccountBalance: UIViewController { let public_key = "1636574141" let secret_key = "G3l8Xl9WCypnww4aGRsAF3efRBBpQFiGHWsxRqWAOi0cUE7r2GkaxIEziJfExjIHN4Wq2PUvvADutOFNxuwsXtQUl58irAiBDizD6dWpYy7augE0mWJPKnVCN8pE8jzW" let separator_char = ":" // Create HASh (SHA256) func hash(public_key: String, separator_char: String , secret_key: String) -> String { let digest = SHA256.hash(data: (public_key+separator_char+secret_key).data(using: .utf8) ?? Data()) return digest.map { String(format: "%02x", $0) }.joined() } override func viewDidLoad() { super.viewDidLoad() () } func GetAccountBalance() { let sign = hash(public_key: public_key, separator_char: separator_char, secret_key: secret_key).uppercased() let parameters = ["public_key": public_key, "sign": sign ] let path = "https://staging.api.ep4n.dev/v1/" let url = path + "GetAccountBalance" AF.request(url, method: .post, parameters: parameters, encoding: JSONEncoding.default, headers: nil).responseJSON { response in switch response.result { case .failure(let error): print(error) case .success(let value): print(value) } } } }

Response Example:


{
    "success": true,
    "response": 200,
    "action": "GetAccountBalance",
    "result": {
        "balance": 1269.27
    }
}

Response Parameters Description.

Arguments Data Type Description
success Boolean true : method returned successfully
false : error
response Integer Response Code, refer to Response Codes
action String Method Name
result Array Method Array of returned data
balance Double Available Balance of your account

2-Get All Categories.

Retrieve All Categories list that assigned to EasyPayForNet Business API Version 1.

Http Url:

    
Path + GetAllCategories
//Example https://staging.api.ep4n.dev/v1/GetAllCategories    
    

Signature Hash:


// secret_key = "G3l8Xl9WCypnww4aGRsAF3efRBBpQFiGHWsxRqWAOi0cUE7r2GkaxIEziJfExjIHN4Wq2PUvvADutOFNxuwsXtQUl58irAiBDizD6dWpYy7augE0mWJPKnVCN8pE8jzW"
// public_key = "1636574141"
sign = strtoupper(hash('sha256', $public_key . ":" . $secret_key));

Request Example:


{
    "public_key": "1636574141",
    "sign": "CD28F518DA6F4DB6A0F266546807E1664C13A0A500FBF023BD858690F26CD73B",
}

Request Parameters Description.

Arguments Data Type Description
public_key String Public Key Provided by EasyPayForNet API Integration Team
sign String Signature Hash as explained (Uppercase of sha256 Hash concatenation of public_key + ":" + secret_key)

Code Example:

    
    
$path = "https://staging.api.ep4n.dev/v1/"; $url = $path . "GetAllCategories"; $public_key = 1636574141; $secret_key = "G3l8Xl9WCypnww4aGRsAF3efRBBpQFiGHWsxRqWAOi0cUE7r2GkaxIEziJfExjIHN4Wq2PUvvADutOFNxuwsXtQUl58irAiBDizD6dWpYy7augE0mWJPKnVCN8pE8jzW"; $signMessage = $public_key . ":" .$secret_key; $signHash = hash('sha256', $signMessage); $sign = strtoupper($signHash); $post_array = ["public_key" => $public_key, "sign" => $sign]; $ch = curl_init(); curl_setopt($ch, CURLOPT_URL, $url); curl_setopt($ch, CURLOPT_RETURNTRANSFER, TRUE); curl_setopt($ch, CURLOPT_HEADER, FALSE); curl_setopt($ch, CURLOPT_POST, TRUE); curl_setopt($ch, CURLOPT_POSTFIELDS, json_encode($post_array)); curl_setopt($ch, CURLOPT_HTTPHEADER, array( "Content-Type: application/json" )); $response = curl_exec($ch); curl_close($ch); var_dump($response);
    
    
// Cdn Of Axios Library https://cdn.jsdelivr.net/npm/axios/dist/axios.min.js // Cdn Of Hash Library https://cdnjs.cloudflare.com/ajax/libs/jsSHA/3.2.0/sha.min.js function GetAllCategories() { let path = "https://staging.api.ep4n.dev/v1/" let url = path + "GetAllCategories"; let public_key = "1636574141"; let secret_key = "G3l8Xl9WCypnww4aGRsAF3efRBBpQFiGHWsxRqWAOi0cUE7r2GkaxIEziJfExjIHN4Wq2PUvvADutOFNxuwsXtQUl58irAiBDizD6dWpYy7augE0mWJPKnVCN8pE8jzW" // Signature Code let signature = public_key + ":" + secret_key; // Hash Signature Code Then Convert It To Uppercase let sha256 = new jsSHA('SHA-256', 'TEXT'); sha256.update(signature); let sign = sha256.getHash("HEX").toUpperCase(); axios.post(url, { // Request Data 'public_key': public_key, 'sign' : sign }) .then(response => { // Response console.log(response.data) // Response Value console.log(response.data.response) // Response Data console.log(response.data.result) }) .catch(error => { // Catch Error if Found console.log(error.response.data) }) } GetAccountBalance()
    
    
import java.io.BufferedReader; import java.io.IOException; import java.io.InputStreamReader; import java.io.OutputStream; import java.net.HttpURLConnection; import java.net.URL; import java.security.MessageDigest; import java.security.NoSuchAlgorithmException; import java.util.Locale; public class "GetAllCategories" { public static void main(String[] args) throws IOException { try { String Path = "https://staging.api.ep4n.dev/v1/"; String Url = Path + "GetAllCategories"; String public_key = "1636574141"; String secret_key = "G3l8Xl9WCypnww4aGRsAF3efRBBpQFiGHWsxRqWAOi0cUE7r2GkaxIEziJfExjIHN4Wq2PUvvADutOFNxuwsXtQUl58irAiBDizD6dWpYy7augE0mWJPKnVCN8pE8jzW"; String sign_message = public_key + ":" + secret_key; final MessageDigest digest = MessageDigest.getInstance("SHA-256"); //convert sign_message to SHA 256 final byte[] hash = digest.digest(sign_message.getBytes("UTF-8")); final StringBuilder hexString = new StringBuilder(); for (int i = 0; i < hash.length; i++) { final String hex = Integer.toHexString(0xff & hash[i]); if (hex.length() == 1) hexString.append('0'); hexString.append(hex); } String sign = hexString.toString().toUpperCase(Locale.ROOT); //convert SHA 256 to UpperCase String postData = "{}"; URL obj = new URL(Url); HttpURLConnection con = (HttpURLConnection) obj.openConnection(); con.setRequestProperty("Accept", "application/json"); con.setRequestMethod("POST"); con.setDoOutput(true); OutputStream os = con.getOutputStream(); os.write(postData.getBytes()); os.flush(); os.close(); int responseCode = con.getResponseCode(); // POST Response Code if (responseCode == HttpURLConnection.HTTP_OK) { //success BufferedReader in = new BufferedReader(new InputStreamReader( con.getInputStream())); String inputLine; StringBuffer response = new StringBuffer(); while ((inputLine = in.readLine()) != null) { response.append(inputLine); } in.close(); System.out.println(response.toString()); // print result } } catch (IOException | NoSuchAlgorithmException e) { e.printStackTrace(); } } }
    
    
import requests import hashlib Path = "https://staging.api.ep4n.dev/v1/" URL = Path + "GetAllCategories" public_key = "1636574141" secret_key = "G3l8Xl9WCypnww4aGRsAF3efRBBpQFiGHWsxRqWAOi0cUE7r2GkaxIEziJfExjIHN4Wq2PUvvADutOFNxuwsXtQUl58irAiBDizD6dWpYy7augE0mWJPKnVCN8pE8jzW" sign = hashlib.sha256(public_key + ":" + secret_key).hexdigest() PaymentData = { 'public_key': public_key, 'sign' : sign } status_request = requests.post(url = URL, params = json.dumps(PaymentData)) status_response = status_request.json()
    
    
import UIKit import Alamofire import CryptoKit class GetAllCategories: UIViewController { let public_key = "1636574141" let secret_key = "G3l8Xl9WCypnww4aGRsAF3efRBBpQFiGHWsxRqWAOi0cUE7r2GkaxIEziJfExjIHN4Wq2PUvvADutOFNxuwsXtQUl58irAiBDizD6dWpYy7augE0mWJPKnVCN8pE8jzW" let separator_char = ":" // Create HASh (SHA256) func hash(public_key: String, separator_char: String , secret_key: String) -> String { let digest = SHA256.hash(data: (public_key+separator_char+secret_key).data(using: .utf8) ?? Data()) return digest.map { String(format: "%02x", $0) }.joined() } override func viewDidLoad() { super.viewDidLoad() () } func GetAllCategories() { let sign = hash(public_key: public_key, separator_char: separator_char, secret_key: secret_key).uppercased() let parameters = ["public_key": public_key, "sign": sign ] let path = "https://staging.api.ep4n.dev/v1/" let url = path + "GetAllCategories" AF.request(url, method: .post, parameters: parameters, encoding: JSONEncoding.default, headers: nil).responseJSON { response in switch response.result { case .failure(let error): print(error) case .success(let value): print(value) } } } }

Response Example:


{
    "success": true,
    "response": 200,
    "action": "GetAllCategories",
    "result": [
        {
            "category_id": 3,
            "category_name_en": "Mobile Charge Cards",
            "category_name_ar": "بطاقات شحن الهواتف",
            "merchants": 1
        },
        {
            "category_id": 2,
            "category_name_en": "Online Games",
            "category_name_ar": "العاب اونلاين",
            "merchants": 5
        },
        {
            "category_id": 6,
            "category_name_en": "Google Play",
            "category_name_ar": "جوجل بلاي",
            "merchants": 2
        },
        {
            "category_id": 11,
            "category_name_en": "Amazon Cards",
            "category_name_ar": "بطاقات امازون",
            "merchants": 1
        }
    ]
}

Response Parameters Description.

Arguments Data Type Description
success Boolean true : method returned successfully
false : error
response Integer Response Code, refer to Response Codes
action String Method Name
result Array Method Array of returned data
category_id Integer EasyPayForNet Business Category code
category_name_en String EasyPayForNet Business Category Name in English Language
category_name_ar String EasyPayForNet Business Category Name in Arabic Language
merchants Integer EasyPayForNet Business Counts of Merchants related to this Category

3-Get All Merchants.

Retrieve All Merchants list that assigned to EasyPayForNet Business API Version 1.

Http Url:

    
Path + GetAllMerchants
//Example https://staging.api.ep4n.dev/v1/GetAllMerchants    
    

Signature Hash:


// secret_key = "G3l8Xl9WCypnww4aGRsAF3efRBBpQFiGHWsxRqWAOi0cUE7r2GkaxIEziJfExjIHN4Wq2PUvvADutOFNxuwsXtQUl58irAiBDizD6dWpYy7augE0mWJPKnVCN8pE8jzW"
// public_key = "1636574141"
sign = strtoupper(hash('sha256', $public_key . ":" . $secret_key));

Request Example:


{
    "public_key": "1636574141",
    "sign": "CD28F518DA6F4DB6A0F266546807E1664C13A0A500FBF023BD858690F26CD73B",
}

Request Parameters Description.

Arguments Data Type Description
public_key String Public Key Provided by EasyPayForNet API Integration Team
sign String Signature Hash as explained (Uppercase of sha256 Hash concatenation of public_key + ":" + secret_key)

Code Example:

    
    
$path = "https://staging.api.ep4n.dev/v1/"; $url = $path . "GetAllMerchants"; $public_key = 1636574141; $secret_key = "G3l8Xl9WCypnww4aGRsAF3efRBBpQFiGHWsxRqWAOi0cUE7r2GkaxIEziJfExjIHN4Wq2PUvvADutOFNxuwsXtQUl58irAiBDizD6dWpYy7augE0mWJPKnVCN8pE8jzW"; $signMessage = $public_key . ":" .$secret_key; $signHash = hash('sha256', $signMessage); $sign = strtoupper($signHash); $post_array = ["public_key" => $public_key, "sign" => $sign]; $ch = curl_init(); curl_setopt($ch, CURLOPT_URL, $url); curl_setopt($ch, CURLOPT_RETURNTRANSFER, TRUE); curl_setopt($ch, CURLOPT_HEADER, FALSE); curl_setopt($ch, CURLOPT_POST, TRUE); curl_setopt($ch, CURLOPT_POSTFIELDS, json_encode($post_array)); curl_setopt($ch, CURLOPT_HTTPHEADER, array( "Content-Type: application/json" )); $response = curl_exec($ch); curl_close($ch); var_dump($response);
    
    
// Cdn Of Axios Library https://cdn.jsdelivr.net/npm/axios/dist/axios.min.js // Cdn Of Hash Library https://cdnjs.cloudflare.com/ajax/libs/jsSHA/3.2.0/sha.min.js function GetAllMerchants() { let path = "https://staging.api.ep4n.dev/v1/" let url = path + "GetAllMerchants"; let public_key = "1636574141"; let secret_key = "G3l8Xl9WCypnww4aGRsAF3efRBBpQFiGHWsxRqWAOi0cUE7r2GkaxIEziJfExjIHN4Wq2PUvvADutOFNxuwsXtQUl58irAiBDizD6dWpYy7augE0mWJPKnVCN8pE8jzW" // Signature Code let signature = public_key + ":" + secret_key; // Hash Signature Code Then Convert It To Uppercase let sha256 = new jsSHA('SHA-256', 'TEXT'); sha256.update(signature); let sign = sha256.getHash("HEX").toUpperCase(); axios.post(url, { // Request Data 'public_key': public_key, 'sign' : sign }) .then(response => { // Response console.log(response.data) // Response Value console.log(response.data.response) // Response Data console.log(response.data.result) }) .catch(error => { // Catch Error if Found console.log(error.response.data) }) } GetAccountBalance()
    
    
import java.io.BufferedReader; import java.io.IOException; import java.io.InputStreamReader; import java.io.OutputStream; import java.net.HttpURLConnection; import java.net.URL; import java.security.MessageDigest; import java.security.NoSuchAlgorithmException; import java.util.Locale; public class "GetAllMerchants" { public static void main(String[] args) throws IOException { try { String Path = "https://staging.api.ep4n.dev/v1/"; String Url = Path + "GetAllMerchants"; String public_key = "1636574141"; String secret_key = "G3l8Xl9WCypnww4aGRsAF3efRBBpQFiGHWsxRqWAOi0cUE7r2GkaxIEziJfExjIHN4Wq2PUvvADutOFNxuwsXtQUl58irAiBDizD6dWpYy7augE0mWJPKnVCN8pE8jzW"; String sign_message = public_key + ":" + secret_key; final MessageDigest digest = MessageDigest.getInstance("SHA-256"); //convert sign_message to SHA 256 final byte[] hash = digest.digest(sign_message.getBytes("UTF-8")); final StringBuilder hexString = new StringBuilder(); for (int i = 0; i < hash.length; i++) { final String hex = Integer.toHexString(0xff & hash[i]); if (hex.length() == 1) hexString.append('0'); hexString.append(hex); } String sign = hexString.toString().toUpperCase(Locale.ROOT); //convert SHA 256 to UpperCase String postData = "{}"; URL obj = new URL(Url); HttpURLConnection con = (HttpURLConnection) obj.openConnection(); con.setRequestProperty("Accept", "application/json"); con.setRequestMethod("POST"); con.setDoOutput(true); OutputStream os = con.getOutputStream(); os.write(postData.getBytes()); os.flush(); os.close(); int responseCode = con.getResponseCode(); // POST Response Code if (responseCode == HttpURLConnection.HTTP_OK) { //success BufferedReader in = new BufferedReader(new InputStreamReader( con.getInputStream())); String inputLine; StringBuffer response = new StringBuffer(); while ((inputLine = in.readLine()) != null) { response.append(inputLine); } in.close(); System.out.println(response.toString()); // print result } } catch (IOException | NoSuchAlgorithmException e) { e.printStackTrace(); } } }
    
    
import requests import hashlib Path = "https://staging.api.ep4n.dev/v1/" URL = Path + "GetAllMerchants" public_key = "1636574141" secret_key = "G3l8Xl9WCypnww4aGRsAF3efRBBpQFiGHWsxRqWAOi0cUE7r2GkaxIEziJfExjIHN4Wq2PUvvADutOFNxuwsXtQUl58irAiBDizD6dWpYy7augE0mWJPKnVCN8pE8jzW" sign = hashlib.sha256(public_key + ":" + secret_key).hexdigest() PaymentData = { 'public_key': public_key, 'sign' : sign } status_request = requests.post(url = URL, params = json.dumps(PaymentData)) status_response = status_request.json()
    
    
import UIKit import Alamofire import CryptoKit class GetAllMerchants: UIViewController { let public_key = "1636574141" let secret_key = "G3l8Xl9WCypnww4aGRsAF3efRBBpQFiGHWsxRqWAOi0cUE7r2GkaxIEziJfExjIHN4Wq2PUvvADutOFNxuwsXtQUl58irAiBDizD6dWpYy7augE0mWJPKnVCN8pE8jzW" let separator_char = ":" // Create HASh (SHA256) func hash(public_key: String, separator_char: String , secret_key: String) -> String { let digest = SHA256.hash(data: (public_key+separator_char+secret_key).data(using: .utf8) ?? Data()) return digest.map { String(format: "%02x", $0) }.joined() } override func viewDidLoad() { super.viewDidLoad() () } func GetAllMerchants() { let sign = hash(public_key: public_key, separator_char: separator_char, secret_key: secret_key).uppercased() let parameters = ["public_key": public_key, "sign": sign ] let path = "https://staging.api.ep4n.dev/v1/" let url = path + "GetAllMerchants" AF.request(url, method: .post, parameters: parameters, encoding: JSONEncoding.default, headers: nil).responseJSON { response in switch response.result { case .failure(let error): print(error) case .success(let value): print(value) } } } }

Response Example:


{
    "success": true,
    "response": 200,
    "action": "GetAllMerchants",
    "result": [
        {
            "products": 6,
            "merchant_id": 8,
            "merchant_name_en": "Conquer Online",
            "merchant_name_ar": "قهر / كونكر اون لاين",
            "category_id": 2,
            "category_name_en": "Online Games",
            "category_name_ar": "العاب اونلاين"
        },
        {
            "products": 4,
            "merchant_id": 24,
            "merchant_name_en": "GooglePlay (KSA)",
            "merchant_name_ar": "جوجل بلاي سعودي",
            "category_id": 6,
            "category_name_en": "Google Play",
            "category_name_ar": "جوجل بلاي"
        },
        {
            "products": 5,
            "merchant_id": 63,
            "merchant_name_en": "Amazon Gift Card (AE)",
            "merchant_name_ar": "بطاقات امازون اماراتي",
            "category_id": 11,
            "category_name_en": "Amazon Cards",
            "category_name_ar": "بطاقات امازون"
        },
        {
            "products": 3,
            "merchant_id": 50,
            "merchant_name_en": "Google Play Gift AE",
            "merchant_name_ar": "جوجل بلاي اماراتي",
            "category_id": 6,
            "category_name_en": "Google Play",
            "category_name_ar": "جوجل بلاي"
        },
        {
            "products": 8,
            "merchant_id": 27,
            "merchant_name_en": "Pubg Card",
            "merchant_name_ar": "بطاقات بابجي",
            "category_id": 2,
            "category_name_en": "Online Games",
            "category_name_ar": "العاب اونلاين"
        },
        {
            "products": 3,
            "merchant_id": 16,
            "merchant_name_en": "IMVU",
            "merchant_name_ar": "بطاقات ايمفيو مسبقة الدفع -VIP",
            "category_id": 2,
            "category_name_en": "Online Games",
            "category_name_ar": "العاب اونلاين"
        },
        {
            "products": 6,
            "merchant_id": 28,
            "merchant_name_en": "Free Fire Card",
            "merchant_name_ar": "كروت فري فاير",
            "category_id": 2,
            "category_name_en": "Online Games",
            "category_name_ar": "العاب اونلاين"
        },
        {
            "products": 3,
            "merchant_id": 68,
            "merchant_name_en": "Mobile Legends: Bang Bang Diamonds Cards",
            "merchant_name_ar": "كروت ليجند موبايل Bang Bang",
            "category_id": 2,
            "category_name_en": "Online Games",
            "category_name_ar": "العاب اونلاين"
        }
    ]
}

Response Parameters Description.

Arguments Data Type Description
success Boolean true : method returned successfully
false : error
response Integer Response Code, refer to Response Codes
action String Method Name
result Array Method Array of returned data
products Integer EasyPayForNet Business Counts of Products related to this Merchant
merchant_id Integer EasyPayForNet Business Merchant code
merchant_name_en String EasyPayForNet Business Merchant Name in English Language
merchant_name_ar String EasyPayForNet Business Merchant Name in Arabic Language
category_name_en String EasyPayForNet Business Category Name in English Language
category_name_ar String EasyPayForNet Business Category Name in Arabic Language

4-Get Merchants Of Category.

Retrieve All Merchants list of selected Category that assigned to EasyPayForNet Business API Version 1.

Http Url:

    
Path + GetMerchantsOfCategory
//Example https://staging.api.ep4n.dev/v1/GetMerchantsOfCategory    
    

Signature Hash:


// secret_key = "G3l8Xl9WCypnww4aGRsAF3efRBBpQFiGHWsxRqWAOi0cUE7r2GkaxIEziJfExjIHN4Wq2PUvvADutOFNxuwsXtQUl58irAiBDizD6dWpYy7augE0mWJPKnVCN8pE8jzW"
// public_key = "1636574141"
// example Value Of ($category_id)
$category_id = 2
sign = strtoupper(hash('sha256', $public_key . ":" . $category_id . ":" . $secret_key));

Request Example:


{
    "public_key": "1636574141",
    "category_id": 2,
    "sign": "4E90037D7BCAA79201096EB8B702C7FE58D2D9240A84A9AAEF7D28341F08BF3A",
}

Request Parameters Description.

Arguments Data Type Description
public_key String Public Key Provided by EasyPayForNet API Integration Team
category_id Integer EasyPayForNet Business Category code
sign String Signature Hash as explained (Uppercase of sha256 Hash concatenation of public_key + ":" + category_id + ":" + secret_key)

Code Example:

    
    
$path = "https://staging.api.ep4n.dev/v1/"; $url = $path . "GetMerchantsOfCategory"; $public_key = 1636574141; $category_id = 2; $secret_key = "G3l8Xl9WCypnww4aGRsAF3efRBBpQFiGHWsxRqWAOi0cUE7r2GkaxIEziJfExjIHN4Wq2PUvvADutOFNxuwsXtQUl58irAiBDizD6dWpYy7augE0mWJPKnVCN8pE8jzW"; $signMessage = $public_key . ":" .$category_id . ":" .$secret_key; $signHash = hash('sha256', $signMessage); $sign = strtoupper($signHash); $post_array = ["public_key" => $public_key, 'category_id' => $category_id, "sign" => $sign]; $ch = curl_init(); curl_setopt($ch, CURLOPT_URL, $url); curl_setopt($ch, CURLOPT_RETURNTRANSFER, TRUE); curl_setopt($ch, CURLOPT_HEADER, FALSE); curl_setopt($ch, CURLOPT_POST, TRUE); curl_setopt($ch, CURLOPT_POSTFIELDS, json_encode($post_array)); curl_setopt($ch, CURLOPT_HTTPHEADER, array( "Content-Type: application/json" )); $response = curl_exec($ch); curl_close($ch); var_dump($response);
    
    
// Cdn Of Axios Library https://cdn.jsdelivr.net/npm/axios/dist/axios.min.js // Cdn Of Hash Library https://cdnjs.cloudflare.com/ajax/libs/jsSHA/3.2.0/sha.min.js function GetMerchantsOfCategory() { let path = "https://staging.api.ep4n.dev/v1/" let url = path + "GetMerchantsOfCategory"; let public_key = "1636574141"; let category_id = 2; let secret_key = "G3l8Xl9WCypnww4aGRsAF3efRBBpQFiGHWsxRqWAOi0cUE7r2GkaxIEziJfExjIHN4Wq2PUvvADutOFNxuwsXtQUl58irAiBDizD6dWpYy7augE0mWJPKnVCN8pE8jzW" // Signature Code let signature = public_key + ":" + category_id + ":" + secret_key; // Hash Signature Code Then Convert It To Uppercase let sha256 = new jsSHA('SHA-256', 'TEXT'); sha256.update(signature); let sign = sha256.getHash("HEX").toUpperCase(); axios.post(url, { // Request Data 'public_key': public_key, 'category_id' : category_id, 'sign' : sign }) .then(response => { // Response console.log(response.data) // Response Value console.log(response.data.response) // Response Data console.log(response.data.result) }) .catch(error => { // Catch Error if Found console.log(error.response.data) }) } GetAccountBalance()
    
    
import java.io.BufferedReader; import java.io.IOException; import java.io.InputStreamReader; import java.io.OutputStream; import java.net.HttpURLConnection; import java.net.URL; import java.security.MessageDigest; import java.security.NoSuchAlgorithmException; import java.util.Locale; public class "GetMerchantsOfCategory" { public static void main(String[] args) throws IOException { try { String Path = "https://staging.api.ep4n.dev/v1/"; String Url = Path + "GetMerchantsOfCategory"; String public_key = "1636574141"; String category_id = "2"; String secret_key = "G3l8Xl9WCypnww4aGRsAF3efRBBpQFiGHWsxRqWAOi0cUE7r2GkaxIEziJfExjIHN4Wq2PUvvADutOFNxuwsXtQUl58irAiBDizD6dWpYy7augE0mWJPKnVCN8pE8jzW"; String sign_message = public_key + ":" + category_id + ":" + secret_key; final MessageDigest digest = MessageDigest.getInstance("SHA-256"); //convert sign_message to SHA 256 final byte[] hash = digest.digest(sign_message.getBytes("UTF-8")); final StringBuilder hexString = new StringBuilder(); for (int i = 0; i < hash.length; i++) { final String hex = Integer.toHexString(0xff & hash[i]); if (hex.length() == 1) hexString.append('0'); hexString.append(hex); } String sign = hexString.toString().toUpperCase(Locale.ROOT); //convert SHA 256 to UpperCase String postData = "{}"; URL obj = new URL(Url); HttpURLConnection con = (HttpURLConnection) obj.openConnection(); con.setRequestProperty("Accept", "application/json"); con.setRequestMethod("POST"); con.setDoOutput(true); OutputStream os = con.getOutputStream(); os.write(postData.getBytes()); os.flush(); os.close(); int responseCode = con.getResponseCode(); // POST Response Code if (responseCode == HttpURLConnection.HTTP_OK) { //success BufferedReader in = new BufferedReader(new InputStreamReader( con.getInputStream())); String inputLine; StringBuffer response = new StringBuffer(); while ((inputLine = in.readLine()) != null) { response.append(inputLine); } in.close(); System.out.println(response.toString()); // print result } } catch (IOException | NoSuchAlgorithmException e) { e.printStackTrace(); } } }
    
    
import requests import hashlib Path = "https://staging.api.ep4n.dev/v1/" URL = Path + "GetMerchantsOfCategory" public_key = "1636574141" category_id = 2; secret_key = "G3l8Xl9WCypnww4aGRsAF3efRBBpQFiGHWsxRqWAOi0cUE7r2GkaxIEziJfExjIHN4Wq2PUvvADutOFNxuwsXtQUl58irAiBDizD6dWpYy7augE0mWJPKnVCN8pE8jzW" sign = hashlib.sha256(public_key + ":" + category_id + ":" + secret_key).hexdigest() PaymentData = { 'public_key': public_key, 'category_id' : category_id, 'sign' : sign } status_request = requests.post(url = URL, params = json.dumps(PaymentData)) status_response = status_request.json()
    
    
import UIKit import Alamofire import CryptoKit class GetMerchantsOfCategory: UIViewController { let public_key = "1636574141" var category_id = "2"; let secret_key = "G3l8Xl9WCypnww4aGRsAF3efRBBpQFiGHWsxRqWAOi0cUE7r2GkaxIEziJfExjIHN4Wq2PUvvADutOFNxuwsXtQUl58irAiBDizD6dWpYy7augE0mWJPKnVCN8pE8jzW" let separator_char = ":" // Create HASh (SHA256) func hash(public_key: String, separator_char: String, category_id: String , secret_key: String) -> String { let digest = SHA256.hash(data: (public_key+separator_char+category_id+separator_char+secret_key).data(using: .utf8) ?? Data()) return digest.map { String(format: "%02x", $0) }.joined() } override func viewDidLoad() { super.viewDidLoad() () } func GetMerchantsOfCategory() { let sign = hash(public_key: public_key, separator_char: separator_char, category_id: category_id, secret_key: secret_key).uppercased() let parameters = ["public_key": public_key, "category_id": category_id, "sign": sign ] let path = "https://staging.api.ep4n.dev/v1/" let url = path + "GetMerchantsOfCategory" AF.request(url, method: .post, parameters: parameters, encoding: JSONEncoding.default, headers: nil).responseJSON { response in switch response.result { case .failure(let error): print(error) case .success(let value): print(value) } } } }

Response Example:


{
    "success": true,
    "response": 200,
    "action": "GetMerchantsOfCategory",
    "result": [
        {
            "products": 3,
            "merchant_id": 8,
            "merchant_name_en": "Conquer Online",
            "merchant_name_ar": "قهر / كونكر اون لاين",
            "category_id": 2,
            "category_name_en": "Online Games",
            "category_name_ar": "العاب اونلاين"
        },
        {
            "products": 1,
            "merchant_id": 17,
            "merchant_name_en": "Top-up Free Fire",
            "merchant_name_ar": "شحن فري فاير",
            "category_id": 2,
            "category_name_en": "Online Games",
            "category_name_ar": "العاب اونلاين"
        }
    ]
}

Response Parameters Description.

Arguments Data Type Description
success Boolean true : method returned successfully
false : error
response Integer Response Code, refer to Response Codes
action String Method Name
result Array Method Array of returned data
products Integer EasyPayForNet Business Counts of Products related to this Merchant
merchant_id Integer EasyPayForNet Business Merchant code
merchant_name_en String EasyPayForNet Business Merchant Name in English Language
merchant_name_ar String EasyPayForNet Business Merchant Name in Arabic Language
category_name_en String EasyPayForNet Business Category Name in English Language
category_name_ar String EasyPayForNet Business Category Name in Arabic Language

5-Get All Products.

Retrieve All Products list that assigned to EasyPayForNet Business API Version 1.

Http Url:

    
Path + GetAllProducts
//Example https://staging.api.ep4n.dev/v1/GetAllProducts    
    

Signature Hash:


// secret_key = "G3l8Xl9WCypnww4aGRsAF3efRBBpQFiGHWsxRqWAOi0cUE7r2GkaxIEziJfExjIHN4Wq2PUvvADutOFNxuwsXtQUl58irAiBDizD6dWpYy7augE0mWJPKnVCN8pE8jzW"
// public_key = "1636574141"
sign = strtoupper(hash('sha256', $public_key . ":" . $secret_key));

Request Example:


{
    "public_key": "1636574141",
    "sign": "CD28F518DA6F4DB6A0F266546807E1664C13A0A500FBF023BD858690F26CD73B",
}

Request Parameters Description.

Arguments Data Type Description
public_key String Public Key Provided by EasyPayForNet API Integration Team
sign String Signature Hash as explained (Uppercase of sha256 Hash concatenation of public_key + ":" + secret_key)

Code Example:

    
    
$path = "https://staging.api.ep4n.dev/v1/"; $url = $path . "GetAllProducts"; $public_key = 1636574141; $secret_key = "G3l8Xl9WCypnww4aGRsAF3efRBBpQFiGHWsxRqWAOi0cUE7r2GkaxIEziJfExjIHN4Wq2PUvvADutOFNxuwsXtQUl58irAiBDizD6dWpYy7augE0mWJPKnVCN8pE8jzW"; $signMessage = $public_key . ":" .$secret_key; $signHash = hash('sha256', $signMessage); $sign = strtoupper($signHash); $post_array = ["public_key" => $public_key, "sign" => $sign]; $ch = curl_init(); curl_setopt($ch, CURLOPT_URL, $url); curl_setopt($ch, CURLOPT_RETURNTRANSFER, TRUE); curl_setopt($ch, CURLOPT_HEADER, FALSE); curl_setopt($ch, CURLOPT_POST, TRUE); curl_setopt($ch, CURLOPT_POSTFIELDS, json_encode($post_array)); curl_setopt($ch, CURLOPT_HTTPHEADER, array( "Content-Type: application/json" )); $response = curl_exec($ch); curl_close($ch); var_dump($response);
    
    
// Cdn Of Axios Library https://cdn.jsdelivr.net/npm/axios/dist/axios.min.js // Cdn Of Hash Library https://cdnjs.cloudflare.com/ajax/libs/jsSHA/3.2.0/sha.min.js function GetAllProducts() { let path = "https://staging.api.ep4n.dev/v1/" let url = path + "GetAllProducts"; let public_key = "1636574141"; let secret_key = "G3l8Xl9WCypnww4aGRsAF3efRBBpQFiGHWsxRqWAOi0cUE7r2GkaxIEziJfExjIHN4Wq2PUvvADutOFNxuwsXtQUl58irAiBDizD6dWpYy7augE0mWJPKnVCN8pE8jzW" // Signature Code let signature = public_key + ":" + secret_key; // Hash Signature Code Then Convert It To Uppercase let sha256 = new jsSHA('SHA-256', 'TEXT'); sha256.update(signature); let sign = sha256.getHash("HEX").toUpperCase(); axios.post(url, { // Request Data 'public_key': public_key, 'sign' : sign }) .then(response => { // Response console.log(response.data) // Response Value console.log(response.data.response) // Response Data console.log(response.data.result) }) .catch(error => { // Catch Error if Found console.log(error.response.data) }) } GetAccountBalance()
    
    
import java.io.BufferedReader; import java.io.IOException; import java.io.InputStreamReader; import java.io.OutputStream; import java.net.HttpURLConnection; import java.net.URL; import java.security.MessageDigest; import java.security.NoSuchAlgorithmException; import java.util.Locale; public class "GetAllProducts" { public static void main(String[] args) throws IOException { try { String Path = "https://staging.api.ep4n.dev/v1/"; String Url = Path + "GetAllProducts"; String public_key = "1636574141"; String secret_key = "G3l8Xl9WCypnww4aGRsAF3efRBBpQFiGHWsxRqWAOi0cUE7r2GkaxIEziJfExjIHN4Wq2PUvvADutOFNxuwsXtQUl58irAiBDizD6dWpYy7augE0mWJPKnVCN8pE8jzW"; String sign_message = public_key + ":" + secret_key; final MessageDigest digest = MessageDigest.getInstance("SHA-256"); //convert sign_message to SHA 256 final byte[] hash = digest.digest(sign_message.getBytes("UTF-8")); final StringBuilder hexString = new StringBuilder(); for (int i = 0; i < hash.length; i++) { final String hex = Integer.toHexString(0xff & hash[i]); if (hex.length() == 1) hexString.append('0'); hexString.append(hex); } String sign = hexString.toString().toUpperCase(Locale.ROOT); //convert SHA 256 to UpperCase String postData = "{}"; URL obj = new URL(Url); HttpURLConnection con = (HttpURLConnection) obj.openConnection(); con.setRequestProperty("Accept", "application/json"); con.setRequestMethod("POST"); con.setDoOutput(true); OutputStream os = con.getOutputStream(); os.write(postData.getBytes()); os.flush(); os.close(); int responseCode = con.getResponseCode(); // POST Response Code if (responseCode == HttpURLConnection.HTTP_OK) { //success BufferedReader in = new BufferedReader(new InputStreamReader( con.getInputStream())); String inputLine; StringBuffer response = new StringBuffer(); while ((inputLine = in.readLine()) != null) { response.append(inputLine); } in.close(); System.out.println(response.toString()); // print result } } catch (IOException | NoSuchAlgorithmException e) { e.printStackTrace(); } } }
    
    
import requests import hashlib Path = "https://staging.api.ep4n.dev/v1/" URL = Path + "GetAllProducts" public_key = "1636574141" secret_key = "G3l8Xl9WCypnww4aGRsAF3efRBBpQFiGHWsxRqWAOi0cUE7r2GkaxIEziJfExjIHN4Wq2PUvvADutOFNxuwsXtQUl58irAiBDizD6dWpYy7augE0mWJPKnVCN8pE8jzW" sign = hashlib.sha256(public_key + ":" + secret_key).hexdigest() PaymentData = { 'public_key': public_key, 'sign' : sign } status_request = requests.post(url = URL, params = json.dumps(PaymentData)) status_response = status_request.json()
    
    
import UIKit import Alamofire import CryptoKit class GetAllProducts: UIViewController { let public_key = "1636574141" let secret_key = "G3l8Xl9WCypnww4aGRsAF3efRBBpQFiGHWsxRqWAOi0cUE7r2GkaxIEziJfExjIHN4Wq2PUvvADutOFNxuwsXtQUl58irAiBDizD6dWpYy7augE0mWJPKnVCN8pE8jzW" let separator_char = ":" // Create HASh (SHA256) func hash(public_key: String, separator_char: String , secret_key: String) -> String { let digest = SHA256.hash(data: (public_key+separator_char+secret_key).data(using: .utf8) ?? Data()) return digest.map { String(format: "%02x", $0) }.joined() } override func viewDidLoad() { super.viewDidLoad() () } func GetAllProducts() { let sign = hash(public_key: public_key, separator_char: separator_char, secret_key: secret_key).uppercased() let parameters = ["public_key": public_key, "sign": sign ] let path = "https://staging.api.ep4n.dev/v1/" let url = path + "GetAllProducts" AF.request(url, method: .post, parameters: parameters, encoding: JSONEncoding.default, headers: nil).responseJSON { response in switch response.result { case .failure(let error): print(error) case .success(let value): print(value) } } } }

Response Example:


{
    "success": true,
    "response": 200,
    "action": "GetAllProducts",
    "result": [
        {
            "product_id": 61,
            "product_name_en": "TQ Conquer Online - 60 CP Card",
            "product_name_ar": "قهر /كونكر اون لاين – كارت 60 سي بي",
            "availability": true,
            "product_price": 16,
            "agent_price": 15.60,
            "pre_order": false,
            "product_img": "https://img.ep4n.com/products/60-1592427131.gif",
            "merchant_id": 8,
            "merchant_name_en": "Conquer Online",
            "merchant_name_ar": "قهر / كونكر اون لاين"
        },
        {
            "product_id": 62,
            "product_name_en": "TQ Conquer Online - 125 CP Card",
            "product_name_ar": "قهر /كونكر اون لاين – كارت 125 سي بي",
            "availability": true,
            "product_price": 31,
            "agent_price": 30.23,
            "pre_order": false,
            "product_img": "https://img.ep4n.com/products/61-1592427147.gif",
            "merchant_id": 8,
            "merchant_name_en": "Conquer Online",
            "merchant_name_ar": "قهر / كونكر اون لاين"
        },
        {
            "product_id": 67,
            "product_name_en": "TQ Conquer Online - 4200 CP Card",
            "product_name_ar": "قهر /كونكر اون لاين – كارت 4200 سي بي",
            "availability": true,
            "product_price": 935,
            "agent_price": 911.63,
            "pre_order": false,
            "product_img": "https://img.ep4n.com/products/66-1592427221.gif",
            "merchant_id": 8,
            "merchant_name_en": "Conquer Online",
            "merchant_name_ar": "قهر / كونكر اون لاين"
        },
        {
            "product_id": 207,
            "product_name_en": "Google Play US Gift Card 50 AED",
            "product_name_ar": "بطاقة جوجل بلاي اماراتي 50 درهم",
            "availability": false,
            "product_price": 255,
            "agent_price": 248.63,
            "pre_order": false,
            "product_img": "https://img.ep4n.com/products/207-1604756853.png",
            "merchant_id": 50,
            "merchant_name_en": "Google Play Gift AE",
            "merchant_name_ar": "جوجل بلاي اماراتي"
        },
        {
            "product_id": 56,
            "product_name_en": "Pubg Card 600+ Free 60 UC",
            "product_name_ar": "بطاقة بابجي 600+ Free 60 UC",
            "availability": true,
            "product_price": 155,
            "agent_price": 151.13,
            "pre_order": false,
            "product_img": "https://img.ep4n.com/products/55-1592337951.gif",
            "merchant_id": 27,
            "merchant_name_en": "Pubg Card",
            "merchant_name_ar": "بطاقات بابجي"
        },
        {
            "product_id": 88,
            "product_name_en": "Free fire card 210 Diamonds - Garena",
            "product_name_ar": "بطاقة فري فاير - جارينا 210 ماسة",
            "availability": true,
            "product_price": 35,
            "agent_price": 34.13,
            "pre_order": false,
            "product_img": "https://img.ep4n.com/products/88-1594420464.gif",
            "merchant_id": 28,
            "merchant_name_en": "Free Fire Card",
            "merchant_name_ar": "كروت فري فاير"
        },
        {
            "product_id": 295,
            "product_name_en": "Mobile Legends 2645 Diamonds Card",
            "product_name_ar": "كارت موبايل ليجند 2645 ماسة",
            "availability": false,
            "product_price": 769,
            "agent_price": 749.78,
            "pre_order": false,
            "product_img": "https://img.ep4n.com/products/295-1620140380.jpg",
            "merchant_id": 68,
            "merchant_name_en": "Mobile Legends: Bang Bang Diamonds Cards",
            "merchant_name_ar": "كروت ليجند موبايل Bang Bang"
        },
        {
            "product_id": 86,
            "product_name_en": "Free fire 2200 Diamonds - Garena",
            "product_name_ar": "شحن فري فاير -  جارينا 2200 ماسة",
            "availability": true,
            "product_price": 330,
            "agent_price": 313.09,
            "pre_order": false,
            "product_img": "https://img.ep4n.com/products/86-1594420647.gif",
            "merchant_id": 17,
            "merchant_name_en": "Top-up Free Fire",
            "merchant_name_ar": "شحن فري فاير"
        }
    ]
}

Response Parameters Description.

Arguments Data Type Description
success Boolean true : method returned successfully
false : error
response Integer Response Code, refer to Response Codes
action String Method Name
result Array Method Array of returned data
product_id Integer EasyPayForNet Business Product code
product_name_en String EasyPayForNet Business Product Name in English Language
product_name_ar String EasyPayForNet Business Product Name in Arabic Language
availability Boolean true : product is available at EasyPayForNet Business System
false : product is not available
product_price Double EasyPayForNet Business Product original price
agent_price Double EasyPayForNet Business Product Agent price
pre_order Boolean true : The product support pre-order
false: The product doesn't support pre-order
product_img String Url of Product Image
merchant_id Integer EasyPayForNet Business Merchant code
merchant_name_en String EasyPayForNet Business Merchant Name in English Language
merchant_name_ar String EasyPayForNet Business Merchant Name in Arabic Language

6-Get Products Of Merchant.

Retrieve All Products list of selected Merchant that assigned to EasyPayForNet Business API Version 1.

Http Url:

    
Path + GetProductsOfMerchant
//Example https://staging.api.ep4n.dev/v1/GetProductsOfMerchant    
    

Signature Hash:


// secret_key = "G3l8Xl9WCypnww4aGRsAF3efRBBpQFiGHWsxRqWAOi0cUE7r2GkaxIEziJfExjIHN4Wq2PUvvADutOFNxuwsXtQUl58irAiBDizD6dWpYy7augE0mWJPKnVCN8pE8jzW"
// public_key = "1636574141"
// example Value Of ($merchant_id)
$merchant_id = 21
sign = strtoupper(hash('sha256', $public_key . ":" . $merchant_id . ":" .$secret_key));

Request Example:


{
    "public_key": "1636574141",
    "merchant_id": 21,
    "sign": "467F90A741EEA19EF288FD80BC2522C86D7546F3D11AF6899FB6680B09A9B666",
}

Request Parameters Description.

Arguments Data Type Description
public_key String Public Key Provided by EasyPayForNet API Integration Team
merchant_id Integer EasyPayForNet Business Merchant code
sign String Signature Hash as explained (Uppercase of sha256 Hash concatenation of public_key + ":" + merchant_id + ":" + secret_key)

Code Example:

    
    
$path = "https://staging.api.ep4n.dev/v1/"; $url = $path . "GetProductsOfMerchant"; $public_key = 1636574141; $merchant_id = 21; $secret_key = "G3l8Xl9WCypnww4aGRsAF3efRBBpQFiGHWsxRqWAOi0cUE7r2GkaxIEziJfExjIHN4Wq2PUvvADutOFNxuwsXtQUl58irAiBDizD6dWpYy7augE0mWJPKnVCN8pE8jzW"; $signMessage = $public_key . ":" .$merchant_id . ":" .$secret_key; $signHash = hash('sha256', $signMessage); $sign = strtoupper($signHash); $post_array = ["public_key" => $public_key, 'merchant_id' => $merchant_id, "sign" => $sign]; $ch = curl_init(); curl_setopt($ch, CURLOPT_URL, $url); curl_setopt($ch, CURLOPT_RETURNTRANSFER, TRUE); curl_setopt($ch, CURLOPT_HEADER, FALSE); curl_setopt($ch, CURLOPT_POST, TRUE); curl_setopt($ch, CURLOPT_POSTFIELDS, json_encode($post_array)); curl_setopt($ch, CURLOPT_HTTPHEADER, array( "Content-Type: application/json" )); $response = curl_exec($ch); curl_close($ch); var_dump($response);
    
    
// Cdn Of Axios Library https://cdn.jsdelivr.net/npm/axios/dist/axios.min.js // Cdn Of Hash Library https://cdnjs.cloudflare.com/ajax/libs/jsSHA/3.2.0/sha.min.js function GetProductsOfMerchant() { let path = "https://staging.api.ep4n.dev/v1/" let url = path + "GetProductsOfMerchant"; let public_key = "1636574141"; let merchant_id = 21; let secret_key = "G3l8Xl9WCypnww4aGRsAF3efRBBpQFiGHWsxRqWAOi0cUE7r2GkaxIEziJfExjIHN4Wq2PUvvADutOFNxuwsXtQUl58irAiBDizD6dWpYy7augE0mWJPKnVCN8pE8jzW" // Signature Code let signature = public_key + ":" + merchant_id + ":" + secret_key; // Hash Signature Code Then Convert It To Uppercase let sha256 = new jsSHA('SHA-256', 'TEXT'); sha256.update(signature); let sign = sha256.getHash("HEX").toUpperCase(); axios.post(url, { // Request Data 'public_key': public_key, 'merchant_id' : merchant_id, 'sign' : sign }) .then(response => { // Response console.log(response.data) // Response Value console.log(response.data.response) // Response Data console.log(response.data.result) }) .catch(error => { // Catch Error if Found console.log(error.response.data) }) } GetAccountBalance()
    
    
import java.io.BufferedReader; import java.io.IOException; import java.io.InputStreamReader; import java.io.OutputStream; import java.net.HttpURLConnection; import java.net.URL; import java.security.MessageDigest; import java.security.NoSuchAlgorithmException; import java.util.Locale; public class "GetProductsOfMerchant" { public static void main(String[] args) throws IOException { try { String Path = "https://staging.api.ep4n.dev/v1/"; String Url = Path + "GetProductsOfMerchant"; String public_key = "1636574141"; String merchant_id = "21"; String secret_key = "G3l8Xl9WCypnww4aGRsAF3efRBBpQFiGHWsxRqWAOi0cUE7r2GkaxIEziJfExjIHN4Wq2PUvvADutOFNxuwsXtQUl58irAiBDizD6dWpYy7augE0mWJPKnVCN8pE8jzW"; String sign_message = public_key + ":" + merchant_id + ":" + secret_key; final MessageDigest digest = MessageDigest.getInstance("SHA-256"); //convert sign_message to SHA 256 final byte[] hash = digest.digest(sign_message.getBytes("UTF-8")); final StringBuilder hexString = new StringBuilder(); for (int i = 0; i < hash.length; i++) { final String hex = Integer.toHexString(0xff & hash[i]); if (hex.length() == 1) hexString.append('0'); hexString.append(hex); } String sign = hexString.toString().toUpperCase(Locale.ROOT); //convert SHA 256 to UpperCase String postData = "{}"; URL obj = new URL(Url); HttpURLConnection con = (HttpURLConnection) obj.openConnection(); con.setRequestProperty("Accept", "application/json"); con.setRequestMethod("POST"); con.setDoOutput(true); OutputStream os = con.getOutputStream(); os.write(postData.getBytes()); os.flush(); os.close(); int responseCode = con.getResponseCode(); // POST Response Code if (responseCode == HttpURLConnection.HTTP_OK) { //success BufferedReader in = new BufferedReader(new InputStreamReader( con.getInputStream())); String inputLine; StringBuffer response = new StringBuffer(); while ((inputLine = in.readLine()) != null) { response.append(inputLine); } in.close(); System.out.println(response.toString()); // print result } } catch (IOException | NoSuchAlgorithmException e) { e.printStackTrace(); } } }
    
    
import requests import hashlib Path = "https://staging.api.ep4n.dev/v1/" URL = Path + "GetProductsOfMerchant" public_key = "1636574141" merchant_id = 21; secret_key = "G3l8Xl9WCypnww4aGRsAF3efRBBpQFiGHWsxRqWAOi0cUE7r2GkaxIEziJfExjIHN4Wq2PUvvADutOFNxuwsXtQUl58irAiBDizD6dWpYy7augE0mWJPKnVCN8pE8jzW" sign = hashlib.sha256(public_key + ":" + merchant_id + ":" + secret_key).hexdigest() PaymentData = { 'public_key': public_key, 'merchant_id' : merchant_id, 'sign' : sign } status_request = requests.post(url = URL, params = json.dumps(PaymentData)) status_response = status_request.json()
    
    
import UIKit import Alamofire import CryptoKit class GetProductsOfMerchant: UIViewController { let public_key = "1636574141" var merchant_id = "21"; let secret_key = "G3l8Xl9WCypnww4aGRsAF3efRBBpQFiGHWsxRqWAOi0cUE7r2GkaxIEziJfExjIHN4Wq2PUvvADutOFNxuwsXtQUl58irAiBDizD6dWpYy7augE0mWJPKnVCN8pE8jzW" let separator_char = ":" // Create HASh (SHA256) func hash(public_key: String, separator_char: String, merchant_id: String , secret_key: String) -> String { let digest = SHA256.hash(data: (public_key+separator_char+merchant_id+separator_char+secret_key).data(using: .utf8) ?? Data()) return digest.map { String(format: "%02x", $0) }.joined() } override func viewDidLoad() { super.viewDidLoad() () } func GetProductsOfMerchant() { let sign = hash(public_key: public_key, separator_char: separator_char, merchant_id: merchant_id, secret_key: secret_key).uppercased() let parameters = ["public_key": public_key, "merchant_id": merchant_id, "sign": sign ] let path = "https://staging.api.ep4n.dev/v1/" let url = path + "GetProductsOfMerchant" AF.request(url, method: .post, parameters: parameters, encoding: JSONEncoding.default, headers: nil).responseJSON { response in switch response.result { case .failure(let error): print(error) case .success(let value): print(value) } } } }

Response Example:


{
    "success": true,
    "response": 200,
    "action": "GetProductsOfMerchant",
    "result": [
        {
            "product_id": 108,
            "product_name_en": "iTunes USD 5 Gift Card",
            "product_name_ar": "بطاقة ايتونز امريكي 5 دولار",
            "availability": true,
            "product_price": 84,
            "agent_price": 79.48,
            "pre_order": false,
            "product_img": "https://img.ep4n.com/products/108-1592515074.gif",
            "merchant_id": 21,
            "merchant_name_en": "iTunes (US)",
            "merchant_name_ar": "ايتونز امريكي"
        },
        {
            "product_id": 109,
            "product_name_en": "iTunes USD 10 Gift Card",
            "product_name_ar": "بطاقة ايتونز امريكي 10 دولار",
            "availability": true,
            "product_price": 168,
            "agent_price": 158.96,
            "pre_order": false,
            "product_img": "https://img.ep4n.com/products/109-1592515088.gif",
            "merchant_id": 21,
            "merchant_name_en": "iTunes (US)",
            "merchant_name_ar": "ايتونز امريكي"

        },
        {
            "product_id": 86,
            "product_name_en": "Free fire 2200 Diamonds - Garena",
            "product_name_ar": "شحن فري فاير -  جارينا 2200 ماسة",
            "availability": true,
            "product_price": 330,
            "agent_price": 313.09,
            "pre_order": false,
            "product_img": "https://img.ep4n.com/products/86-1594420647.gif",
            "merchant_id": 17,
            "merchant_name_en": "Top-up Free Fire",
            "merchant_name_ar": "شحن فري فاير"
        }
    ]
}

Response Parameters Description.

Arguments Data Type Description
success Boolean true : method returned successfully
false : error
response Integer Response Code, refer to Response Codes
action String Method Name
result Array Method Array of returned data
product_id Integer EasyPayForNet Business Product code
product_name_en String EasyPayForNet Business Product Name in English Language
product_name_ar String EasyPayForNet Business Product Name in Arabic Language
availability Boolean true : product is available at EasyPayForNet Business System
false : product is not available
product_price Double EasyPayForNet Business Product original price
agent_price Double EasyPayForNet Business Product Agent price
pre_order Boolean true : The product support pre-order
false: The product doesn't support pre-order
product_img String Url of Product Image
merchant_id Integer EasyPayForNet Business Merchant code
merchant_name_en String EasyPayForNet Business Merchant Name in English Language
merchant_name_ar String EasyPayForNet Business Merchant Name in Arabic Language

7-Get Product Info Availability.

Retrieving a product information and status.

Http Url:

    
Path + GetProductInfoAvailability
//Example https://staging.api.ep4n.dev/v1/GetProductInfoAvailability    
    

Signature Hash:


// secret_key = "G3l8Xl9WCypnww4aGRsAF3efRBBpQFiGHWsxRqWAOi0cUE7r2GkaxIEziJfExjIHN4Wq2PUvvADutOFNxuwsXtQUl58irAiBDizD6dWpYy7augE0mWJPKnVCN8pE8jzW"
// public_key = "1636574141"
// example Value Of ($product_id)
$product_id = 260
sign = strtoupper(hash('sha256', $public_key . ":" . $product_id . ":" .$secret_key));

Request Example:


{
    "public_key": "1636574141",
    "product_id": 260,
    "sign": "19130ABA683D8C95D47652B9B7B2EF8D4A982BCAE8823A5CEA51B1D376C56D51",
}

Request Parameters Description.

Arguments Data Type Description
public_key String Public Key Provided by EasyPayForNet API Integration Team
product_id Integer EasyPayForNet Business Product code
sign String Signature Hash as explained (Uppercase of sha256 Hash concatenation of public_key + ":" + product_id + ":" + secret_key)

Code Example:

    
    
$path = "https://staging.api.ep4n.dev/v1/"; $url = $path . "GetProductInfoAvailability"; $public_key = 1636574141; $product_id = 260; $secret_key = "G3l8Xl9WCypnww4aGRsAF3efRBBpQFiGHWsxRqWAOi0cUE7r2GkaxIEziJfExjIHN4Wq2PUvvADutOFNxuwsXtQUl58irAiBDizD6dWpYy7augE0mWJPKnVCN8pE8jzW"; $signMessage = $public_key . ":" .$product_id . ":" .$secret_key; $signHash = hash('sha256', $signMessage); $sign = strtoupper($signHash); $post_array = ["public_key" => $public_key, 'product_id' => $product_id, "sign" => $sign]; $ch = curl_init(); curl_setopt($ch, CURLOPT_URL, $url); curl_setopt($ch, CURLOPT_RETURNTRANSFER, TRUE); curl_setopt($ch, CURLOPT_HEADER, FALSE); curl_setopt($ch, CURLOPT_POST, TRUE); curl_setopt($ch, CURLOPT_POSTFIELDS, json_encode($post_array)); curl_setopt($ch, CURLOPT_HTTPHEADER, array( "Content-Type: application/json" )); $response = curl_exec($ch); curl_close($ch); var_dump($response);
    
    
// Cdn Of Axios Library https://cdn.jsdelivr.net/npm/axios/dist/axios.min.js // Cdn Of Hash Library https://cdnjs.cloudflare.com/ajax/libs/jsSHA/3.2.0/sha.min.js function GetProductInfoAvailability() { let path = "https://staging.api.ep4n.dev/v1/" let url = path + "GetProductInfoAvailability"; let public_key = "1636574141"; let product_id = 260; let secret_key = "G3l8Xl9WCypnww4aGRsAF3efRBBpQFiGHWsxRqWAOi0cUE7r2GkaxIEziJfExjIHN4Wq2PUvvADutOFNxuwsXtQUl58irAiBDizD6dWpYy7augE0mWJPKnVCN8pE8jzW" // Signature Code let signature = public_key + ":" + product_id + ":" + secret_key; // Hash Signature Code Then Convert It To Uppercase let sha256 = new jsSHA('SHA-256', 'TEXT'); sha256.update(signature); let sign = sha256.getHash("HEX").toUpperCase(); axios.post(url, { // Request Data 'public_key': public_key, 'product_id' : product_id, 'sign' : sign }) .then(response => { // Response console.log(response.data) // Response Value console.log(response.data.response) // Response Data console.log(response.data.result) }) .catch(error => { // Catch Error if Found console.log(error.response.data) }) } GetAccountBalance()
    
    
import java.io.BufferedReader; import java.io.IOException; import java.io.InputStreamReader; import java.io.OutputStream; import java.net.HttpURLConnection; import java.net.URL; import java.security.MessageDigest; import java.security.NoSuchAlgorithmException; import java.util.Locale; public class "GetProductInfoAvailability" { public static void main(String[] args) throws IOException { try { String Path = "https://staging.api.ep4n.dev/v1/"; String Url = Path + "GetProductInfoAvailability"; String public_key = "1636574141"; String product_id = "260"; String secret_key = "G3l8Xl9WCypnww4aGRsAF3efRBBpQFiGHWsxRqWAOi0cUE7r2GkaxIEziJfExjIHN4Wq2PUvvADutOFNxuwsXtQUl58irAiBDizD6dWpYy7augE0mWJPKnVCN8pE8jzW"; String sign_message = public_key + ":" + product_id + ":" + secret_key; final MessageDigest digest = MessageDigest.getInstance("SHA-256"); //convert sign_message to SHA 256 final byte[] hash = digest.digest(sign_message.getBytes("UTF-8")); final StringBuilder hexString = new StringBuilder(); for (int i = 0; i < hash.length; i++) { final String hex = Integer.toHexString(0xff & hash[i]); if (hex.length() == 1) hexString.append('0'); hexString.append(hex); } String sign = hexString.toString().toUpperCase(Locale.ROOT); //convert SHA 256 to UpperCase String postData = "{}"; URL obj = new URL(Url); HttpURLConnection con = (HttpURLConnection) obj.openConnection(); con.setRequestProperty("Accept", "application/json"); con.setRequestMethod("POST"); con.setDoOutput(true); OutputStream os = con.getOutputStream(); os.write(postData.getBytes()); os.flush(); os.close(); int responseCode = con.getResponseCode(); // POST Response Code if (responseCode == HttpURLConnection.HTTP_OK) { //success BufferedReader in = new BufferedReader(new InputStreamReader( con.getInputStream())); String inputLine; StringBuffer response = new StringBuffer(); while ((inputLine = in.readLine()) != null) { response.append(inputLine); } in.close(); System.out.println(response.toString()); // print result } } catch (IOException | NoSuchAlgorithmException e) { e.printStackTrace(); } } }
    
    
import requests import hashlib Path = "https://staging.api.ep4n.dev/v1/" URL = Path + "GetProductInfoAvailability" public_key = "1636574141" product_id = 260; secret_key = "G3l8Xl9WCypnww4aGRsAF3efRBBpQFiGHWsxRqWAOi0cUE7r2GkaxIEziJfExjIHN4Wq2PUvvADutOFNxuwsXtQUl58irAiBDizD6dWpYy7augE0mWJPKnVCN8pE8jzW" sign = hashlib.sha256(public_key + ":" + product_id + ":" + secret_key).hexdigest() PaymentData = { 'public_key': public_key, 'product_id' : product_id, 'sign' : sign } status_request = requests.post(url = URL, params = json.dumps(PaymentData)) status_response = status_request.json()
    
    
import UIKit import Alamofire import CryptoKit class GetProductInfoAvailability: UIViewController { let public_key = "1636574141" var product_id = "260"; let secret_key = "G3l8Xl9WCypnww4aGRsAF3efRBBpQFiGHWsxRqWAOi0cUE7r2GkaxIEziJfExjIHN4Wq2PUvvADutOFNxuwsXtQUl58irAiBDizD6dWpYy7augE0mWJPKnVCN8pE8jzW" let separator_char = ":" // Create HASh (SHA256) func hash(public_key: String, separator_char: String, product_id: String , secret_key: String) -> String { let digest = SHA256.hash(data: (public_key+separator_char+product_id+separator_char+secret_key).data(using: .utf8) ?? Data()) return digest.map { String(format: "%02x", $0) }.joined() } override func viewDidLoad() { super.viewDidLoad() () } func GetProductInfoAvailability() { let sign = hash(public_key: public_key, separator_char: separator_char, product_id: product_id, secret_key: secret_key).uppercased() let parameters = ["public_key": public_key, "product_id": product_id, "sign": sign ] let path = "https://staging.api.ep4n.dev/v1/" let url = path + "GetProductInfoAvailability" AF.request(url, method: .post, parameters: parameters, encoding: JSONEncoding.default, headers: nil).responseJSON { response in switch response.result { case .failure(let error): print(error) case .success(let value): print(value) } } } }

Response Example:


 // Response Example 1:
{
    "success": true,
    "response": 200,
    "action": "GetProductInfoAvailability",
    "result": {
        "availability": false,
        "product_id": 112,
        "merchant_id": 21,
        "product_price": 892,
        "agent_price": 869.7,
        "pre_order": false
        }
}
// Response Example 2:
{
    "success": true,
    "response": 200,
    "action": "GetProductInfoAvailability",
    "result": {
        "availability": true,
        "product_id": 112,
        "merchant_id": 21,
        "product_price": 892,
        "agent_price": 869.7,
        "pre_order": false
        }
}


Response Parameters Description.

Arguments Data Type Description
success Boolean true : method returned successfully
false : error
response Integer Response Code, refer to Response Codes
action String Method Name
result Array Method Array of returned data
availability Boolean true : product is available at EasyPayForNet Business System
false : product is not available
product_id Integer EasyPayForNet Business Product code
merchant_id Integer EasyPayForNet Business Merchant code
product_price Double EasyPayForNet Business Product original price
agent_price Double EasyPayForNet Business Product Agent price
pre_order Boolean true : The product support pre-order
false: The product doesn't support pre-order

8-Purchase Product.

performing a purchase product operation.

Http Url:

    
Path + PurchaseProduct
//Example https://staging.api.ep4n.dev/v1/PurchaseProduct    
    

Signature Hash:


// secret_key = "G3l8Xl9WCypnww4aGRsAF3efRBBpQFiGHWsxRqWAOi0cUE7r2GkaxIEziJfExjIHN4Wq2PUvvADutOFNxuwsXtQUl58irAiBDizD6dWpYy7augE0mWJPKnVCN8pE8jzW"
// public_key = "1636574141"
// example Value Of ($product_id)
$product_id = 260
// example Value Of ($reference_no)
$reference_no = 163875606798961
sign = strtoupper(hash('sha256', $public_key . ":" . $product_id . ":" . $reference_no . ":" . $secret_key));

Request Example:


{
    "public_key": "1636574141",
    "product_id": 260,
    "reference_no": "163875606798961",
    "sign": "E3410D9C80914E26A90868871911CE52820910D7B36D2D69CD752C3302AA41E1",
}

Request Parameters Description.

Arguments Data Type Description
public_key String Public Key Provided by EasyPayForNet API Integration Team
product_id Integer EasyPayForNet Business Merchant code
reference_no String (unique) by your side (could be timestamp)
example: (String UUID) bb715b4e-6792-45ca-9ca5-2d708f41a6e0
example: 2020-01-01-00-00-01
example: (Int) 1577836801
sign String Signature Hash as explained (Uppercase of sha256 Hash concatenation of public_key + ":" + product_id + ":" + reference_no + ":" + secret_key)

Code Example:

    
    
$path = "https://staging.api.ep4n.dev/v1/"; $url = $path . "PurchaseProduct"; $public_key = 1636574141; $product_id = 260; $reference_no = "163875606798961"; $secret_key = "G3l8Xl9WCypnww4aGRsAF3efRBBpQFiGHWsxRqWAOi0cUE7r2GkaxIEziJfExjIHN4Wq2PUvvADutOFNxuwsXtQUl58irAiBDizD6dWpYy7augE0mWJPKnVCN8pE8jzW"; $signMessage = $public_key . ":" .$product_id . ":" .$reference_no . ":" .$secret_key; $signHash = hash('sha256', $signMessage); $sign = strtoupper($signHash); $post_array = ["public_key" => $public_key, 'product_id' => $product_id, 'reference_no' => $reference_no, "sign" => $sign]; $ch = curl_init(); curl_setopt($ch, CURLOPT_URL, $url); curl_setopt($ch, CURLOPT_RETURNTRANSFER, TRUE); curl_setopt($ch, CURLOPT_HEADER, FALSE); curl_setopt($ch, CURLOPT_POST, TRUE); curl_setopt($ch, CURLOPT_POSTFIELDS, json_encode($post_array)); curl_setopt($ch, CURLOPT_HTTPHEADER, array( "Content-Type: application/json" )); $response = curl_exec($ch); curl_close($ch); var_dump($response);
    
    
// Cdn Of Axios Library https://cdn.jsdelivr.net/npm/axios/dist/axios.min.js // Cdn Of Hash Library https://cdnjs.cloudflare.com/ajax/libs/jsSHA/3.2.0/sha.min.js function PurchaseProduct() { let path = "https://staging.api.ep4n.dev/v1/" let url = path + "PurchaseProduct"; let public_key = "1636574141"; let product_id = 260; let reference_no = "163875606798961"; let secret_key = "G3l8Xl9WCypnww4aGRsAF3efRBBpQFiGHWsxRqWAOi0cUE7r2GkaxIEziJfExjIHN4Wq2PUvvADutOFNxuwsXtQUl58irAiBDizD6dWpYy7augE0mWJPKnVCN8pE8jzW" // Signature Code let signature = public_key + ":" + product_id + ":" + reference_no + ":" + secret_key; // Hash Signature Code Then Convert It To Uppercase let sha256 = new jsSHA('SHA-256', 'TEXT'); sha256.update(signature); let sign = sha256.getHash("HEX").toUpperCase(); axios.post(url, { // Request Data 'public_key': public_key, 'product_id' : product_id, 'reference_no' : reference_no, 'sign' : sign }) .then(response => { // Response console.log(response.data) // Response Value console.log(response.data.response) // Response Data console.log(response.data.result) }) .catch(error => { // Catch Error if Found console.log(error.response.data) }) } GetAccountBalance()
    
    
import java.io.BufferedReader; import java.io.IOException; import java.io.InputStreamReader; import java.io.OutputStream; import java.net.HttpURLConnection; import java.net.URL; import java.security.MessageDigest; import java.security.NoSuchAlgorithmException; import java.util.Locale; public class "PurchaseProduct" { public static void main(String[] args) throws IOException { try { String Path = "https://staging.api.ep4n.dev/v1/"; String Url = Path + "PurchaseProduct"; String public_key = "1636574141"; String product_id = "260"; String reference_no = "163875606798961"; String secret_key = "G3l8Xl9WCypnww4aGRsAF3efRBBpQFiGHWsxRqWAOi0cUE7r2GkaxIEziJfExjIHN4Wq2PUvvADutOFNxuwsXtQUl58irAiBDizD6dWpYy7augE0mWJPKnVCN8pE8jzW"; String sign_message = public_key + ":" + product_id + ":" + reference_no + ":" + secret_key; final MessageDigest digest = MessageDigest.getInstance("SHA-256"); //convert sign_message to SHA 256 final byte[] hash = digest.digest(sign_message.getBytes("UTF-8")); final StringBuilder hexString = new StringBuilder(); for (int i = 0; i < hash.length; i++) { final String hex = Integer.toHexString(0xff & hash[i]); if (hex.length() == 1) hexString.append('0'); hexString.append(hex); } String sign = hexString.toString().toUpperCase(Locale.ROOT); //convert SHA 256 to UpperCase String postData = "{}"; URL obj = new URL(Url); HttpURLConnection con = (HttpURLConnection) obj.openConnection(); con.setRequestProperty("Accept", "application/json"); con.setRequestMethod("POST"); con.setDoOutput(true); OutputStream os = con.getOutputStream(); os.write(postData.getBytes()); os.flush(); os.close(); int responseCode = con.getResponseCode(); // POST Response Code if (responseCode == HttpURLConnection.HTTP_OK) { //success BufferedReader in = new BufferedReader(new InputStreamReader( con.getInputStream())); String inputLine; StringBuffer response = new StringBuffer(); while ((inputLine = in.readLine()) != null) { response.append(inputLine); } in.close(); System.out.println(response.toString()); // print result } } catch (IOException | NoSuchAlgorithmException e) { e.printStackTrace(); } } }
    
    
import requests import hashlib Path = "https://staging.api.ep4n.dev/v1/" URL = Path + "PurchaseProduct" public_key = "1636574141" product_id = 260; reference_no = "163875606798961"; secret_key = "G3l8Xl9WCypnww4aGRsAF3efRBBpQFiGHWsxRqWAOi0cUE7r2GkaxIEziJfExjIHN4Wq2PUvvADutOFNxuwsXtQUl58irAiBDizD6dWpYy7augE0mWJPKnVCN8pE8jzW" sign = hashlib.sha256(public_key + ":" + product_id + ":" + reference_no + ":" + secret_key).hexdigest() PaymentData = { 'public_key': public_key, 'product_id' : product_id, 'reference_no' : reference_no, 'sign' : sign } status_request = requests.post(url = URL, params = json.dumps(PaymentData)) status_response = status_request.json()
    
    
import UIKit import Alamofire import CryptoKit class PurchaseProduct: UIViewController { let public_key = "1636574141" var product_id = "260"; var reference_no = "163875606798961"; let secret_key = "G3l8Xl9WCypnww4aGRsAF3efRBBpQFiGHWsxRqWAOi0cUE7r2GkaxIEziJfExjIHN4Wq2PUvvADutOFNxuwsXtQUl58irAiBDizD6dWpYy7augE0mWJPKnVCN8pE8jzW" let separator_char = ":" // Create HASh (SHA256) func hash(public_key: String, separator_char: String, product_id: String, reference_no: String , secret_key: String) -> String { let digest = SHA256.hash(data: (public_key+separator_char+product_id+separator_char+reference_no+separator_char+secret_key).data(using: .utf8) ?? Data()) return digest.map { String(format: "%02x", $0) }.joined() } override func viewDidLoad() { super.viewDidLoad() () } func PurchaseProduct() { let sign = hash(public_key: public_key, separator_char: separator_char, product_id: product_id, reference_no: reference_no, secret_key: secret_key).uppercased() let parameters = ["public_key": public_key, "product_id": product_id, "reference_no": reference_no, "sign": sign ] let path = "https://staging.api.ep4n.dev/v1/" let url = path + "PurchaseProduct" AF.request(url, method: .post, parameters: parameters, encoding: JSONEncoding.default, headers: nil).responseJSON { response in switch response.result { case .failure(let error): print(error) case .success(let value): print(value) } } } }

Response Example:


// Response Example 1:
{
    "success": true,
    "response": 200,
    "action": "PurchaseProduct",
    "result": {
        "order": {
            "order_no": 257273,
            "status_code": 200,
            "status_text": "Success",
            "item_price": 869.7,
            "items": 1,
            "total_price": 869.7,
            "reference_no": "163875606798961",
            "time": "2021-12-06 04:01:11"
        },
        "product": {
            "product_id": 112,
            "product_name_en": "iTunes USD 50 Gift Card",
            "product_name_ar": "بطاقة ايتونز امريكي 50 دولار"
        },
        "cards": [
            {
                "card": "TestCard:1638756070",
                "serial": "TestSerial:1638756070",
                "expiry": null,
                "ref": "112_1638756070984_1"
            }
        ]
    }
}

// Response Example 2:
{
    "success": true,
    "response": 200,
    "action": "PurchaseProduct",
    "result": {
        "order": {
            "order_no": 257274,
            "status_code": 300714,
            "status_text": "Refunded due:Service not available!, Please try again later\nالخدمة غير متوفره، يرجى المحاولة لاحقاً",
            "item_price": 869.7,
            "items": 1,
            "total_price": 869.7,
            "reference_no": "163875695269661",
            "time": "2021-12-06 04:15:54"
        },
        "product": {
            "product_id": 112,
            "product_name_en": "iTunes USD 50 Gift Card",
            "product_name_ar": "بطاقة ايتونز امريكي 50 دولار"
        },
        "cards": []
    }
}

Response Parameters Description.

Arguments Data Type Description
success Boolean true : method returned successfully
false : error
response Integer Response Code, refer to Response Codes
action String Method Name
result Array Method Array of returned data
order Array Array of Order Details
order_no Integer EasyPayForNet Business Transaction Number
status_code Integer EasyPayForNet Business Transaction Status Code, refer to Response Codes
status_text String EasyPayForNet Business Transaction Status Details
item_price Double EasyPayForNet Business Each Product price
items Integer Item Count of Cards
total_price Double Total Price of Items
reference_no String reference_no sent in the request
product Array Array of Product Details
product_id Integer EasyPayForNet Business Product code
product_name_en String EasyPayForNet Business Product Name in English Language
product_name_ar String EasyPayForNet Business Product Name in Arabic Language
cards Array Array Of Cards
card String Card secret
serial String Or Null Card Serial Number
expiry String Or Null Card Expiry date if exist
ref String Or Null EasyPayForNet Business Card reference code, don't share it with customer

9-Retrieve Order Card Detail.

Retrieving a Order information, status And the Card Details by order number.

Http Url:

    
Path + RetrieveOrderCardDetail
//Example https://staging.api.ep4n.dev/v1/RetrieveOrderCardDetail    
    

Signature Hash:


// secret_key = "G3l8Xl9WCypnww4aGRsAF3efRBBpQFiGHWsxRqWAOi0cUE7r2GkaxIEziJfExjIHN4Wq2PUvvADutOFNxuwsXtQUl58irAiBDizD6dWpYy7augE0mWJPKnVCN8pE8jzW"
// public_key = "1636574141"
// example Value Of ($order_no)
$order_no = 257273
sign = strtoupper(hash('sha256', $public_key . ":" . $order_no . ":" . $secret_key));

Request Example:


{
    "public_key": "1636574141",
    "order_no": 257273,
    "sign": "C9A31CC10388A7821EE24D5DEA70C7E88588BB68C76F33AEA9C27C69A7E558AD",
}

Request Parameters Description.

Arguments Data Type Description
public_key String Public Key Provided by EasyPayForNet API Integration Team
order_no Integer EasyPayForNet Business Transaction Number
sign String Signature Hash as explained (Uppercase of sha256 Hash concatenation of public_key + ":" + order_no + ":" + secret_key)

Code Example:

    
    
$path = "https://staging.api.ep4n.dev/v1/"; $url = $path . "RetrieveOrderCardDetail"; $public_key = 1636574141; $order_no = 257273; $secret_key = "G3l8Xl9WCypnww4aGRsAF3efRBBpQFiGHWsxRqWAOi0cUE7r2GkaxIEziJfExjIHN4Wq2PUvvADutOFNxuwsXtQUl58irAiBDizD6dWpYy7augE0mWJPKnVCN8pE8jzW"; $signMessage = $public_key . ":" .$order_no . ":" .$secret_key; $signHash = hash('sha256', $signMessage); $sign = strtoupper($signHash); $post_array = ["public_key" => $public_key, 'order_no' => $order_no, "sign" => $sign]; $ch = curl_init(); curl_setopt($ch, CURLOPT_URL, $url); curl_setopt($ch, CURLOPT_RETURNTRANSFER, TRUE); curl_setopt($ch, CURLOPT_HEADER, FALSE); curl_setopt($ch, CURLOPT_POST, TRUE); curl_setopt($ch, CURLOPT_POSTFIELDS, json_encode($post_array)); curl_setopt($ch, CURLOPT_HTTPHEADER, array( "Content-Type: application/json" )); $response = curl_exec($ch); curl_close($ch); var_dump($response);
    
    
// Cdn Of Axios Library https://cdn.jsdelivr.net/npm/axios/dist/axios.min.js // Cdn Of Hash Library https://cdnjs.cloudflare.com/ajax/libs/jsSHA/3.2.0/sha.min.js function RetrieveOrderCardDetail() { let path = "https://staging.api.ep4n.dev/v1/" let url = path + "RetrieveOrderCardDetail"; let public_key = "1636574141"; let order_no = 257273; let secret_key = "G3l8Xl9WCypnww4aGRsAF3efRBBpQFiGHWsxRqWAOi0cUE7r2GkaxIEziJfExjIHN4Wq2PUvvADutOFNxuwsXtQUl58irAiBDizD6dWpYy7augE0mWJPKnVCN8pE8jzW" // Signature Code let signature = public_key + ":" + order_no + ":" + secret_key; // Hash Signature Code Then Convert It To Uppercase let sha256 = new jsSHA('SHA-256', 'TEXT'); sha256.update(signature); let sign = sha256.getHash("HEX").toUpperCase(); axios.post(url, { // Request Data 'public_key': public_key, 'order_no' : order_no, 'sign' : sign }) .then(response => { // Response console.log(response.data) // Response Value console.log(response.data.response) // Response Data console.log(response.data.result) }) .catch(error => { // Catch Error if Found console.log(error.response.data) }) } GetAccountBalance()
    
    
import java.io.BufferedReader; import java.io.IOException; import java.io.InputStreamReader; import java.io.OutputStream; import java.net.HttpURLConnection; import java.net.URL; import java.security.MessageDigest; import java.security.NoSuchAlgorithmException; import java.util.Locale; public class "RetrieveOrderCardDetail" { public static void main(String[] args) throws IOException { try { String Path = "https://staging.api.ep4n.dev/v1/"; String Url = Path + "RetrieveOrderCardDetail"; String public_key = "1636574141"; String order_no = "257273"; String secret_key = "G3l8Xl9WCypnww4aGRsAF3efRBBpQFiGHWsxRqWAOi0cUE7r2GkaxIEziJfExjIHN4Wq2PUvvADutOFNxuwsXtQUl58irAiBDizD6dWpYy7augE0mWJPKnVCN8pE8jzW"; String sign_message = public_key + ":" + order_no + ":" + secret_key; final MessageDigest digest = MessageDigest.getInstance("SHA-256"); //convert sign_message to SHA 256 final byte[] hash = digest.digest(sign_message.getBytes("UTF-8")); final StringBuilder hexString = new StringBuilder(); for (int i = 0; i < hash.length; i++) { final String hex = Integer.toHexString(0xff & hash[i]); if (hex.length() == 1) hexString.append('0'); hexString.append(hex); } String sign = hexString.toString().toUpperCase(Locale.ROOT); //convert SHA 256 to UpperCase String postData = "{}"; URL obj = new URL(Url); HttpURLConnection con = (HttpURLConnection) obj.openConnection(); con.setRequestProperty("Accept", "application/json"); con.setRequestMethod("POST"); con.setDoOutput(true); OutputStream os = con.getOutputStream(); os.write(postData.getBytes()); os.flush(); os.close(); int responseCode = con.getResponseCode(); // POST Response Code if (responseCode == HttpURLConnection.HTTP_OK) { //success BufferedReader in = new BufferedReader(new InputStreamReader( con.getInputStream())); String inputLine; StringBuffer response = new StringBuffer(); while ((inputLine = in.readLine()) != null) { response.append(inputLine); } in.close(); System.out.println(response.toString()); // print result } } catch (IOException | NoSuchAlgorithmException e) { e.printStackTrace(); } } }
    
    
import requests import hashlib Path = "https://staging.api.ep4n.dev/v1/" URL = Path + "RetrieveOrderCardDetail" public_key = "1636574141" order_no = 257273; secret_key = "G3l8Xl9WCypnww4aGRsAF3efRBBpQFiGHWsxRqWAOi0cUE7r2GkaxIEziJfExjIHN4Wq2PUvvADutOFNxuwsXtQUl58irAiBDizD6dWpYy7augE0mWJPKnVCN8pE8jzW" sign = hashlib.sha256(public_key + ":" + order_no + ":" + secret_key).hexdigest() PaymentData = { 'public_key': public_key, 'order_no' : order_no, 'sign' : sign } status_request = requests.post(url = URL, params = json.dumps(PaymentData)) status_response = status_request.json()
    
    
import UIKit import Alamofire import CryptoKit class RetrieveOrderCardDetail: UIViewController { let public_key = "1636574141" var order_no = "257273"; let secret_key = "G3l8Xl9WCypnww4aGRsAF3efRBBpQFiGHWsxRqWAOi0cUE7r2GkaxIEziJfExjIHN4Wq2PUvvADutOFNxuwsXtQUl58irAiBDizD6dWpYy7augE0mWJPKnVCN8pE8jzW" let separator_char = ":" // Create HASh (SHA256) func hash(public_key: String, separator_char: String, order_no: String , secret_key: String) -> String { let digest = SHA256.hash(data: (public_key+separator_char+order_no+separator_char+secret_key).data(using: .utf8) ?? Data()) return digest.map { String(format: "%02x", $0) }.joined() } override func viewDidLoad() { super.viewDidLoad() () } func RetrieveOrderCardDetail() { let sign = hash(public_key: public_key, separator_char: separator_char, order_no: order_no, secret_key: secret_key).uppercased() let parameters = ["public_key": public_key, "order_no": order_no, "sign": sign ] let path = "https://staging.api.ep4n.dev/v1/" let url = path + "RetrieveOrderCardDetail" AF.request(url, method: .post, parameters: parameters, encoding: JSONEncoding.default, headers: nil).responseJSON { response in switch response.result { case .failure(let error): print(error) case .success(let value): print(value) } } } }

Response Example:


{
    "success": true,
    "response": 200,
    "action": "RetrieveOrderCardDetail",
    "result": {
        "order": {
            "order_no": 257273,
            "product_id": 112,
            "item_price": 869.7,
            "items": 1,
            "collection_fee": 0,
            "total_price": 869.7,
            "reference_no": "163875606798961",
            "time": "2021-12-06 04:01:10"
        },
        "cards": [
            {
                "card": "TestCard:1638756070",
                "serial": "TestSerial:1638756070",
                "expiry": null,
                "ref": "112_1638756070984_1"
            }
        ]
    }
}

Response Parameters Description.

Arguments Data Type Description
success Boolean true : method returned successfully
false : error
response Integer Response Code, refer to Response Codes
action String Method Name
result Array Method Array of returned data
order Array Array of Order Details
order_no Integer EasyPayForNet Business Transaction Number
product_id Integer EasyPayForNet Business Product code
item_price Double EasyPayForNet Business Each Product price
items Integer Item Count of Cards
collection_fee Double EasyPayForNet Business Product Collection fees (usually used for invoice collect)
total_price Double Total Price of Items
reference_no String reference_no sent in the request
time String Order Time
cards Array Array Of Cards
card String Card secret
serial String Or Null Card Serial Number
expiry String Or Null Card Expiry date if exist
ref String Or Null EasyPayForNet Business Card reference code, don't share it with customer

10-Retrieve Reference Card Detail.

Retrieving a Order information, status And the Card Details by order refernece number.

Http Url:

    
Path + RetrieveReferenceCardDetail
//Example https://staging.api.ep4n.dev/v1/RetrieveReferenceCardDetail    
    

Signature Hash:


// secret_key = "G3l8Xl9WCypnww4aGRsAF3efRBBpQFiGHWsxRqWAOi0cUE7r2GkaxIEziJfExjIHN4Wq2PUvvADutOFNxuwsXtQUl58irAiBDizD6dWpYy7augE0mWJPKnVCN8pE8jzW"
// public_key = "1636574141"
// example Value Of ($reference_no)
$reference_no = 163875606798961
sign = strtoupper(hash('sha256', $public_key . ":" . $reference_no . ":" . $secret_key));

Request Example:


{
    "public_key": "1636574141",
    "reference_no": "163875606798961",
    "sign": "552402784C44E856C5BBB53C796736A5E94CA7AA0D9E7F22A8D3670292B2F4C4",
}

Request Parameters Description.

Arguments Data Type Description
public_key String Public Key Provided by EasyPayForNet API Integration Team
reference_no String reference_no sent in the request
sign String Signature Hash as explained (Uppercase of sha256 Hash concatenation of public_key + ":" + reference_no + ":" + secret_key)

Code Example:

    
    
$path = "https://staging.api.ep4n.dev/v1/"; $url = $path . "RetrieveReferenceCardDetail"; $public_key = 1636574141; $reference_no = "163875606798961"; $secret_key = "G3l8Xl9WCypnww4aGRsAF3efRBBpQFiGHWsxRqWAOi0cUE7r2GkaxIEziJfExjIHN4Wq2PUvvADutOFNxuwsXtQUl58irAiBDizD6dWpYy7augE0mWJPKnVCN8pE8jzW"; $signMessage = $public_key . ":" .$reference_no . ":" .$secret_key; $signHash = hash('sha256', $signMessage); $sign = strtoupper($signHash); $post_array = ["public_key" => $public_key, 'reference_no' => $reference_no, "sign" => $sign]; $ch = curl_init(); curl_setopt($ch, CURLOPT_URL, $url); curl_setopt($ch, CURLOPT_RETURNTRANSFER, TRUE); curl_setopt($ch, CURLOPT_HEADER, FALSE); curl_setopt($ch, CURLOPT_POST, TRUE); curl_setopt($ch, CURLOPT_POSTFIELDS, json_encode($post_array)); curl_setopt($ch, CURLOPT_HTTPHEADER, array( "Content-Type: application/json" )); $response = curl_exec($ch); curl_close($ch); var_dump($response);
    
    
// Cdn Of Axios Library https://cdn.jsdelivr.net/npm/axios/dist/axios.min.js // Cdn Of Hash Library https://cdnjs.cloudflare.com/ajax/libs/jsSHA/3.2.0/sha.min.js function RetrieveReferenceCardDetail() { let path = "https://staging.api.ep4n.dev/v1/" let url = path + "RetrieveReferenceCardDetail"; let public_key = "1636574141"; let reference_no = "163875606798961"; let secret_key = "G3l8Xl9WCypnww4aGRsAF3efRBBpQFiGHWsxRqWAOi0cUE7r2GkaxIEziJfExjIHN4Wq2PUvvADutOFNxuwsXtQUl58irAiBDizD6dWpYy7augE0mWJPKnVCN8pE8jzW" // Signature Code let signature = public_key + ":" + reference_no + ":" + secret_key; // Hash Signature Code Then Convert It To Uppercase let sha256 = new jsSHA('SHA-256', 'TEXT'); sha256.update(signature); let sign = sha256.getHash("HEX").toUpperCase(); axios.post(url, { // Request Data 'public_key': public_key, 'reference_no' : reference_no, 'sign' : sign }) .then(response => { // Response console.log(response.data) // Response Value console.log(response.data.response) // Response Data console.log(response.data.result) }) .catch(error => { // Catch Error if Found console.log(error.response.data) }) } GetAccountBalance()
    
    
import java.io.BufferedReader; import java.io.IOException; import java.io.InputStreamReader; import java.io.OutputStream; import java.net.HttpURLConnection; import java.net.URL; import java.security.MessageDigest; import java.security.NoSuchAlgorithmException; import java.util.Locale; public class "RetrieveReferenceCardDetail" { public static void main(String[] args) throws IOException { try { String Path = "https://staging.api.ep4n.dev/v1/"; String Url = Path + "RetrieveReferenceCardDetail"; String public_key = "1636574141"; String reference_no = "163875606798961"; String secret_key = "G3l8Xl9WCypnww4aGRsAF3efRBBpQFiGHWsxRqWAOi0cUE7r2GkaxIEziJfExjIHN4Wq2PUvvADutOFNxuwsXtQUl58irAiBDizD6dWpYy7augE0mWJPKnVCN8pE8jzW"; String sign_message = public_key + ":" + reference_no + ":" + secret_key; final MessageDigest digest = MessageDigest.getInstance("SHA-256"); //convert sign_message to SHA 256 final byte[] hash = digest.digest(sign_message.getBytes("UTF-8")); final StringBuilder hexString = new StringBuilder(); for (int i = 0; i < hash.length; i++) { final String hex = Integer.toHexString(0xff & hash[i]); if (hex.length() == 1) hexString.append('0'); hexString.append(hex); } String sign = hexString.toString().toUpperCase(Locale.ROOT); //convert SHA 256 to UpperCase String postData = "{}"; URL obj = new URL(Url); HttpURLConnection con = (HttpURLConnection) obj.openConnection(); con.setRequestProperty("Accept", "application/json"); con.setRequestMethod("POST"); con.setDoOutput(true); OutputStream os = con.getOutputStream(); os.write(postData.getBytes()); os.flush(); os.close(); int responseCode = con.getResponseCode(); // POST Response Code if (responseCode == HttpURLConnection.HTTP_OK) { //success BufferedReader in = new BufferedReader(new InputStreamReader( con.getInputStream())); String inputLine; StringBuffer response = new StringBuffer(); while ((inputLine = in.readLine()) != null) { response.append(inputLine); } in.close(); System.out.println(response.toString()); // print result } } catch (IOException | NoSuchAlgorithmException e) { e.printStackTrace(); } } }
    
    
import requests import hashlib Path = "https://staging.api.ep4n.dev/v1/" URL = Path + "RetrieveReferenceCardDetail" public_key = "1636574141" reference_no = "163875606798961"; secret_key = "G3l8Xl9WCypnww4aGRsAF3efRBBpQFiGHWsxRqWAOi0cUE7r2GkaxIEziJfExjIHN4Wq2PUvvADutOFNxuwsXtQUl58irAiBDizD6dWpYy7augE0mWJPKnVCN8pE8jzW" sign = hashlib.sha256(public_key + ":" + reference_no + ":" + secret_key).hexdigest() PaymentData = { 'public_key': public_key, 'reference_no' : reference_no, 'sign' : sign } status_request = requests.post(url = URL, params = json.dumps(PaymentData)) status_response = status_request.json()
    
    
import UIKit import Alamofire import CryptoKit class RetrieveReferenceCardDetail: UIViewController { let public_key = "1636574141" var reference_no = "163875606798961"; let secret_key = "G3l8Xl9WCypnww4aGRsAF3efRBBpQFiGHWsxRqWAOi0cUE7r2GkaxIEziJfExjIHN4Wq2PUvvADutOFNxuwsXtQUl58irAiBDizD6dWpYy7augE0mWJPKnVCN8pE8jzW" let separator_char = ":" // Create HASh (SHA256) func hash(public_key: String, separator_char: String, reference_no: String , secret_key: String) -> String { let digest = SHA256.hash(data: (public_key+separator_char+reference_no+separator_char+secret_key).data(using: .utf8) ?? Data()) return digest.map { String(format: "%02x", $0) }.joined() } override func viewDidLoad() { super.viewDidLoad() () } func RetrieveReferenceCardDetail() { let sign = hash(public_key: public_key, separator_char: separator_char, reference_no: reference_no, secret_key: secret_key).uppercased() let parameters = ["public_key": public_key, "reference_no": reference_no, "sign": sign ] let path = "https://staging.api.ep4n.dev/v1/" let url = path + "RetrieveReferenceCardDetail" AF.request(url, method: .post, parameters: parameters, encoding: JSONEncoding.default, headers: nil).responseJSON { response in switch response.result { case .failure(let error): print(error) case .success(let value): print(value) } } } }

Response Example:


{
    "success": true,
    "response": 200,
    "action": "RetrieveReferenceCardDetail",
    "result": {
        "order": {
            "order_no": 257273,
            "product_id": 112,
            "item_price": 869.7,
            "items": 1,
            "collection_fee": 0,
            "total_price": 869.7,
            "reference_no": "163875606798961",
            "time": "2021-12-06 04:01:10"
        },
        "cards": [
            {
                "card": "TestCard:1638756070",
                "serial": "TestSerial:1638756070",
                "expiry": null,
                "ref": "112_1638756070984_1"
            }
        ]
    }
}

Response Parameters Description.

Arguments Data Type Description
success Boolean true : method returned successfully
false : error
response Integer Response Code, refer to Response Codes
action String Method Name
result Array Method Array of returned data
order Array Array of Order Details
order_no Integer EasyPayForNet Business Transaction Number
product_id Integer EasyPayForNet Business Product code
item_price Double EasyPayForNet Business Each Product price
items Integer Item Count of Cards
collection_fee Double EasyPayForNet Business Product Collection fees (usually used for invoice collect)
total_price Double Total Price of Items
reference_no String reference_no sent in the request
time String Order Time
cards Array Array Of Cards
card String Card secret
serial String Or Null Card Serial Number
expiry String Or Null Card Expiry date if exist
ref String Or Null EasyPayForNet Business Card reference code, don't share it with customer

Success Code.

Response Status Description
200 Success success

Missing Code.

Response Status Description
1001 Missing Missing Public Key
1002 Missing Missing or Unknown Action
1003 Missing Missing or Unknown Signature
1004 Missing Missing or Unknown Merchant ID
1005 Missing Missing or Unknown Product ID
1006 Missing Missing or Unknown Transaction Reference Number
1007 Missing Missing or Unknown Transaction Order Number
1009 Missing Missing or Unknown Category ID

Invalid Code.

Response Status Description
4003 Invalid Invalid Signature
4004 Invalid Invalid Merchant ID
4005 Invalid Invalid Product ID
4006 Invalid Invalid Transaction Reference Number
4007 Invalid Invalid Transaction Order Number
4009 Invalid Invalid Category ID

Error Code.

Response Status Description
3007 Errors Wrong Transaction Order Number
300714 Errors order refunded
3008 Errors There is no Card for this error
30101 Errors Product not available
30102 Errors your balance is not Sufficient
30106 Errors Duplicated Transaction Reference Number
30107 Errors there is an error with product price
1000001 Errors Fatal Error
400 Errors General Error
401 Errors Unauthorized
403 Errors Forbidden
503 Errors Service Unavailable
500 Errors Internal Server Error