forked from DomDerrien/amazon-fps-gaej
-
Notifications
You must be signed in to change notification settings - Fork 1
/
ReadMe.html
257 lines (235 loc) · 10.3 KB
/
ReadMe.html
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<title>AmazonFPS Java Library Ver-2008-09-17</title>
<style type="text/css">
body, div, p, td, th {
font-family : helvetica,sans-serif, arial;
font-size : 12px;
color : #000000;
}
.aws-h1, h1{
font-family: verdana, arial, helvetica, sans-serif;
font-size: 18px;
font-weight: bold;
color: #000000;
}
.aws-h2, h2{
font-family: verdana, arial, helvetica, sans-serif;
font-size: 14px;
color: #c60;
}
.aws-h3, h3{
font-family: verdana, arial, helvetica, sans-serif;
font-size: 12px;
font-weight: bold;
color: #333333;
}
/*table ID selector styles*/
#aws-table {
border-top: 1px solid #cccccc;
border-left: 1px solid #cccccc;
width:95%;
}
#aws-table td{
font-size: 12px;
padding: 5px 5px 5px 5px;
border-bottom: 1px solid #cccccc;
border-right: 1px solid #cccccc;
vertical-align:top;
}
#aws-table th {
font-size: 12px;
padding: 5px 5px 5px 5px;
border-bottom: 1px solid #cccccc;
border-right: 1px solid #cccccc;
vertical-align:top;
background-color: #eeeeee;
color: #333333;
font-size: 12px;
font-weight: bold;
text-align: left;
}
/*code, note, and example styles*/
pre {
font-family: "Courier New", Courier, mono;
font-size: 12px;
margin-top: 5px;
margin-bottom: 5px;
color: #000066;
padding: 5px;
background-color: #eff7ff;
border: 1px dashed #333;
width:75%;
display:block;
}
</style>
</head>
<body>
<h2>About this Library</h2>
<ul>
<li>Based on the 2008-09-17 API version.</li>
<li>Version 2.0</li>
<li>Release Date : 2009-11-03</li>
</ul>
<h2>Before you begin</h2>
<p>Extract the contents of amazon-fps-2008-09-17-java-library.zip to a folder. The folder amazon-fps-2008-09-17-java-library is created.This folder will be referred to as <ROOT> from this point onwards. Different sub-directories are</p>
<ul>
<li>src — This folder contains the code files for the library and sample API calls to Amazon FPS.</li>
<li>third-party — This folder contains the jar files required to run the sample.</li>
</ul>
<h2>Prerequisites</h2>
<ul>
<li>Amazon FPS Sandbox Account (<a href="https://developer.payments-sandbox.amazon.com/landingpage/">Click here to sign up</a>).</li>
<li>Amazon FPS Developer Account (<a href="http://aws.amazon.com/fps">Click here to sign up</a>).</li>
<li>J2SE 5.0 JDK</li>
<li>Apache Ant, version 1.6.5</li>
</ul>
<h2>Package Content</h2>
<table id="aws-table">
<tbody>
<tr>
<th>Directory</th>
<th>Overview</th>
</tr>
<tr>
<td>
src
</td>
<td>
Source distribution of the library. All sources including code samples that demonstrate the use of the library located under this directory.
</td>
</tr>
<tr>
<td>
third-party
</td>
<td>
Third party libraries required for SDK.
</td>
</tr>
</tbody>
</table>
<h2>Steps to build library</h2>
<ol>
<li>Open and update the configuration file amazon-fps-2008-09-17-java-library/src/config.properties
<li>Update AwsServiceEndPoint
<ul type="disc">
<li>No change is required in case you are hitting the FPS
production end point: <a href="https://fps.amazonaws.com">https://fps.amazonaws.com</a>
</li>
<li>If you want to hit the FPS Sandbox end point, set the
AwsServiceURL as: <a href="https://fps.sandbox.amazonaws.com">https://fps.sandbox.amazonaws.com</a>
</li>
</ul>
</li>
<li>Update AwsAccessKey with your Amazon FPS access key (<a href="https://aws-portal.amazon.com/gp/aws/developer/account/index.html?ie=UTF8&action=access-key">Click here to get your keys</a>) </li>
<li>Update AwsSecretKey with your Amazon FPS secret key (<a href="https://aws-portal.amazon.com/gp/aws/developer/account/index.html?ie=UTF8&action=access-key">Click here to get your keys</a>) </li>
<li>Update CBUIServiceEndPoint
<ul type="disc">
<li>No change required in case you are hitting the CBUI production end point: <a href="https://authorize.payments.amazon.com/cobranded-ui/actions/start">https://authorize.payments.amazon.com/cobranded-ui/actions/start</a></li>
<li>If you want to hit CBUI sandbox end point, update CBUIServiceEndPoint value to: <a href="https://authorize.payments-sandbox.amazon.com/cobranded-ui/actions/start">https://authorize.payments-sandbox.amazon.com/cobranded-ui/actions/start</a></li>
</ul>
</li>
<li>Make sure third party jars shipped in the zip are included in your build path.</li>
<li>Run ant build in the amazon-fps-2008-09-17-java-library folder.</li>
</ol>
<h2>Steps to make a payment</h2>
<p> Making a payment involves two parts. First, you obtain a payment authorization from buyers by redirecting them to co-branded pages hosted by Amazon FPS. When buyers return to your web site, you receive a payment authorization(also called a sender token) as part of the return URL. Second, you use this payment authorization or sender token in a 'Pay' API call to make a payment.</p>
<h3>Steps to get authrorization from buyer</h3>
<ol>
<li> Setup an app server at your side to receive HTTP redirect from Cobranded UI.</li>
<li> Get the authorization from the buyer </li>
<ul type="disc">
<li> Go to <ROOT>/src/com/amazonaws/cbui/samples directory and open CBUISingleUsePipelineSample.java </li>
<li> In function <tt>main</tt>, set the following fields</li>
<tt><pre>
AmazonFPSSingleUsePipeline pipeline= new AmazonFPSSingleUsePipeline(accessKey, secretKey);
pipeline.setMandatoryParameters("callerReferenceSingleUse", "http://www.mysite.com/call_back.jsp", "5");
//optional parameters
pipeline.addParameter("currencyCode", "USD");
pipeline.addParameter("paymentReason", "HarryPotter 1-5 DVD set");
//SingleUse url
System.out.println("Sample CBUI url for SingleUse pipeline :" + pipeline.getUrl());
</pre></tt>
</li>
<li>Run this smaple as a java application.</li>
<li>Copy the URL printed on console and paste it on your browser. You will be redirected to Amazon FPS CBUI.</li>
<li>Go through the pipeline. Make sure you use a different Amazon FPS account, while acting as buyer. At the end of the pipeline, you(buyer) will be redirected back to the return URL provided in the query string above.</li>
<li>The return URL will include expiry, tokenID, status, callerReference and signature parameters. Please note that tokenID will be used in Pay later.</li>
<li>Validate that Amazon Payments CBUI actually redirected the customer to the Return URL specified. You have two options to validate
<ol>
<li>Server-side validation using VerifySignature API call (recommended for quicker integration). <a href="IpnAndReturnUrlValidation.html#verifysignatureapiforreturnurl">Click here for steps.</a></li>
<li>Client-side validation using PKI based algorithm. <a href="IpnAndReturnUrlValidation.html#pkiforreturnurl">Click here for steps.</a></li>
</ol>
</li>
</ol>
</ul>
<h3>Steps to make a payment</h3>
<ul>
<li> Open PaySample.java in <ROOT>/src/Amazon/FPS/Samples </li>
<li> Set SenderTokenId the same as the one returned by CBUI above</li>
</ul>
<ul>
<li>Set request parameters. For example, find following pre-generated snippet:</li>
<pre>
// PayRequest request = new PayRequest();
// @TODO: set request parameters here
// PaySample.invokePay(service, request);
</pre>
</ul>
<ul>
<li>Uncomment first and third line and set Pay request parameters</li>
<pre>
PayRequest request = new PayRequest();
request.setCallerReference("ABCDEFGHIJKL12345");
request.setSenderTokenId("<replace with the senderTokenId you got in the above step>");
Amount amount = new Amount();
amount.setCurrencyCode(CurrencyCode.USD);
amount.setValue("1");
request.setTransactionAmount(amount);
PaySample.invokePay(service, request);
</pre>
<li>run sample. You should see the output similar to the following:</li>
<pre>
PayResponse
PayResult
TransactionId
13L1AFBDB54MM68LBL8UDPJTQOZNP1F3PTC
TransactionStatus
Pending
ResponseMetadata
RequestId
85b069ef-8b27-43e1-89cf-f1cfcb3a0e72:0
...
</pre>
<li>Experiment with other samples, examine samples sources. When ready, add library project to your solution, and use it.</li>
<li>If the response status is Pending, you can use <tt>GetTransactionStatus</tt> API to get latest transaction status</li>
<li>Amazon Payments will post an IPN for this transaction to your ipn url registered with us. You have two options to validate this IPN.
<ol>
<li>Server-side validation using VerifySignature API call (recommended for quicker integration). <a href="IpnAndReturnUrlValidation.html#verifysignatureapiforipn">Click here for steps.</a></li>
<li>Client-side validation using PKI based algorithm. <a href="IpnAndReturnUrlValidation.html#pkiforipn">Click here for steps.</a></li>
</ol>
</li>
</ul>
</ol>
<h2>Trouble shooting</h2>
<ol>
<li>The import javax.xml.bind cannot be resolved</li>
<ul type="a">
<li>Make sure all jars present in <ROOT>\third-party and its sub directories are included in your CLASSPATH </li>
</ul>
</ol>
<h2>Related resources</h2>
<a href="http://aws.amazon.com/fps/">More about Amazon FPS</a>
<br/>
<a href="http://developer.amazonwebservices.com/connect/entry.jspa?externalID=2022&categoryID=277">Documentation</a>
<br/>
<a href="http://developer.amazonwebservices.com/connect/kbcategory.jspa?categoryID=126">Code samples</a>
<br/>
<a href="http://developer.amazonwebservices.com/connect/forum.jspa?forumID=35">Contact us for technical issues</a>
<br/>
<h2>Comments, Questions or Feedback</h2>
If you have any comments, questions or feedback on the library, please start discussion here (<a href="http://developer.amazonwebservices.com/connect/forum.jspa?forumID=35">Amazon FPS forum</a>).
</body>
</html>