Programming Guide » History » Version 10
chin-yeh, 03/07/2012 02:17 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 | 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 | 10 | chin-yeh | ## the <code>servlet</code> or <code>JSP</code> must accept this 2 query parameter, *paymentResponse* and *cardGateway* |
58 | <pre> |
||
59 | <code class="JAVA"> |
||
60 | String paymentResponse = request.getParameter("paymentResponse"); |
||
61 | String cardGateway = request.getParameter("cardGateway"); // always will be 'qiwi' |
||
62 | </code> |
||
63 | </pre> |
||
64 | *** _the value of *cardGateway* will be always *qiwi*_ |
||
65 | 2 | chin-yeh | ## decrypt the parameter using *EncryptAES* utils: |
66 | <pre> |
||
67 | <code class="JAVA"> |
||
68 | 1 | chin-yeh | String decryptedResponse = new EncryptAES().decryptSKey(request.getParameter("paymentResponse")); |
69 | </code> |
||
70 | 2 | chin-yeh | </pre> |
71 | 10 | chin-yeh | ## the decrypted <code>paymentResponse</code> parameter consists of *transaction ID*, and *payment result* and delimited by <code>comma</code> |
72 | 2 | chin-yeh | <pre> |
73 | 10 | chin-yeh | test-order-1,true |
74 | 8 | chin-yeh | </pre> |
75 | *** *transaction ID* - usually this is order ID |
||
76 | *** *payment result* - *true* means success; *false* means failed |
||
77 | 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: |
78 | <pre> |
||
79 | delegate.url=http://127.0.0.1:8080/ecosway/qiwiPaymentStatusUpdate.jsp |
||
80 | </pre> |
||
81 | 2 | chin-yeh | ## *Important Note:* This is your responsibility to persist this payment result into the respective <code>interface</code> table. |
82 | # done. |