Professional Documents
Culture Documents
Gateway
Integration Kit
.Net
(PG INTEGRATION)
1 Introduction 3
1.1 Overview 3
4 Sample Codes 9
4.1 Sample Code for Sending SabPaisa Request 9
4.2 Sample Code for Parsing SabPaisa Response 10
(TRANSACTION ENQUIRY)
-2-
1. INTRODUCTION
OVERVIEW
Thank you for choosing SabPaisa! This document aims to help you quickly integrate
SabPaisa into your existing application. The document contains a sample code to
help you understand the flow of data from and to your application from SabPaisa.
The document also contains a table specifying the information which your
application should send to SabPaisa to correctly process any request. Sabpaisa will
send a variety of response codes that your application may parse to be able to
effectively communicate with the SabPaisa system. These error codes have been
mentioned here along with their description.
Process Flow:
The Payer on merchant site, enters mandatory details in the available form
The Payer then proceeds for making payment with the amount to be paid
Here the merchant application sends Request code having payer details,
amount, credentials & unique txn ID etc to Sabpaisa
The payer reaches to Sabpaisa PG where he finds “Online” – Credit
Card/Debit Card/Netbanking and “Offline” – eChallan, NEFT/RTGS payment
modes.
The payer selects appropriate Payment mode and proceeds on the respective
bank site and then requested to authorize payment accordingly.
The payer account is deducted with the transaction amount and the payer is
redirected back to merchant site (with Sabpaisa Response code)
The merchant application updates its system with this Sabpaisa response
code accordingly.
-3-
2. SENDING REQUEST TO SABPAISA
Sabpaisa will authenticate the client’s identity base communication between the client
application and Sabpaisa will take place via HyperText Transfer Protocol (http). The
communication will be initiated by the client by generating a POST method request to
SabPaisa URL. Please refer the below table for the various parameters that SabPaisa
recognizes. The URL which should be used to send a request to SabPaisa will be shared
by us with you. The URLs and credentials will be separate for the test environment and
live environment. You should first certify the integration on the test environment.
-4-
generated by your for each
application. request.
Maximum
length: 15
6. Amt You Mandatory Transaction Must be
Amount numeric
generated by your either whole
application. number or
upto
two decimal
places
precision,
currency INR
Maximum
length: 10
7. authKey SabPaisa Mandatory The NA
Authentication
Key
Provided by
SabPaisa
8. authIV SabPaisa Mandatory The NA
Authentication ID
provided by
Sabpaisa
9. ru You Mandatory The client URL to NA
be
called upon
completion
of transaction
successfully
10. failureURL You Mandatory The client URL to NA
be
called upon failure
of
transaction
11. firstName You Mandatory First Name of Maximum
Payer length: 15
12. lstName You Optional Last Name of Maximum
Payer length: 15
-5-
13. Email You Mandatory Email address of Payer
Payer
14. Add You Optional Physical address Maximum
of length: 40
Payer characters
15. contactNo You Mandatory Contact number of 10-digit
Payer numeric
16. programId SabPaisa You User defined, for 25-digit
separating Alphanumeric
different
processes in the
same client code.
-6-
3. RECEIVING RESPONSE FROM SABPAISA
Upon completion of transaction, your application will receive a response from Sabpaisa
on one of the configured URLs depending upon the result of the transaction. Sabpaisa
will respond with the following parameters:
10 firstName Payer’sFitName
-7-
14 transDate Transaction Date
-8-
Sample Code for Sending SabPaisa Request
-9-
Sample Code for Parsing SabPaisa Response:
String query=Request["query"];
query = query.Replace("%2B", "+");
//query = query.Replace(" ", "+");
String authKey=<< retrieve from your configurations>>;
String authIV=<< retrieve from your configurations>>;
String decText = null;
decText = SabPaisa1.decrypt1(query, authIV, authKey);
Uri myUri = newUri("http://sabpaisa.in?" + decText);
- 10
-
Sample Response Code:
After Integration is completed, following response code will be received after the
transaction is done successfully.
For Ex: We are testing for Client Code- “CXY10”
Pending:
pgRespCode=0001&PGTxnNo=&SabPaisaTxId=7736331081703364581117546&issuerRefNo=
null&authIdCode=0&amount=135.0&clientTxnId=TESTING310817033628451&firstName=TES
T&lastName=TEST&payMode=Cash&email=test@gmail.com&mobileNo=9895652728&spResp
Code=0001&cid=null&bid=null&clientCode=CXY10&payeeProfile=Student&transDate=Thu Aug
31 15:36:58 IST
2017&spRespStatus=pending¶m3=BE&challanNo=O000131082017PD17000001&reMsg=null
&orgTxnAmount=120.0&programId=btech
Failure:
pgRespCode=0300&PGTxnNo=37811436&SabPaisaTxId=7399702091711511122664015&issu
erRefNo=NA&authIdCode=0&amount=57.0&clientTxnId=TESTING020917115040588&firstNa
me=TPK&lastName=Test&payMode=CreditCards&email=xyz@gmail.com&mobileNo=9908944
111&spRespCode=0300&cid=null&bid=null&clientCode=CXY10&payeeProfile=Student&transD
ate=Sat Sep 02 11:50:50 IST
2017&spRespStatus=failure¶m3=BE&challanNo=&reMsg=null&orgTxnAmount=55.0&program
Id=NA
Cancel:
pgRespCode=0100&PGTxnNo=37811436&SabPaisaTxId=7399702091711511122664015&issu
erRefNo=NA&authIdCode=0&amount=200.0&clientTxnId=TESTING020917115040588&firstN
ame=TPK&lastName=Test&payMode=CreditCards&email=xyz@gmail.com&mobileNo=990894
4111&spRespCode=0300&cid=null&bid=null&clientCode=CXY10&payeeProfile=Student&trans
Date=Sat Sep 02 11:53:50 IST
2017&spRespStatus=cancel¶m3=BE&challanNo=&reMsg=null&orgTxnAmount=190.0&progra
mId=NA
Success:
pgRespCode=0000&PGTxnNo=37811436&SabPaisaTxId=7399702091711511122664015&issu
erRefNo=NA&authIdCode=0&amount=510.0&clientTxnId=TESTING020917115040588&firstN
ame=TPK&lastName=Test&payMode=CreditCards&email=test@gmail.com&mobileNo=990894
4111&spRespCode=0000&cid=null&bid=null&clientCode=CXY10&payeeProfile=Student&trans
Date=Sat Sep 02 11:55:00 IST
2017&spRespStatus=success¶m3=BE&challanNo=&reMsg=null&orgTxnAmount=500.0&progra
mId=mtech
- 11
-
SabPaisa Payment Page
- 12
-
Artifacts
EncryptionDecryption.cs
- 13
-
Transaction Status Enquiry
API
- 14 -
Overview
This API is provided to the SabPaisa clients to find out the details on any
transaction made on SabPaisa.
Clients can write schedulers to run repeat inquiries, but are advised against
executing multiple concurrent requests on SabPaisa using this API.
It is not advisable to use this for reporting purposes. Please reach out to us for
such a need separately.
- 15 -
Request Format:
The Request should be a plain get request with a couple of query parameters
as mentioned below. <Server URL>/ TransactionEnquiryServlet?clientXtnId=
" + pTxId + "&clientCode=" + clientCode
Live Server:
https://securepay.sabpaisa.in/SPTxtnEnquiry/TransactionEnquiryServlet?
For Ex:
https://securepay.sabpaisa.in/SPTxtnEnquiry/TransactionEnquirySer
vlet? clientXtnId=XXXXX&clientCode=CXY10
Kindly use your clientXtnId and clientCode in place of “CXY10”,
. please use above URL for taking reference
Parameters Description
URL Url to which the request is to be sent.
Client Txn Id Unique transaction ID sent by the
client when the transaction was
initiated.
Client Code The code set by sabpaisa for that
particular client to which this
clientTxnId belongs.For ex: AD-40
16
Response Format:
The SabPaisa Response will carry an xml element with multiple attributes and
their values to be read by the client.
1. Debit Card
<transactionclientTxnId="304109127891234"txnId="0000005001608484417767
145"payeeAmount="300"sabPaisaRespCode="0000"status="success”
transCompleteDate="2016-10-0413:56:16.0"paymentMode="Debit Cards"/>
2. Credit Card
<transactionclientTxnId="304100983452671"txnId="0000005001608484417767
145"payeeAmount="300"sabPaisaRespCode="0000"status="success”
transCompleteDate="2016-10-0413:56:16.0"paymentMode="Credit Cards"/>
3. Net Banking
<transactionclientTxnId="304108973245610"txnId="0000005001608484417767
145"payeeAmount="300"sabPaisaRespCode="0000"status="success”
transCompleteDate="2016-10-0413:56:16.0"paymentMode="Net Banking"/>
4. Cash e Challan
<transactionclientTxnId="304100912387632"txnId="0000005001608484417767
145"payeeAmount="300"sabPaisaRespCode="0000"status="success”
transCompleteDate="2016-10-0413:56:16.0"paymentMode="Cash"/>
17
Attributes in the Xml Element “transaction” (order of occurrence is not
strict)
18
Lookup for SabPaisaRespCode
19
Sample Code for .NET
String urlf =
"http://49.50.72.199:9099/SPXtnEnquiry/TransactionEnquiryS
ervlet? clientXtnId=37410&clientCode=AD-40";
HttpWebRequest request =
(HttpWebRequest)WebRequest.Create(urlf);
XDocument doc;
using (WebResponse response = request.GetResponse())
{
using (Stream stream = response.GetResponseStream())
{
doc = XDocument.Load(stream);
}
}
20
Sample Code for Visual Studio 2008 & 2005:
string requestUrl =
"http://49.50.72.199:9043/SPXtnEnquiry/TransactionEnquiryServle
t? clientXtnId=37410&clientCode=AD-40";
HttpWebRequest request =
(HttpWebRequest)WebRequest.Create(requestUrl);
XmlDocument xdoc = new XmlDocument();
}
XmlNodeList clientTxnId = xdoc.GetElementsByTagName("clientTxnId");
XmlElement rootelement = xdoc.DocumentElement;
XmlNodeList xmlnodelstTrack =
rootelement.GetElementsByTagName("clientTxnId");
string clitntxid = rootelement.Attributes["clientTxnId"].Value;
21
Thanks!!!!
Happy Integration
22