1. Home
  2. Balance Enquiry/Pin Change
  3. Request/Response Samples

Request/Response Samples

Sample Header for Balance Enquiry

Content Type:application/json

Authorization:InterswitchAuth SUifhfjdbxbkfhj132hdfhjshfjhsv

Signature:kuTwggg/3gdgdghs= Timestamp: 1434455667788

Nonce:7333394444423754333

SignatureMethod:SHA1

AUTH_DATA:PojezOMUCQJogdxvkNEkIqmLqTIgalYX9N60jerdsdfgfghfft6zyef1+vuPzc0Tqpe RQ9LmVGTQ9hhlY8I5GvhN2qAuzpAMbDYMr1FM8QvVcihQjBhhNQx+cAJ638Iz+rCr6jsbILIDui2Q

YAwTZBOfCmmqyQitPUwvRvUXlbWLmAZvxn/xPmrlLKnuStlsIWB22yPWLMe3vX+AMvriNX9G9cgu5 2zI6vUPB2GIpaA1WTa6k0aSzPicNBBBvq08nWybA9NeBSTsLurY1OGgpR5OU4RyVCIN4vD07NAvdX

WdGsvHobIM45p0ebvKKg1COYnWXA==

PRODUCT_CODE: AUTOPAY00000002

TERMINAL_ID:41TegWo2

 

Sample Response for successful Balance Enquiry

{

“balance”:”100,000,000.00″

}

Sample Response for failed Balance Enquiry

{

“errors”=>[

{

“code”=>”E38”,

“message”=>”Request payload is invalid”}

],

 

“error”=>

{

“code”=>”E38”,

“message”=>”Request payload is invalid”

}

}

Sample Header for Pin Change

Content Type:application/json

Authorization:InterswitchAuth SUifhfjdbxbkfhj132hdfhjshfjhsv

Signature:kuTwggg/3gdgdghs=

Timestamp: 1434455667788 Nonce:7333394444423754333

SignatureMethod:SHA1 

PRODUCT_CODE: AUTOPAY00000002

Sample Request for Pin Change

{

“oldAuthData”:”P+sCbEq1T4HvJgmabHd5O+yJKRW7aRewjucOa3TJsVCaAxuSzeFnkLGg4u8ambv7kanN9WO zmUFxYIGjN8LBuwu6hKpz9I2ivoZD9DKpM5npJeoV2uUwGU1cB8N604guQuaU1eeHFqIX2HLxyvYrKnLZCUeY6 aJg0XHffbEZXpegEjkfmcKpioHPXxa4msUTmEPl+tJsmdx5aUUph8k+yD+ddUJLPPo/mknOW1OlCImhFJhRqEc 3kRM7jDuAfsOi/k7p4dmzY25anigPqM9iWnxCx66I4y1xetxvnx5CX2aU21yjJdFmW+rXDumOL6QIzZhPnIP1b WAQnWmNLuDIig==”,

“newAuthData”:”fPw/wwq1ZOBsE4rsTmpA5ltlFbAkozO7KpABD3z/7rVsMyoRFSMEzsGOzYh/fDtJz8avy+z tknDP7YaQ6jCNAWh5QvJ/9UaOakSrA+hj9PRpGsE7edWh9iSEa8FwOigRb+qdCFuM6Q3HvuGsfqCw56l0J/iU9 wjUg8oB6RByHy54xqeQY8xNmnkelhSObyLrKgE245XuFrTvwImzGlkQvpL0liMLPNfzgEM/TewAIkv6MeQXIMC 3xxJXyBKDKm1Nr5D/VV3blcRrYooAFQIgiJAffIUXqZ/aewS3+Yws0NxGJtQPLZnbtviLzXHXGg81aJ7ugLmkf k8hcSrNTBbHZw==”, “terminalId”:”4QTL0001″,

“productCode”: “0123345”

}

Sample Response for successful Pin Change

204 HTTP response, no body returned.

 

Sample Response for failed Pin Change

{

 

“errors”=>[

{“code”=>”55”,

“message”=>”Failed”,

“statusCode”=>”55”,

“statusMessage”=>”Failed”}],

 

“error”=>

{“code”=>”55”,

“message”=>”Failed”,

“statusCode”=>”55”,

“statusMessage”=>”Failed”

}

} 

Sample Codes

// Timestamp

TimeZone lagosTimeZone = TimeZone.getTimeZone(“Africa/Lagos”);  Calendar calendar = Calendar.getInstance(lagosTimeZone);  long timestamp = calendar.getTimeInMillis() / 1000;

 

// Nonce

UUID uuid = UUID.randomUUID();

String nonce = uuid.toString().replaceAll(“-“, “”);

 

// Signature Method

String signatureMethod = “SHA1”;

 

// Signature

String httpMethod = “POST”; // HTTP Method of the resource that is being called

String encodedResourceUrl = “RESOURCE_URL”; // put the resource URL here

String clientId = “CLIENT_ID”; // put your client Id here

String clientSecretKey = “CLIENT_SECRET_KEY”; // put your client secret here

String signatureCipher = httpMethod + “&” + encodedResourceUrl + “&” + timestamp + “&” + nonce + “&” + clientId + “&” + clientSecretKey;

MessageDigest messageDigest = MessageDigest.getInstance(signatureMethod);  byte[] signatureBytes = messageDigest.digest(signatureCipher.getBytes());  String signature = new String(Base64.encodeBase64(signatureBytes));

 

// Setting HTTP Header values

String resourceUrl = “https://sandbox.interswitchng.com/passport/oauth/token”;

HttpPost post = new HttpPost(resourceUrl);  post.setHeader(“TIMESTAMP”, timestamp);  post.setHeader(“NONCE”, nonce);

post.setHeader(“SIGNATURE_METHOD”, signatureMethod);  post.setHeader(“SIGNATURE”, signature)

Was this article helpful to you? Yes 2 No

How can we help?