Project

General

Profile

Programming Guide » History » Version 9

chin-yeh, 03/07/2012 11:33 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
> 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 8 chin-yeh
** *from* - merchant ID _(refer to the [[wiki#Merchant-Account|Merchant Account]] to get the merchant details)_
18 5 chin-yeh
** *txn_id* - unique transaction ID, _e.g. order ID_
19
** *to* - customer's MSISDN, _e.g. mobile phone number_
20
** *summ* - payment amount, _e.g. 10.22_
21 2 chin-yeh
** *com* - description of this payment
22
** _example_:
23
<pre>
24
<code class="HTML">
25
<form method="post" action="http://w.qiwi.ru/setInetBill_utf.do"/>
26
<table>
27
	<tr><td>eCosway Shop ID:</td>
28
		<td><input name="from" type="text" value="2042"/></td>
29
	
30
	</tr>
31
	<tr><td>eCosway Order ID:</td>
32
		<td><input name="txn_id" type="text" value="test-order-1"/></td>
33
34
	</tr>
35
	<tr><td>Customer Mobile No.:</td>
36
		<td><input name="to" type="text" value="9161234567"/></td>
37
38
	</tr>
39
	<tr><td>Payment Amount (RUB a.k.a Rouble):</td>
40
		<td><input name="summ" type="text" value="2.15"/></td>
41
42
	</tr>
43
	<tr><td>Payment Description:</td>
44
		<td><input name="com" type="text" value="For registration fee"/></td>
45
46
	</tr>
47
	<tr>
48
		<td><input type="submit" value="Pay Now"/>
49
		</td>
50
51
	</tr>
52
</table>
53
</form>
54
</code>
55
</pre>
56
# Prepare a <code>servlet</code> or <code>JSP</code> to capture the payment status callback.
57
## the <code>servlet</code> or <code>JSP</code> must accept this query parameter, *paymentResponse*
58
<pre>String paymentResponse = request.getParameter("paymentResponse");</pre>
59
## decrypt the parameter using *EncryptAES* utils:
60
<pre>
61
<code class="JAVA">
62
String decryptedResponse = new EncryptAES().decryptSKey(request.getParameter("paymentResponse"));
63
</code>
64
</pre>
65
## the decrypted <code>paymentResponse</code> parameter consists of *transaction ID*, *payment result*, and *from who* and delimited by <code>comma</code>
66
<pre>
67
test-order-1,true,qiwi
68 1 chin-yeh
</pre>
69 8 chin-yeh
*** *transaction ID* - usually this is order ID 
70
*** *payment result* - *true* means success; *false* means failed
71
*** *from who* - it is always *qiwi* 
72 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:
73
<pre>
74
delegate.url=http://127.0.0.1:8080/ecosway/qiwiPaymentStatusUpdate.jsp
75
</pre>
76 2 chin-yeh
## *Important Note:* This is your responsibility to persist this payment result into the respective <code>interface</code> table.
77
# done.