API Document
API Document
API Methods
1. GetBalance
2. MobileRecharge
3. DTHRecharge
4. PostPaidBillPay
5. GetTransactionStatus
6. ChangeSMSPin
7. ComplaintRegister
API URL
http://DomainName/mRechargeAPI/Service.asmx
Soap Authentication
Before calling any method you have to set parameters of Soap Header and pass it.
Soap header contains User ID & Password fields. User ID & Password will be provided separately.
Soap Authentication is required for establishing connectivity.
Without Soap Authentication you cannot communicate with our system.
Note:
1. Orange marked domain name will be replaced with actual domain name.
2. Blue marked method name will be replaced with actual method name.
3. Red marked field/text will be replaced with actual data
<soap:Envelope xmlns:soap="http://schemas.xmlsoap.org/soap/envelope/"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xmlns:xsd="http://www.w3.org/2001/XMLSchema">
<soap:Header><APIAuthHeader
xmlns="http://tempuri.org/"><UserID>SOAPUSERID</UserID><Password>SOAPPAS
SWORD</Password></APIAuthHeader></soap:Header>
<soap:Body><METHODNAME
xmlns="http://tempuri.org/"><sRequest>XMLREQUEST</sRequest></METHODNAME>
</soap:Body>
</soap:Envelope>
PHP Sample Code:
<?php
echo "<pre>";
$soapUrl = "http://domainname/mRechargeAPI/Service.asmx?op=MobileRecharge";
$soapUser = '9999999999'; //API User ID
$soapPassword = 'password'; //API Password
$mobileno = '9999999999'; //Registered Mobile No
$smspin = '1234'; //SMS PIN
$customerno = '9898989898';
$amount = '10';
$operatorcode = 'A';
$stv = '0';
$recharge_id = '10001'; //Your unique transaction no (Numeric)
$data = '<MRREQ><REQTYPE>MRCH</REQTYPE><UID>'$mobileno.'</UID><PWD>'.
$smspin.'</PWD><OPCODE>'.$operatorcode.'</OPCODE><CMOBNO>'.
$customerno.'</CMOBNO><AMT>'.$amount.'</AMT><STV>'.$stv.'</STV><TRNREFNO>'.
$recharge_id.'</TRNREFNO></MRREQ>';
$raw_data = htmlentities($data);
$xml_post_string = '<?xml version="1.0" encoding="utf-8"?>
<soap:Envelope xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xmlns:xsd="http://www.w3.org/2001/XMLSchema"
xmlns:soap="http://schemas.xmlsoap.org/soap/envelope/">
<soap:Header>
<APIAuthHeader xmlns="http://tempuri.org/">
<UserID>'.$soapUser.'</UserID>
<Password>'.$soapPassword.'</Password>
</APIAuthHeader>
</soap:Header>
<soap:Body>
<MobileRecharge xmlns="http://tempuri.org/">
<sRequest>
'.$raw_data.'
</sRequest>
</MobileRecharge>
</soap:Body>
</soap:Envelope>';
$headers = array(
"Content-type: text/xml;charset=\"utf-8\"",
"Accept: text/xml",
"Cache-Control: no-cache",
"Pragma: no-cache",
"SOAPAction: http://tempuri.org/MobileRecharge",
"Content-length: ".strlen($xml_post_string),
"UserID: ".$soapUser,
"Password: ".$soapPassword,
"Host: domainname",
"POST: /mRechargeAPI/Service.asmx HTTP/1.1",
);
$url = $soapUrl;
$ch = curl_init();
curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, 0);
curl_setopt($ch, CURLOPT_URL, $url);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
curl_setopt($ch, CURLOPT_USERPWD, $soapUser.":".$soapPassword);
curl_setopt($ch, CURLOPT_HTTPAUTH, CURLAUTH_ANY);
curl_setopt($ch, CURLOPT_TIMEOUT, 10);
curl_setopt($ch, CURLOPT_POST, true);
curl_setopt($ch, CURLOPT_POSTFIELDS, $xml_post_string); //SOAP request
curl_setopt($ch, CURLOPT_HTTPHEADER, $headers);
// converting
$response = curl_exec($ch);
//echohtmlentities($response);
curl_close($ch);
?>
Web Service Request / Response
1. GetBalance
Request:
Request Ex. :
<MRREQ><REQTYPE>BAL</REQTYPE><UID>9999999999</UID><PWD>1234</PWD></MRREQ>
Response:
Response Ex. :
<MRRESP><RESPTYPE>BAL</ RESPTYPE ><STCODE>0</STCODE><STMSG>1000.00</STMSG></MRRESP>
2. MobileRecharge
Request:
Request Ex. :
<MRREQ><REQTYPE>MRCH</REQTYPE><UID>9999999999</UID><PWD>1234</PWD><OPCODE>A</OPCODE><C
MOBNO>9825098250</CMOBNO><AMT>11</AMT><STV>0</STV><TRNREFNO>123</TRNREFNO></MRREQ>
Response:
Response Ex. :
<MRRESP><RESPTYPE>MRCH</RESPTYPE><STCODE>0</STCODE><STMSG>Success</STMSG><TRNID>123</TRNID
><CUSTNO>9825098250</CUSTNO><AMT>11.00</AMT><TRNSTATUS>1</TRNSTATUS><STATUSTEXT>Success</ST
ATUSTEXT><TRNREFNO>123</TRNREFNO><OPRID>12345</OPRID><BAL>1000.00</BAL></MRRESP>
3. DTHRecharge
Request:
Request Ex. :
<MRREQ><REQTYPE>DRCH</REQTYPE><UID>9999999999</UID><PWD>1234</PWD><OPCODE>AD</OPCODE><
CID>123456789</CID><AMT>200</AMT><STV>0</STV><TRNREFNO>123</TRNREFNO></MRREQ>
Response:
Response Ex. :
<MRRESP><RESPTYPE>DRCH</RESPTYPE><STCODE>0</STCODE><STMSG>Success</STMSG><TRNID>123</TRNID
><CUSTNO>9825098250</CUSTNO><AMT>11.00</AMT><TRNSTATUS>1</TRNSTATUS><STATUSTEXT>Success</ST
ATUSTEXT><TRNREFNO>123</TRNREFNO><OPRID>12345</OPRID><BAL>1000.00</BAL></MRRESP>
4. PostPaidBillPay
Request:
Request Ex. :
<MRREQ><REQTYPE>PPB</REQTYPE><UID>9999999999</UID><PWD>1234</PWD><OPCODE>AB</OPCODE><C
MOBNO>9825098250</CMOBNO><AMT>100</AMT><TRNREFNO>123</TRNREFNO></MRREQ>
Response:
Response Ex. :
<MRRESP><RESPTYPE>PPB</RESPTYPE><STCODE>0</STCODE><STMSG>Success</STMSG><TRNID>123</TRNID>
<CUSTNO>9825098250</CUSTNO><AMT>11.00</AMT><TRNSTATUS>1</TRNSTATUS><STATUSTEXT>Success</STA
TUSTEXT><TRNREFNO>123</TRNREFNO><OPRID>12345</OPRID><BAL>1000.00</BAL></MRRESP>
5. GetTransactionStatus
Request:
Request Ex. :
<MRREQ><REQTYPE>TRNST</REQTYPE><UID>9999999999</UID><PWD>1234</PWD><TRNNO>1</TRNNO><CN
O></CNO></MRREQ>
Response:
Response Ex. :
<MRRESP><RESPTYPE>TRNST</RESPTYPE><STCODE>0</STCODE><STMSG>Success</STMSG><TRNID>123</TRNI
D><CUSTNO>9825098250</CUSTNO><AMT>11.00</AMT><TRNSTATUS>1</TRNSTATUS><STATUSTEXT>Success</
STATUSTEXT><TRNREFNO>123</TRNREFNO><OPRID>12345</OPRID><OPRTID>OP12345</OPRTID></MRRESP>
Note: You can send either TRNNO (Your Transaction No) or CNO (Mobile No/ Customer ID)
6. ChangeSMSPin
Request:
Request Ex. :
<MRREQ><REQTYPE>CHPIN</REQTYPE><UID>9999999999</UID><PWD>1234</PWD></MRREQ>
Response:
Response Ex. :
<MRRESP><RESPTYPE> CHPIN </ RESPTYPE ><STCODE>0</STCODE><STMSG> Your Pin is successfully changed.
Your new Pin is: 9876</STMSG></MRRESP>
7. ComplaintRegister
Request:
Request Ex. :
<MRREQ><REQTYPE>CMP</REQTYPE><UID>9999999999</UID><PWD>1234</PWD><CTYPE>1</CTYPE><CDTL>C
omplaint</CDTL></MRREQ>
Response:
Response Ex. :
<MRRESP><RESPTYPE>CMP</ RESPTYPE ><STCODE>0</STCODE><STMSG>Your Complaint Registered Successfully,
Ref No: 123</STMSG></MRRESP>
Transaction Status Call Back: (Kindly map your Call Back URL)
Parameters (We will provide you below parameters):
ID = APICODE
TNO = Your Transaction Reference Number supplied in Transaction Request
ST = Status
STMSG = Status Description
TID = API Transaction Number
OPRTID = Operator Transaction ID
PRB = Pre Balance
POB = Post Balance
DP = Discount in Percentage (%)
DR = Discount in Rupees (Rs)
Sample Response:
http://www.yourdomain.com/Response.aspx?
ID=ABC&TNO=11111&ST=1&STMSG=Success&TID=1001&OPRTID=123456789&PRB=0&POB=0&DP=0&DR=0
Status = 1 ->Success
Status = 5 ->Refunded