Project

General

Profile

Programming Guide » History » Version 15

Soh Keong, 02/05/2013 08:32 AM

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 15 Soh Keong
> http://192.168.2.68:8080/TestPage/page/qiwi/sample_payment_form.jsp
9 1 chin-yeh
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 12 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 13 Chooi-Mey
** *lifetime* - bill’s lifetime in hours (max 45 days)
24 2 chin-yeh
** _example_:
25
<pre>
26
<code class="HTML">
27
<form method="post" action="http://w.qiwi.ru/setInetBill_utf.do"/>
28
<table>
29
	<tr><td>eCosway Shop ID:</td>
30
		<td><input name="from" type="text" value="2042"/></td>
31
	
32
	</tr>
33
	<tr><td>eCosway Order ID:</td>
34
		<td><input name="txn_id" type="text" value="test-order-1"/></td>
35
36
	</tr>
37
	<tr><td>Customer Mobile No.:</td>
38
		<td><input name="to" type="text" value="9161234567"/></td>
39
40
	</tr>
41
	<tr><td>Payment Amount (RUB a.k.a Rouble):</td>
42
		<td><input name="summ" type="text" value="2.15"/></td>
43
44
	</tr>
45
	<tr><td>Payment Description:</td>
46
		<td><input name="com" type="text" value="For registration fee"/></td>
47
48 13 Chooi-Mey
	</tr>
49
	<tr><td>Lifetime(hours):</td>
50
		<td><input name="lifetime" type="text" value="24"/></td>
51 2 chin-yeh
	</tr>
52
	<tr>
53
		<td><input type="submit" value="Pay Now"/>
54
		</td>
55
56
	</tr>
57
</table>
58
</form>
59
</code>
60
</pre>
61
# Prepare a <code>servlet</code> or <code>JSP</code> to capture the payment status callback.
62 10 chin-yeh
## the <code>servlet</code> or <code>JSP</code> must accept this 2 query parameter, *paymentResponse* and *cardGateway*
63
<pre>
64
<code class="JAVA">
65
String paymentResponse = request.getParameter("paymentResponse");
66
String cardGateway = request.getParameter("cardGateway"); // always will be 'qiwi'
67
</code>
68
</pre>
69
*** _the value of *cardGateway* will be always *qiwi*_ 
70 2 chin-yeh
## decrypt the parameter using *EncryptAES* utils:
71
<pre>
72
<code class="JAVA">
73 1 chin-yeh
String decryptedResponse = new EncryptAES().decryptSKey(request.getParameter("paymentResponse"));
74
</code>
75 2 chin-yeh
</pre>
76 14 Soh Keong
## the decrypted <code>paymentResponse</code> parameter consists of *transaction ID*, *payment result* and *status code* and delimited by <code>comma</code>
77 2 chin-yeh
<pre>
78 14 Soh Keong
test-order-1,true,60
79 8 chin-yeh
</pre>
80 1 chin-yeh
*** *transaction ID* - usually this is order ID 
81 8 chin-yeh
*** *payment result* - *true* means success; *false* means failed
82 14 Soh Keong
*** *status code* - new bill status
83 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:
84
<pre>
85
delegate.url=http://127.0.0.1:8080/ecosway/qiwiPaymentStatusUpdate.jsp
86
</pre>
87 2 chin-yeh
## *Important Note:* This is your responsibility to persist this payment result into the respective <code>interface</code> table.
88
# done.