Project

General

Profile

Programming Guide » History » Revision 8

Revision 7 (chin-yeh, 03/07/2012 10:08 AM) → Revision 8/15 (chin-yeh, 03/07/2012 10:59 AM)

{{toc}} 

 h1. Programming Guide 

 This guide describes how to integrate online mall with the QIWI. 

 *Demo Application:* _(refer to the [[wiki#Merchant-Account|Merchant Account]] to get the merchant details)_ 
 > http://192.168.2.68/qiwi-provider/sample_payment_form.html 

 h2. Steps-By-Steps 

 # First, go through the [[wiki#Overview|Payment Flow]] 
 # To redirect the customer to QIWI, prepare the following <code>HTML form</code>: 
 ** *action* - must be http://w.qiwi.ru/setInetBill_utf.do 
 ** *from* - merchant ID _(refer to the [[wiki#Merchant-Account|Merchant Account]] to get the merchant details)_ 
 ** *txn_id* - unique transaction ID, _e.g. order ID_ 
 ** *to* - customer's MSISDN, _e.g. mobile phone number_ 
 ** *summ* - payment amount, _e.g. 10.22_ 
 ** *com* - description of this payment 
 ** _example_: 
 <pre> 
 <code class="HTML"> 
 <form method="post" action="http://w.qiwi.ru/setInetBill_utf.do"/> 
 <table> 
	 <tr><td>eCosway Shop ID:</td> 
		 <td><input name="from" type="text" value="2042"/></td> 
	
	 </tr> 
	 <tr><td>eCosway Order ID:</td> 
		 <td><input name="txn_id" type="text" value="test-order-1"/></td> 

	 </tr> 
	 <tr><td>Customer Mobile No.:</td> 
		 <td><input name="to" type="text" value="9161234567"/></td> 

	 </tr> 
	 <tr><td>Payment Amount (RUB a.k.a Rouble):</td> 
		 <td><input name="summ" type="text" value="2.15"/></td> 

	 </tr> 
	 <tr><td>Payment Description:</td> 
		 <td><input name="com" type="text" value="For registration fee"/></td> 

	 </tr> 
	 <tr> 
		 <td><input type="submit" value="Pay Now"/> 
		 </td> 

	 </tr> 
 </table> 
 </form> 
 </code> 
 </pre> 
 # Prepare a <code>servlet</code> or <code>JSP</code> to capture the payment status callback. 
 ## the <code>servlet</code> or <code>JSP</code> must accept this query parameter, *paymentResponse* 
 <pre>String paymentResponse = request.getParameter("paymentResponse");</pre> 
 ## decrypt the parameter using *EncryptAES* utils: 
 <pre> 
 <code class="JAVA"> 
 String decryptedResponse = new EncryptAES().decryptSKey(request.getParameter("paymentResponse")); 
 </code> 
 </pre> 
 ## the decrypted <code>paymentResponse</code> parameter consists of *transaction ID*, *payment result*, and *from who* and delimited by <code>comma</code> 
 <pre> 
 test-order-1,true,qiwi 
 </pre> 
 *** *transaction ID* - usually this is order ID  
 *** *payment result* - *true* means success; *false* means failed 
 *** *from who* - it is always *qiwi*  
 ## include the *full URL* of this <code>JSP</code> or <code>Servlet</code> into *delegate.url* property <code>[/data/qiwi-provider/application.properties]</code>, for example: 
 <pre> 
 delegate.url=http://127.0.0.1:8080/ecosway/qiwiPaymentStatusUpdate.jsp 
 </pre> 
 ## *Important Note:* This is your responsibility to persist this payment result into the respective <code>interface</code> table. 
 # done.