REST APIs

Get Started

Before you can integrate a Nupeye product or solution, you must set up your API environment to get API_USER_NAME and API_KEY credentials for the API's environments. You exchange these credentials for an authentication-token & refresh_token that authorizes your REST API calls. To test your web and mobile apps, you need to contact to support to get your API credentials.

Get credentials

To generate REST API credentials for Rest API's environments:

  1. Contact to support for get API_USER_NAME and API_KEY of your Nupeye account.
  2. After that support authentication you will get your updated API_USER_NAME and API_KEY on your registered email address
  3. Make sure if you got API credentials so you can integrate with your development code.
Note Note: To get credentials for the Nupeye Platforms, see that Get Started page.

Get Demo Credentials

For demo api integration developer can use demo credential in Nupeye API environment.

  • API_USER_NAME: DEMO
  • app_id: DEMO
  • API_KEY: 198d8d95-a4e2-49e9-bbc1-56cb1dbe1c0a
  • x-api-key: 198d8d95-a4e2-49e9-bbc1-56cb1dbe1c0a
Note: For Authentication Token: Pass the token value that you will get after login.

Get an access token

To get an authentication-token & refresh_token, pass your authorize credentials through either:

Make REST API calls

In REST API calls, include the URL to the API service for the environment:

  • Login: https://nupeye.com/recharge_services/v1/auth/login/

Also, include your API_USER_NAME & API_KEY to prove your identity and access protected resources.

  • Authentication Refresh: https://nupeye.com/recharge_services/v1/auth/refresh_authentication

Also, include your refresh_token to prove your identity and access protected resources.

  • Points Purchase: https://nupeye.com/recharge_services/v1/recharge_account

Also, include your refresh_token to prove your identity and access protected resources.

This sample call, which shows the Orders v2 API, includes a bearer token in the Authorization request header. This type of token lets you complete an action on behalf of a resource owner.

REST Login API calls

                        
#!/bin/bash
curl -X POST https://nupeye.com/recharge_services/v1/auth/login -H "Accept: application/json" -H "Content-Type: application/x-www-form-urlencoded" -d "%7B=&%22user_name%22%3A%20API_USER_NAME%2C=&%22authentication_key%22%3A%20%22API_KEY%22=&%7D="

The success response shows the status and other details:

  • {
    • "status": "200",
      "authentication-token": "response-api-token",
      "refresh_token": "response-refresh-token",
    }

The error login credential response shows the status and error message:

  • {
    • "status": "403",
      "message": "Invalid Login",
    }

The error refresh authentication response shows the status and error message:

  • {
    • "status": "403",
      "message": "Token has been expired",
      "refresh_token": "response-refresh-token",
      "authentication-token": "response-api-token",
    }
                        
var https = require('https');
var querystring = require('querystring');
// form data
var postData = querystring.stringify({
"firstanme": "API_KEY",
"authentication_key": "API_KEY",
});
// request option
var options = {
"host": "https://nupeye.com",
"port": "443",
"method": "POST",
"path": "/recharge_services/v1/auth/login",
headers = {
"Content-Type": "application/x-www-form-urlencoded",
"Content-Length": postData.length,
}
};
// request object
var req = https.request(options, function (res) {
var result = '';
res.on('data', function (chunk) {
result += chunk;
});
res.on('end', function () {
console.log(result);
});
res.on('error', function (err) {
console.log(err);
});
});
// req error
req.on('error', function (err) {
console.log(err);
});
// send request witht the postData form
req.write(postData);
req.end();

The error login credential response shows the status and error message:

  • {
    • "status": "403",
      "message": "Invalid Login",
    }

The error refresh authentication response shows the status and error message:

  • {
    • "status": "403",
      "message": "Token has been expired",
      "refresh_token": "response-refresh-token",
      "authentication-token": "response-api-token",
    }
$url = "https://nupeye.com/recharge_services/v1/auth/login";
$curl = curl_init($url);
curl_setopt($curl, CURLOPT_URL, $url);
curl_setopt($curl, CURLOPT_POST, true);
curl_setopt($curl, CURLOPT_RETURNTRANSFER, true);
  • $headers = array(
    • "Accept: application/json",
    • "Content-Type: application/x-www-form-urlencoded",
    );
curl_setopt($curl, CURLOPT_HTTPHEADER, $headers);
$data = "%7B=&%22user_name%22%3A%20API_USER_NAME%2C=&%22authentication_key%22%3A%20%22API_KEY%22=&%7D=";
curl_setopt($curl, CURLOPT_POSTFIELDS, $data);
//for debug only!
curl_setopt($curl, CURLOPT_SSL_VERIFYHOST, false);
curl_setopt($curl, CURLOPT_SSL_VERIFYPEER, false);
$resp = curl_exec($curl);
curl_close ($ch);
var_dump($resp);

The error login credential response shows the status and error message:

  • {
    • "status": "403",
      "message": "Invalid Login",
    }

The error refresh authentication response shows the status and error message:

  • {
    • "status": "403",
      "message": "Token has been expired",
      "refresh_token": "response-refresh-token",
      "authentication-token": "response-api-token",
    }
URL url = new URL("https://nupeye.com/recharge_services/v1/auth/login");
HttpURLConnection http = (HttpURLConnection)url.openConnection();
http.setRequestMethod("POST");
http.setDoOutput(true);
http.setRequestProperty("Accept", "application/json");
http.setRequestProperty("Content-Type", "application/x-www-form-urlencoded");
String data = "%7B=&%22user_name%22%3A%20API_USER_NAME%2C=&%22authentication_key%22%3A%20%22API_KEY%22=&%7D=";
byte[] out = data.getBytes(StandardCharsets.UTF_8);
OutputStream stream = http.getOutputStream();
stream.write(out);
System.out.println(http.getResponseCode() + " " + http.getResponseMessage());
http.disconnect();

The error login credential response shows the status and error message:

  • {
    • "status": "403",
      "message": "Invalid Login",
    }

The error refresh authentication response shows the status and error message:

  • {
    • "status": "403",
      "message": "Token has been expired",
      "refresh_token": "response-refresh-token",
      "authentication-token": "response-api-token",
    }
import requests
from requests.structures import CaseInsensitiveDict
url = "https://nupeye.com/recharge_services/v1/auth/login"
headers = CaseInsensitiveDict()
headers["Accept"] = "application/json"
headers["Content-Type"] = "application/x-www-form-urlencoded"
data = "%7B=&%22user_name%22%3A%20API_USER_NAME%2C=&%22authentication_key%22%3A%20%22API_KEY%22=&%7D="
resp = requests.post(url, headers=headers, data=data)
print(resp.status_code)

The error login credential response shows the status and error message:

  • {
    • "status": "403",
      "message": "Invalid Login",
    }

The error refresh authentication response shows the status and error message:

  • {
    • "status": "403",
      "message": "Token has been expired",
      "refresh_token": "response-refresh-token",
      "authentication-token": "response-api-token",
    }
require "net/http"
require "uri"
uri = URI.parse("https://nupeye.com/recharge_services/v1/auth/login")
# Shortcut
response = Net::HTTP.post_form(uri, {"user_name" => "API_USER_NAME", "authentication_key" => "API_KEY"})
# Full control
http = Net::HTTP.new(uri.host, uri.port)
request = Net::HTTP::Post.new(uri.request_uri)
request.set_form_data({"user_name" => "API_USER_NAME", "authentication_key" => "API_KEY"})
# Tweak headers, removing this will default to application/x-www-form-urlencoded
request["Content-Type"] = "application/json"
response = http.request(request)

The error login credential response shows the status and error message:

  • {
    • "status": "403",
      "message": "Invalid Login",
    }

The error refresh authentication response shows the status and error message:

  • {
    • "status": "403",
      "message": "Token has been expired",
      "refresh_token": "response-refresh-token",
      "authentication-token": "response-api-token",
    }
var url = "https://nupeye.com/recharge_services/v1/auth/login";
var httpRequest = (HttpWebRequest)WebRequest.Create(url);
httpRequest.Method = "POST";
httpRequest.Accept = "application/json";
httpRequest.ContentType = "application/x-www-form-urlencoded";
var data = "%7B=&%22user_name%22%3A%20API_USER_NAME%2C=&%22authentication_key%22%3A%20%22API_KEY%22=&%7D=";
using (var streamWriter = new
StreamWriter(httpRequest.GetRequestStream())){
  • streamWriter.Write(data);
}
var httpResponse = (HttpWebResponse)httpRequest.GetResponse();
using (var streamReader = new
StreamReader(httpResponse.GetResponseStream())){
  • var result = streamReader.ReadToEnd();
}
Console.WriteLine(httpResponse.StatusCode);

The error login credential response shows the status and error message:

  • {
    • "status": "403",
      "message": "Invalid Login",
    }

The error refresh authentication response shows the status and error message:

  • {
    • "status": "403",
      "message": "Token has been expired",
      "refresh_token": "response-refresh-token",
      "authentication-token": "response-api-token",
    }

REST Authentication Refresh API calls

                        
curl -v -X POST https://nupeye.com/recharge_services/v1/auth/refresh_authentication \
-H "API-Authentication:"request-api-token"" \
-H "Content-Type: application/x-www-form-urlencoded" \
-d '{
"refresh_token": "request-refresh-token",
}'

The success response shows the status and other details:

  • {
    • "status": "200",
      "authentication-token": "response-api-token",
      "refresh_token": "response-refresh-token",
    }
                        
var https = require('https');
var querystring = require('querystring');
// form data
var postData = querystring.stringify({
"API-Authentication": "request-api-token",
});
// request option
var options = {
"host": "https://nupeye.com",
"port": "443",
"method": "POST",
"path": "/recharge_services/v1/auth/refresh_authentication",
headers = {
"Content-Type": "application/x-www-form-urlencoded",
"Content-Length": postData.length,
}
};
// request object
var req = https.request(options, function (res) {
var result = '';
res.on('data', function (chunk) {
result += chunk;
});
res.on('end', function () {
console.log(result);
});
res.on('error', function (err) {
console.log(err);
});
});
// req error
req.on('error', function (err) {
console.log(err);
});
// send request witht the postData form
req.write(postData);
req.end();
$ch = curl_init();
curl_setopt($ch, CURLOPT_URL,"https://nupeye.com/recharge_services/v1/auth/refresh_authentication");
curl_setopt($ch, CURLOPT_POST, 1);
curl_setopt($ch, CURLOPT_POSTFIELDS, "API-Authentication=request-api-token");
curl_setopt($ch, CURLOPT_HTTPHEADER, array('Content-Type: application/x-www-form-urlencoded'));
// receive server response ...
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
$server_output = curl_exec ($ch);
$err = curl_error($curl);
curl_close ($ch);
  • if (!$err){
    • var_dump($response);
    }
String urlParameters = "API-Authentication=request-api-token";
byte[] postData = urlParameters.getBytes( StandardCharsets.UTF_8 );
int postDataLength = postData.length;
String request = "https://nupeye.com/recharge_services/v1/auth/refresh_authentication";
URL url = new URL( request );
HttpURLConnection conn= (HttpURLConnection) url.openConnection();
conn.setDoOutput(true);
conn.setInstanceFollowRedirects(false);
conn.setRequestMethod("POST");
conn.setRequestProperty("Content-Type", "application/x-www-form-urlencoded");
conn.setRequestProperty("charset", "utf-8");
conn.setRequestProperty("Content-Length", Integer.toString(postDataLength ));
conn.setUseCaches(false);
  • try(DataOutputStream wr = new DataOutputStream(conn.getOutputStream())) {
    • wr.write( postData );
    }
payload = {'API-Authentication': 'request-api-token'}
r = requests.post("https://nupeye.com/recharge_services/v1/auth/refresh_authentication", data=payload)
print r.content
require "net/http"
require "uri"
uri = URI.parse("https://nupeye.com/recharge_services/v1/auth/refresh_authentication")
# Shortcut
response = Net::HTTP.post_form(uri, {"API-Authentication" => "request-api-token"})
# Full control
http = Net::HTTP.new(uri.host, uri.port)
request = Net::HTTP::Post.new(uri.request_uri)
request.set_form_data({"API-Authentication" => "request-api-token"})
# Tweak headers, removing this will default to application/x-www-form-urlencoded
request["Content-Type"] = "application/json"
response = http.request(request)
// Set the 'Method' property of the 'Webrequest' to 'POST'.
myHttpWebRequest.Method = "POST";
Console.WriteLine ("https://nupeye.com/recharge_services/v1/auth/refresh_authentication");;
// Create a new string object to POST data to the Url.
string inputData = Console.ReadLine ();
string postData = "API-Authentication=example-api-token";
ASCIIEncoding encoding = new ASCIIEncoding ();
byte[] byte1 = encoding.GetBytes (postData);
// Set the content type of the data being posted.
myHttpWebRequest.ContentType = "application/x-www-form-urlencoded";
// Set the content length of the string being posted.
myHttpWebRequest.ContentLength = byte1.Length;
Stream newStream = myHttpWebRequest.GetRequestStream ();
newStream.Write (byte1, 0, byte1.Length);
newStream.Close ();

REST Points Purchase API calls

                        
curl -v -X POST https://nupeye.com/recharge_services/v1/recharge_account \
-H "Authentication:"request-api-token"" \
-H "Content-Type: application/x-www-form-urlencoded" \
-d '{
"mobile_no": "example-mobile_no",
"amount": "example-amount",
"app_id": "API_USER_NAME",
"user_name": "Nupeye User Name",
"user_password": "Nupeye Password",
}'

The success response shows the status and other details:

  • {
    • "status": "200",
    }
                        
var https = require('https');
var querystring = require('querystring');
// form data
var postData = querystring.stringify({
"mobile_no": "example-mobile_no",
"amount": "example-amount",
"app_id": "API_USER_NAME",
"user_name": "Nupeye User Name",
"user_password": "Nupeye Password",
});
// request option
var options = {
"host": "https://nupeye.com",
"port": "443",
"method": "POST",
"path": "/recharge_services/v1/recharge_account",
headers = {
"Content-Type": "application/x-www-form-urlencoded",
"Content-Length": postData.length,
}
};
// request object
var req = https.request(options, function (res) {
var result = '';
res.on('data', function (chunk) {
result += chunk;
});
res.on('end', function () {
console.log(result);
});
res.on('error', function (err) {
console.log(err);
});
});
// req error
req.on('error', function (err) {
console.log(err);
});
// send request witht the postData form
req.write(postData);
req.end();

The success response shows the status and other details:

  • {
    • "status": "200",
    }
$ch = curl_init();
curl_setopt($ch, CURLOPT_URL,"https://nupeye.com/recharge_services/v1/recharge_account");
curl_setopt($ch, CURLOPT_POST, 1);
curl_setopt($ch, CURLOPT_POSTFIELDS, "mobile_no=example-mobile_no&amount=example-amount&app_id=API_USER_NAME&user_name=Nupeye User Name&user_password=Nupeye Password");
curl_setopt($ch, CURLOPT_HTTPHEADER, array('CURLOPT_POSTFIELDS: request-api-token'));
curl_setopt($ch, CURLOPT_HTTPHEADER, array('Content-Type: application/x-www-form-urlencoded'));
// receive server response ...
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
$server_output = curl_exec ($ch);
$err = curl_error($curl);
curl_close ($ch);
  • if (!$err){
    • var_dump($response);
    }

The success response shows the status and other details:

  • {
    • "status": "200",
    }
String urlParameters = "mobile_no=example-mobile_no&amount=example-amount&app_id=API_USER_NAME&user_name=Nupeye User Name&user_password=Nupeye Password";
byte[] postData = urlParameters.getBytes( StandardCharsets.UTF_8 );
int postDataLength = postData.length;
String request = "https://nupeye.com/recharge_services/v1/recharge_account";
URL url = new URL( request );
HttpURLConnection conn= (HttpURLConnection) url.openConnection();
conn.setDoOutput(true);
conn.setInstanceFollowRedirects(false);
conn.setRequestMethod("POST");
conn.setRequestProperty("Content-Type", "application/x-www-form-urlencoded");
conn.setRequestProperty("Authentication", "example-api-token");
conn.setRequestProperty("charset", "utf-8");
conn.setRequestProperty("Content-Length", Integer.toString(postDataLength ));
conn.setUseCaches(false);
  • try(DataOutputStream wr = new DataOutputStream(conn.getOutputStream())) {
    • wr.write( postData );
    }

The success response shows the status and other details:

  • {
    • "status": "200",
    }
payload = {'mobile_no': 'example-mobile_no','amount': 'example-amount','app_id': 'API_USER_NAME','user_name': 'Nupeye User Name','user_password': 'Nupeye Password'}
r = requests.post("https://nupeye.com/recharge_services/v1/recharge_account", data=payload)
print r.content

The success response shows the status and other details:

  • {
    • "status": "200",
    }
require "net/http"
require "uri"
uri = URI.parse("https://nupeye.com/recharge_services/v1/recharge_account")
# Shortcut
response = Net::HTTP.post_form(uri, {"mobile_no" => "example-mobile_no", "amount" => "example-amount", "app_id" => "API_USER_NAME", "user_name" => "Nupeye User Name", "user_password" => "Nupeye Password"})
# Full control
http = Net::HTTP.new(uri.host, uri.port)
request = Net::HTTP::Post.new(uri.request_uri)
request.set_form_data({"Authentication" => "request-api-token"})
# Tweak headers, removing this will default to application/x-www-form-urlencoded
request["Content-Type"] = "application/json"
response = http.request(request)

The success response shows the status and other details:

  • {
    • "status": "200",
    }
// Set the 'Method' property of the 'Webrequest' to 'POST'.
myHttpWebRequest.Method = "POST";
Console.WriteLine ("https://nupeye.com/recharge_services/v1/recharge_account");;
// Create a new string object to POST data to the Url.
string inputData = Console.ReadLine ();
string postData = "mobile_no=example-mobile_no&amount=example-amount&app_id=API_USER_NAME&user_name=Nupeye User Name&user_password=Nupeye Password";
ASCIIEncoding encoding = new ASCIIEncoding ();
byte[] byte1 = encoding.GetBytes (postData);
// Set the content type of the data being posted.
myHttpWebRequest.ContentType = "application/x-www-form-urlencoded";
// Set the content length of the string being posted.
myHttpWebRequest.ContentLength = byte1.Length;
Stream newStream = myHttpWebRequest.GetRequestStream ();
newStream.Write (byte1, 0, byte1.Length);
newStream.Close ();

The success response shows the status and other details:

  • {
    • "status": "200",
    }

REST Transfer to Nupeye wallet API calls

                        
curl -X POST https://nupeye.com/recharge_services/v1/transfer_amount
-H "Accept: application/json" \
-H "Authentication: example-api-token" \
-H "Content-Type: application/json" \
--data-binary @- << DATA '{
"mobile_no": "example-mobile_no",
"amount": "example-amount",
"app_id": "API_USER_NAME"
}'

The success response shows the status and other details:

  • {
    • "status": "200",
    }
                        
var https = require('https');
var querystring = require('querystring');
// form data
var postData = querystring.stringify({
"mobile_no": "example-mobile_no",
"amount": "example-amount",
"app_id": "API_USER_NAME",
});
// request option
var options = {
"host": "https://nupeye.com",
"port": "443",
"method": "POST",
"path": "/recharge_services/v1/transfer_amount",
headers = {
"Content-Type": "application/x-www-form-urlencoded",
"Content-Length": postData.length,
"Authentication": example-api-token,
}
};
// request object
var req = https.request(options, function (res) {
var result = '';
res.on('data', function (chunk) {
result += chunk;
});
res.on('end', function () {
console.log(result);
});
res.on('error', function (err) {
console.log(err);
});
});
// req error
req.on('error', function (err) {
console.log(err);
});
// send request witht the postData form
req.write(postData);
req.end();

The success response shows the status and other details:

  • {
    • "status": "200",
    }
< ?php
$url = "https://nupeye.com/recharge_services/v1/transfer_amount";
$curl = curl_init($url);
curl_setopt($curl, CURLOPT_URL, $url);
curl_setopt($curl, CURLOPT_POST, true);
curl_setopt($curl, CURLOPT_RETURNTRANSFER, true);
$headers = array(
  • "Accept: application/json",
    "Authentication: example-api-token",
    "Content-Type: application/json",
);
curl_setopt($curl, CURLOPT_HTTPHEADER, $headers);
$data = <<< DATA
{
  • "mobile_no": "example-mobile_no",
    "amount": "example-amount",
    "app_id": "API_USER_NAME"
}
curl_setopt($curl, CURLOPT_POSTFIELDS, $data);
//for debug only!
curl_setopt($curl, CURLOPT_SSL_VERIFYHOST, false);
curl_setopt($curl, CURLOPT_SSL_VERIFYPEER, false);
$resp = curl_exec($curl);
curl_close($curl);
?>

The success response shows the status and other details:

  • {
    • "status": "200",
    }
URL url = new URL("https://nupeye.com/recharge_services/v1/transfer_amount");
HttpURLConnection http = (HttpURLConnection)url.openConnection();
http.setRequestMethod("POST");
http.setDoOutput(true);
http.setRequestProperty("Accept", "application/json");
http.setRequestProperty("Authentication", "example-api-token");
http.setRequestProperty("Content-Type", "application/json");
String data = "{\n \"mobile_no\": \"example-mobile_no\",\n \"amount\": \"example-amount\",\n \"app_id\": \"API_USER_NAME\" \n}";
byte[] out = data.getBytes(StandardCharsets.UTF_8);
OutputStream stream = http.getOutputStream();
stream.write(out);
System.out.println(http.getResponseCode() + " " + http.getResponseMessage());
http.disconnect();

The success response shows the status and other details:

  • {
    • "status": "200",
    }
import requests
from requests.structures import CaseInsensitiveDict
url = "https://nupeye.com/recharge_services/v1/transfer_amount"
headers = CaseInsensitiveDict()
headers["Accept"] = "application/json"
headers["Authentication"] = "example-api-token"
headers["Content-Type"] = "application/json"
data = """
  • {
    • "mobile_no": "example-mobile_no",
      "amount": "example-amount",
      "app_id": "API_USER_NAME"
    }
"""
resp = requests.post(url, headers=headers, data=data)
print(resp.status_code)

The success response shows the status and other details:

  • {
    • "status": "200",
    }
require "net/http"
require "uri"
uri = URI.parse("https://nupeye.com/recharge_services/v1/transfer_amount")
# Shortcut
response = Net::HTTP.post_form(uri, {"mobile_no" => "example-mobile_no", "amount" => "example-amount", "app_id" => "API_USER_NAME"})
# Full control
http = Net::HTTP.new(uri.host, uri.port)
request = Net::HTTP::Post.new(uri.request_uri)
request.set_form_data({"Authentication" => "example-api-token"})
# Tweak headers, removing this will default to application/x-www-form-urlencoded
request["Content-Type"] = "application/json"
response = http.request(request)

The success response shows the status and other details:

  • {
    • "status": "200",
    }
var url = "https://nupeye.com/recharge_services/v1/transfer_amount";
var httpRequest = (HttpWebRequest)WebRequest.Create(url);
httpRequest.Method = "POST";
httpRequest.Accept = "application/json";
httpRequest.Headers["Authentication"] = "example-api-token";
httpRequest.ContentType = "application/json";
  • var data = @"{
    • ""mobile_no"": ""example-mobile_no"",
    • ""amount"": ""example-amount"",
    • ""app_id"": ""API_USER_NAME""
    }";
  • using (var streamWriter = new StreamWriter(httpRequest.GetRequestStream())){
    • streamWriter.Write(data);
    }
var httpResponse = (HttpWebResponse)httpRequest.GetResponse();
  • using (var streamReader = new StreamReader(httpResponse.GetResponseStream())){
    • var result = streamReader.ReadToEnd();
    }
Console.WriteLine(httpResponse.StatusCode);

The success response shows the status and other details:

  • {
    • "status": "200",
    }