From empty
To version 125.1
edited by Helge Dahl
on 2017/06/22 09:25
Change comment: There is no comment for this version

Summary

Details

Page properties
Title
... ... @@ -1,0 +1,1 @@
1 +Payment
Parent
... ... @@ -1,0 +1,1 @@
1 +eCommerce Documentation.PayEx Checkout.Overview.WebHome
Author
... ... @@ -1,1 +1,1 @@
1 -XWiki.XWikiGuest
1 +xwiki:XWiki.hde
Default language
... ... @@ -1,0 +1,1 @@
1 +en
Content
... ... @@ -1,0 +1,356 @@
1 +**Table of contents**
2 +
3 +{{toc/}}
4 +
5 += Retrieve Payment =
6 +
7 +An implementer must first perform a POST to the [[Payment Session resource>>ecommerce.PayEx Checkout.Payment-session]] to begin the PayEx Checkout user flow. When done, a Payment resource will be created. Operations to perform a Capture, Cancel or Reversal transaction requests will be found within the Payment resource.
8 +
9 +The URL of the Payment is found within the Payment Session resource. [[Read about how to retrieve the payment session here.>>ecommerce.PayEx Checkout.Payment-session||anchor="HRetrievePaymentSession"]] This resource requires authentication as mentioned in the [[Intro>>ecommerce.PayEx Checkout.Introduction||anchor="HAuthentication"]].
10 +
11 +== Example ==
12 +
13 +=== Request ===
14 +
15 +{{code language="JavaScript"}}
16 +GET <payment_url> HTTP/1.1
17 +Content-Type: application/json
18 +Authorization: Bearer merchantToken==
19 +{{/code}}
20 +
21 +=== Response ===
22 +
23 +{{code language="JavaScript"}}
24 +{
25 + "payment": {
26 + "id": "/psp/creditcard/payments/5adc265f-f87f-4313-577e-08d3dca1a26c",
27 + "number": 1234567890,
28 + "created": "2016-09-14T13:21:29.3182115Z",
29 + "updated": "2016-09-14T13:21:57.6627579Z",
30 + "operation": "Purchase|Verify|Recur",
31 + "intent": "PreAuthorization|Authorization|AutoCapture",
32 + "state": "Ready|Pending|Failed|Aborted",
33 + "currency": "NOK|SEK|...",
34 + "amount": 1500,
35 + "remainingCaptureAmount": 1500,
36 + "remainingCancellationAmount": 1500,
37 + "remainingReversalAmount": 0,
38 + "description": "Test Purchase",
39 + "initiatingSystemUserAgent": "PostmanRuntime/3.0.1",
40 + "userAgent": "Mozilla/5.0...",
41 + "language": "nb-NO",
42 + "paymentToken": "5adc265f-f87f-4313-577e-08d3dca1a26c",
43 + "prices": {
44 + "id": "/psp/creditcard/payments/5adc265f-f87f-4313-577e-08d3dca1a26c/prices"
45 + },
46 + "transactions": {
47 + "id": "/psp/creditcard/payments/5adc265f-f87f-4313-577e-08d3dca1a26c/transactions"
48 + },
49 + "authorizations": {
50 + "id": "/psp/creditcard/payments/5adc265f-f87f-4313-577e-08d3dca1a26c/authorizations"
51 + },
52 + "captures": {
53 + "id": "/psp/creditcard/payments/5adc265f-f87f-4313-577e-08d3dca1a26c/captures"
54 + },
55 + "cancellations": {
56 + "id": "/psp/creditcard/payments/5adc265f-f87f-4313-577e-08d3dca1a26c/cancellations"
57 + },
58 + "reversals": {
59 + "id": "/psp/creditcard/payments/5adc265f-f87f-4313-577e-08d3dca1a26c/reversals"
60 + },
61 + "payeeInfo": {
62 + "id": "/psp/creditcard/payments/5adc265f-f87f-4313-577e-08d3dca1a26c/payeeInfo"
63 + },
64 + "urls": {
65 + "id": "/psp/creditcard/payments/5adc265f-f87f-4313-577e-08d3dca1a26c/urls"
66 + },
67 + },
68 + "operations": [
69 + {
70 + "href": "<capture_operation_url>",
71 + "rel": "create-checkout-capture",
72 + "method": "POST"
73 + },
74 + {
75 + "href": "<cancellation_operation_url>",
76 + "rel": "create-checkout-cancellation",
77 + "method": "POST"
78 + },
79 + {
80 + "href": "<reversal_operation_url>",
81 + "rel": "create-checkout-reversal",
82 + "method": "POST"
83 + }
84 + ]
85 +}
86 +{{/code}}
87 +
88 += Operations =
89 +
90 +The available operations that can be performed on a Payment will be listed inside the {{code}}operations{{/code}} property. For documentation on these operations, please see below.
91 +
92 +== Capture ==
93 +
94 +To perform a Capture operation in PayEx Checkout, you find the {{code}}create-checkout-capture{{/code}} operation listed in the Payment resource. It will look something like this:
95 +
96 +{{code language="JavaScript"}}
97 +{
98 + ...
99 + "operations": [{
100 + "href": "<capture_operation_url>"
101 + "rel": "create-checkout-capture",
102 + "method": "POST"
103 + },
104 + {
105 + ...
106 + }]
107 + ...
108 +}
109 +{{/code}}
110 +
111 +=== Capture request (simple) ===
112 +
113 +Build the Capture request by finding the {{code}}href{{/code}} and {{code}}method{{/code}} properties of the {{code}}create-checkout-capture{{/code}} operation.
114 +
115 +The simple Capture request does a full capture of the {{code}}amount{{/code}} and {{code}}fees{{/code}} specified in the [[Payment Session>>ecommerce.PayEx Checkout.Payment-session]]. Unless you want to perform a partial Capture or add item descriptions, the simple Capture is the recommended way to Capture the payment.
116 +
117 +{{code language="JavaScript"}}
118 +POST <capture_operation_href> HTTP/1.1
119 +Accept: application/json
120 +Content-Type: application/json
121 +Authorization: Bearer merchantToken==
122 +
123 +{
124 + "transaction": {
125 + "description": "description for the transaction"
126 + }
127 +}
128 +{{/code}}
129 +
130 +**Parameters**
131 +
132 +|(% style="text-align:right; width:131px" %)**Param** |(% style="width:1347px" %)**Details**
133 +|(% style="text-align:right; width:131px" %){{code}}description{{/code}}
134 +(% style="color:LightGrey" %)string|(% style="width:1347px" %)Description of the item you are capturing.
135 +
136 +=== Capture request (advanced) ===
137 +
138 +If you want to Capture less than the total amount of the Payment (partial capture) or add additional item descriptions that may be printed on an invoice. The advanced Capture adds any {{code}}fees{{/code}} specified in the [[Payment Session>>ecommerce.PayEx Checkout.Payment-session]]. An advanced Capture request may look something like this:
139 +
140 +{{code language="JavaScript"}}
141 +{
142 + "transaction": {
143 + "amount": 350.00,
144 + "vatAmount": 70.00, // Note: please see the valid VAT rates in the parameter description below.
145 + "description": "description for transaction"
146 + },
147 + "itemDescriptions": [{
148 + "amount": 250.00,
149 + "vatAmount": 50.00, // Note: please see the valid VAT rates in the parameter description below.
150 + "itemAmount": 50.00,
151 + "quantity": 5,
152 + "description": "item description 1"
153 + },
154 + {
155 + "amount": 100.00,
156 + "vatAmount": 20.00, // Note: please see the valid VAT rates in the parameter description below.
157 + "itemAmount": 50.00,
158 + "quantity": 2,
159 + "description": "item description 2"
160 + }
161 + ]
162 +}
163 +{{/code}}
164 +
165 +**Parameters**
166 +
167 +|(% style="text-align:right" %)**Param**|**Details**
168 +|(% style="text-align:right" %){{code}}transaction.amount{{/code}}
169 +(% style="color:LightGrey" %)decimal|Total amount of the transaction (sum of ##itemDescriptions.amount##), including VAT.
170 +|(% style="text-align:right" %){{code}}transaction.vatAmount{{/code}}
171 +(% style="color:LightGrey" %)decimal|(% style="width:1764px" %)Total VAT amount of the transaction. Note: Due to legal requirements, VAT must be calculated from the following valid rates: 0%, 6%, 8%, 10%, 12%, 14%, 15%, 22%, 24% and 25%. All other VAT rates will be declined and cause an input validation error.
172 +|(% style="text-align:right" %){{code}}transaction.description{{/code}}
173 +(% style="color:LightGrey" %)string|(% style="width:1764px" %)Description of the transaction.
174 +|(% style="text-align:right" %){{code}}itemDescriptions.amount{{/code}}
175 +(% style="color:LightGrey" %)decimal|(% style="width:1764px" %)The total amount of the items (##itemAmount * quantity##), including VAT.
176 +|(% style="text-align:right" %){{code}}itemDescriptions.vatAmount{{/code}}
177 +(% style="color:LightGrey" %)decimal|(% style="width:1764px" %)Total VAT amount of the items (not divided by quantity).
178 +|(% style="text-align:right" %){{code}}itemDescriptions.itemAmount{{/code}}
179 +(% style="color:LightGrey" %)decimal|(% style="width:1764px" %)Amount per item, VAT included.
180 +|(% style="text-align:right" %){{code}}itemDescriptions.quantity{{/code}}
181 +(% style="color:LightGrey" %)integer|(% style="width:1764px" %)Number of items.
182 +|(% style="text-align:right" %){{code}}itemDescriptions.description{{/code}}
183 +(% style="color:LightGrey" %)string|(% style="width:1764px" %)Description of the item (order line, product, shopping cart item, or similar).
184 +
185 +=== Capture response ===
186 +
187 +{{code language="JavaScript"}}
188 +{
189 + "payment": "<paymentUrl>",
190 + "capture": {
191 + "id": "<paymentCaptureUurl>",
192 + "transaction": {
193 + "id": "<transactionUrl>",
194 + "created": "2016-09-14T01:01:01.01Z",
195 + "updated": "2016-09-14T01:01:01.03Z",
196 + "type": "Capture",
197 + "state": "Initialized|Completed|Failed",
198 + "number": 1234567890,
199 + "amount": 350.00,
200 + "vatAmount": 70.00,
201 + "description": "Test Capture",
202 + "payeeReference": "ABC123",
203 + "failedReason": "",
204 + "isOperational": "TRUE|FALSE",
205 + "operations": []
206 + }
207 + }
208 +}
209 +{{/code}}
210 +
211 +== Cancellation ==
212 +
213 +To perform a Cancellation operation in PayEx Checkout, you find the {{code}}create-checkout-cancellation{{/code}} operation listed in the Payment resource.
214 +It will look something like this:
215 +
216 +{{code language="JavaScript"}}
217 +...
218 +"operations": [{
219 + "href": "<cancellation_operation_url>"
220 + "rel": "create-checkout-cancellation",
221 + "method": "POST"
222 +} ... ]
223 +...
224 +{{/code}}
225 +
226 +=== Cancellation request ===
227 +
228 +Build the Cancellation request by finding the {{code}}href{{/code}} and {{code}}method{{/code}} properties of the {{code}}create-checkout-cancellation{{/code}} operation.
229 +
230 +The Cancellation request does a full cancellation of the {{code}}amount{{/code}} and {{code}}fees{{/code}} specified in the [[Payment Session>>ecommerce.PayEx Checkout.Payment-session]].
231 +
232 +{{code language="JavaScript"}}
233 +POST <cancel_operation_href> HTTP/1.1
234 +Accept: application/json
235 +Content-Type: application/json
236 +Authorization: Bearer merchantToken==
237 +
238 +{
239 + "transaction": {
240 + "description": "Test Cancellation",
241 + }
242 +}
243 +{{/code}}
244 +
245 +**Parameters**
246 +
247 +|(% style="text-align:right; width:131px" %)**Param** |(% style="width:1347px" %)**Details**
248 +|(% style="text-align:right; width:131px" %){{code}}Description{{/code}}
249 +(% style="color:LightGrey" %)string|(% style="width:1347px" %)Description of the item you are canceling.
250 +
251 +=== Cancel response ===
252 +
253 +{{code language="JavaScript"}}
254 +{
255 + "payment": "<paymentUrl>",
256 + "cancellation": {
257 + "id": "<paymentCancellationUrl>",
258 + "transaction": {
259 + "id": "<transactionUrl>",
260 + "created": "2016-09-14T01:01:01.01Z",
261 + "updated": "2016-09-14T01:01:01.03Z",
262 + "type": "Cancellation",
263 + "state": "Initialized|Completed|Failed",
264 + "number": 1234567890,
265 + "amount": 1000,
266 + "vatAmount": 200,
267 + "description": "Test Cancellatiopn",
268 + "payeeReference": "ABC123",
269 + "failedReason": "",
270 + "isOperational": "TRUE|FALSE",
271 + "operations": []
272 + }
273 + }
274 +}
275 +{{/code}}
276 +
277 +== Reversal ==
278 +
279 +To perform a Reversal operation in PayEx Checkout, you find the {{code}}create-checkout-reversal{{/code}} operation listed in the Payment resource.
280 +It will look something like this:
281 +
282 +{{code language="JavaScript"}}
283 +{
284 + ...
285 + "operations": [{
286 + "href": "<reversal_operation_url>",
287 + "rel": "create-checkout-reversal",
288 + "method": "POST"
289 + },
290 + {
291 + ...
292 + }]
293 + ...
294 +}
295 +{{/code}}
296 +
297 +=== Reversal request ===
298 +
299 +Build the Reversal request by finding the {{code}}href{{/code}} and {{code}}method{{/code}} properties of the {{code}}create-checkout-reversal{{/code}} operation.
300 +
301 +The Reversal request does a reversal of the amount specified in the Request.
302 +
303 +{{code language="JavaScript"}}
304 +POST <reversal_operation_href> HTTP/1.1
305 +Accept: application/json
306 +Content-Type: application/json
307 +Authorization: Bearer merchantToken==
308 +
309 +{
310 + "transaction": {
311 + "amount": 100.00,
312 + "vatAmount": 20.00,
313 + "description": "Test Reversal"
314 + }
315 +}
316 +{{/code}}
317 +
318 +**Parameters**
319 +
320 +|(% style="text-align:right; width:201px" %)**Param**|(% style="width:1277px" %)**Details**
321 +|(% style="text-align:right; width:201px" %){{code}}transaction.amount{{/code}}
322 +(% style="color:LightGrey" %)decimal|(% style="width:1277px" %)Total amount of the transaction vat included.
323 +|(% style="text-align:right; width:201px" %){{code}}transaction.vatAmount{{/code}}
324 +(% style="color:LightGrey" %)decimal|(% style="width:1277px" %)Total vat amount of the transaction.
325 +|(% style="text-align:right; width:201px" %){{code}}transaction.description{{/code}}
326 +(% style="color:LightGrey" %)string|(% style="width:1277px" %)Description of the transaction
327 +
328 +=== Reversal response ===
329 +
330 +{{code language="JavaScript"}}
331 +{
332 + "payment": "<paymentUrl>",
333 + "reversal": {
334 + "id": "<paymentReversalUrl>",
335 + "transaction": {
336 + "id": "<transactionUrl>",
337 + "created": "2016-09-14T01: 01: 01.01Z",
338 + "updated": "2016-09-14T01: 01: 01.03Z",
339 + "type": "Capture",
340 + "state": "Initialized|Completed|Failed",
341 + "number": 1234567890,
342 + "amount": 1000,
343 + "vatAmount": 200,
344 + "description": "Testtransaction",
345 + "payeeReference": "AH123456",
346 + "failedReason": "",
347 + "isOperational": "TRUE|FALSE",
348 + "operations": []
349 + }
350 + }
351 +}
352 +{{/code}}
353 +
354 += Problems =
355 +
356 +If a request fails, its response will have a status code between 400 and 599. The HTTP body of the response will also be in the form of an {{code}}application/problem+json{{/code}} ([[RFC 7807>>https://tools.ietf.org/html/rfc7807]]), explaining in detail why the request failed and which, if any, actions you can take to remedy the problem. You can read more about this [[here>>doc:ecommerce.PayEx Checkout.Problems.WebHome]].

Tips

If you're starting with XWiki, check out the Getting Started Guide.

Need help?

If you need help with XWiki you can contact: