Project

General

Profile

Programming Guide » History » Version 11

chin-yeh, 03/07/2012 02:38 PM

1 1 chin-yeh
{{toc}}
2
3
h1. Programming Guide
4
5 2 chin-yeh
This guide describes how to integrate online mall with the QIWI.
6 1 chin-yeh
7
*Demo Application:* _(refer to the [[wiki#Merchant-Account|Merchant Account]] to get the merchant details)_
8
> http://192.168.2.68/qiwi-provider/sample_payment_form.html
9
10 9 chin-yeh
> you're conducting testing in QIWI *production* environment
11
12 1 chin-yeh
h2. Steps-By-Steps
13 2 chin-yeh
14 7 chin-yeh
# First, go through the [[wiki#Overview|Payment Flow]]
15 2 chin-yeh
# To redirect the customer to QIWI, prepare the following <code>HTML form</code>:
16
** *action* - must be http://w.qiwi.ru/setInetBill_utf.do
17 11 chin-yeh
** *method* - must use *POST* method
18 8 chin-yeh
** *from* - merchant ID _(refer to the [[wiki#Merchant-Account|Merchant Account]] to get the merchant details)_
19 5 chin-yeh
** *txn_id* - unique transaction ID, _e.g. order ID_
20
** *to* - customer's MSISDN, _e.g. mobile phone number_
21
** *summ* - payment amount, _e.g. 10.22_
22 2 chin-yeh
** *com* - description of this payment
23
** _example_:
24
<pre>
25
<code class="HTML">
26
<form method="post" action="http://w.qiwi.ru/setInetBill_utf.do"/>
27
<table>
28
	<tr><td>eCosway Shop ID:</td>
29
		<td><input name="from" type="text" value="2042"/></td>
30
	
31
	</tr>
32
	<tr><td>eCosway Order ID:</td>
33
		<td><input name="txn_id" type="text" value="test-order-1"/></td>
34
35
	</tr>
36
	<tr><td>Customer Mobile No.:</td>
37
		<td><input name="to" type="text" value="9161234567"/></td>
38
39
	</tr>
40
	<tr><td>Payment Amount (RUB a.k.a Rouble):</td>
41
		<td><input name="summ" type="text" value="2.15"/></td>
42
43
	</tr>
44
	<tr><td>Payment Description:</td>
45
		<td><input name="com" type="text" value="For registration fee"/></td>
46
47
	</tr>
48
	<tr>
49
		<td><input type="submit" value="Pay Now"/>
50
		</td>
51
52
	</tr>
53
</table>
54
</form>
55
</code>
56
</pre>
57
# Prepare a <code>servlet</code> or <code>JSP</code> to capture the payment status callback.
58 10 chin-yeh
## the <code>servlet</code> or <code>JSP</code> must accept this 2 query parameter, *paymentResponse* and *cardGateway*
59
<pre>
60
<code class="JAVA">
61
String paymentResponse = request.getParameter("paymentResponse");
62
String cardGateway = request.getParameter("cardGateway"); // always will be 'qiwi'
63
</code>
64
</pre>
65
*** _the value of *cardGateway* will be always *qiwi*_ 
66 2 chin-yeh
## decrypt the parameter using *EncryptAES* utils:
67
<pre>
68
<code class="JAVA">
69 1 chin-yeh
String decryptedResponse = new EncryptAES().decryptSKey(request.getParameter("paymentResponse"));
70
</code>
71 2 chin-yeh
</pre>
72 10 chin-yeh
## the decrypted <code>paymentResponse</code> parameter consists of *transaction ID*, and *payment result* and delimited by <code>comma</code>
73 2 chin-yeh
<pre>
74 10 chin-yeh
test-order-1,true
75 8 chin-yeh
</pre>
76
*** *transaction ID* - usually this is order ID 
77
*** *payment result* - *true* means success; *false* means failed
78 6 chin-yeh
## 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:
79
<pre>
80
delegate.url=http://127.0.0.1:8080/ecosway/qiwiPaymentStatusUpdate.jsp
81
</pre>
82 2 chin-yeh
## *Important Note:* This is your responsibility to persist this payment result into the respective <code>interface</code> table.
83
# done.