Wiki source code of Problems
Last modified by Asbjørn Ulsberg on 2018/07/05 12:48
12.1 | 1 | When performing requests against the PayEx Checkout API, problems might occur. All problems will be served in the form of an {{code}}application/problem+json{{/code}} ([[RFC 7807 Problem Detail>>https://tools.ietf.org/html/rfc7807]]) response. All problem responses will have a common structure, with the following properties: | |
2 | |||
3 | = Properties = | ||
4 | |||
5 | |(% style="text-align:right" %)**Property** |=(% style="width: 1119px;" %)Description|=(% style="text-align:center" %)Use* | ||
6 | |(% style="text-align:right" %){{code}}type{{/code}} | ||
7 | (% style="color:LightGrey" %)string|(% style="width:1119px" %)((( | ||
8 | A URL describing the type of problem that occurred. To be treated as an exception class type. Can be trusted to not change between different instances of the same problem type. | ||
9 | )))|(% style="color:#2bb461; text-align:center" %)✓ | ||
10 | |(% style="text-align:right" %){{code}}title{{/code}} | ||
11 | (% style="color:LightGrey" %)string|(% style="width:1119px" %)((( | ||
12 | The human readable title of the problem. | ||
13 | )))|(% style="color:red; text-align:center" %)✗ | ||
14 | |(% style="text-align:right" %){{code}}status{{/code}} | ||
15 | (% style="color:LightGrey" %)int|(% style="width:1119px" %)((( | ||
16 | The HTTP status code of the response, included as a convenience for logging, etc. | ||
17 | )))|(% style="color:#2bb461; text-align:center" %)✓ | ||
18 | |(% style="text-align:right" %){{code}}detail{{/code}} | ||
19 | (% style="color:LightGrey" %)string|(% style="width:1119px" %)The human readable detail explaining the source of the problem and, if any, which actions you can perform to remedy the problem.|(% style="color:red; text-align:center" %)✗ | ||
20 | |(% style="text-align:right" %){{code}}instance{{/code}} | ||
21 | (% style="color:LightGrey" %)string | ||
22 | (optional)|(% style="width:1119px" %)An optional identifier of the instance of the problem that occurred, useful for PayEx Support when debugging what the source of the problem might be. |(% style="color:red; text-align:center" %)✗ | ||
23 | |(% style="text-align:right" %){{code}}problems{{/code}} | ||
24 | (% style="color:LightGrey" %)array | ||
25 | (optional) |(% style="width:1119px" %)((( | ||
26 | An optional array of objects containing details about which JSON fields or similar in the request that had errors and a description of what the error was. | ||
27 | |||
28 | {{code language="JavaScript"}} | ||
29 | { | ||
30 | "name": "...", | ||
31 | "description": "..." | ||
32 | } | ||
33 | {{/code}} | ||
34 | )))|(% style="color:#2bb461; text-align:center" %)✓ | ||
35 | |||
36 | ***Use: **Whether hard coded, programmatic use of values in this property is encouraged or not. | ||
37 | |||
38 | = Request Problems = | ||
39 | |||
40 | Request problems within the HTTP status code range of {{code}}400{{/code}} to {{code}}499{{/code}} indicates that the request contains an error that needs to be fixed before the request can be retried against the PayEx Checkout API. Below is an example of a problem response you might get from PayEx Checkout: | ||
41 | |||
42 | {{code language="JavaScript"}} | ||
43 | { | ||
44 | "type": "https://api.payex.com/psp/checkout/problems/validation", | ||
45 | "title": "Validation error", | ||
46 | "status": 400, | ||
47 | "detail": "There was 1 error in the request. Please correct the problem(s) and repeat the request.", | ||
48 | "instance": "1337", | ||
49 | "problems": [ | ||
50 | { | ||
51 | "name": "reference", | ||
52 | "description": "The field reference must be a string with a maximum length of 40." | ||
53 | } | ||
54 | ] | ||
55 | } | ||
56 | {{/code}} | ||
57 | |||
58 | = Server Problems = | ||
59 | |||
60 | Request problems within the HTTP status code range of {{code}}500{{/code}} to {{code}}599{{/code}} indicates that an unexpected error occurred in the server that it was unable to gracefully recover from. Below is an example of a problem response you might get from PayEx Checkout: | ||
61 | |||
62 | {{code language="JavaScript"}} | ||
63 | { | ||
64 | "type": "https://api.payex.com/psp/checkout/problems/validation", | ||
65 | "title": "An unexpected error occurred", | ||
66 | "status": 500, | ||
67 | "detail": "An unexpected error occurred. Please contact support.ecom@payex.com with the value of the instance field (1337) to have the problem resolved", | ||
68 | "instance": "1337", | ||
69 | } | ||
70 | {{/code}} |