Payment Resource
The payment
resource is central to all payment methods. All operations
that target the payment resource directly produce a response similar to the
example seen below. The response given contains all operations that are
possible to perform in the current state of the payment.
GET Payment Resource Request
Request
1
2
3
4
GET /psp/trustly/payments/7e6cdfc3-1276-44e9-9992-7cf4419750e1/ HTTP/1.1
Host: api.externalintegration.payex.com
Authorization: Bearer <AccessToken>
Content-Type: application/json
GET Payment Resource Response
Response
1
2
3
HTTP/1.1 200 OK
Content-Type: application/json
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
{
"payment": {
"id": "/psp/trustly/payments/7e6cdfc3-1276-44e9-9992-7cf4419750e1",
"number": 1234567890,
"created": "2016-09-14T13:21:29.3182115Z",
"updated": "2016-09-14T13:21:57.6627579Z",
"state": "Ready",
"operation": "Purchase",
"intent": "Sale",
"currency": "SEK",
"amount": 1500,
"remainingCaptureAmount": 1500,
"remainingCancellationAmount": 1500,
"remainingReversalAmount": 0,
"description": "Test Purchase",
"initiatingSystemUserAgent": "swedbankpay-sdk-dotnet/3.0.1",
"userAgent": "Mozilla/5.0...",
"language": "sv-SE",
"prices": {
"id": "/psp/trustly/payments/7e6cdfc3-1276-44e9-9992-7cf4419750e1/prices"
},
"payeeInfo": {
"id": "/psp/trustly/payments/7e6cdfc3-1276-44e9-9992-7cf4419750e1/payeeInfo"
},
"payers": {
"id": "/psp/trustly/payments/7e6cdfc3-1276-44e9-9992-7cf4419750e1/payers"
},
"urls": {
"id": "/psp/trustly/payments/7e6cdfc3-1276-44e9-9992-7cf4419750e1/urls"
},
"transactions": {
"id": "/psp/trustly/payments/7e6cdfc3-1276-44e9-9992-7cf4419750e1/transactions"
},
"reversals": {
"id": "/psp/trustly/payments/7e6cdfc3-1276-44e9-9992-7cf4419750e1/reversals"
},
},
"operations": [{
"method": "POST",
"href": "https://api.externalintegration.payex.com/psp/trustly/payments/7e6cdfc3-1276-44e9-9992-7cf4419750e1/sales",
"rel": "create-sale",
"contentType": "application/json"
},
{
"method": "GET",
"href": "https://api.externalintegration.payex.com/psp/trustly/payments/7e6cdfc3-1276-44e9-9992-7cf4419750e1",
"rel": "redirect-sale",
"contentType": "text/html"
},
{
"method": "GET",
"href": "https://api.externalintegration.payex.com/psp/trustly/payments/7e6cdfc3-1276-44e9-9992-7cf4419750e1",
"rel": "view-sale",
"contentType": "application/javascript"
},
{
"method": "PATCH",
"href": "https://api.externalintegration.payex.com/psp/trustly/payments/7e6cdfc3-1276-44e9-9992-7cf4419750e1",
"rel": "update-payment-abort",
"contentType": "application/json"
},
{
"method": "GET",
"href": "https://api.externalintegration.payex.com/psp/trustly/payments/7e6cdfc3-1276-44e9-9992-7cf4419750e1/paid",
"rel": "paid-payment",
"contentType": "application/json"
},
{
"method": "GET",
"href": "https://api.externalintegration.payex.com/psp/trustly/payments/7e6cdfc3-1276-44e9-9992-7cf4419750e1/failed",
"rel": "failed-payment",
"contentType": "application/json"
}
{
"method": "PATCH",
"href": "https://api.externalintegration.payex.com/psp/trustly/payments/7e6cdfc3-1276-44e9-9992-7cf4419750e1",
"rel": "update-payment-abort",
"contentType": "application/json"
},
{
"method": "POST",
"href": "https://api.externalintegration.payex.com/psp/trustly/payments/7e6cdfc3-1276-44e9-9992-7cf4419750e1/captures",
"rel": "create-capture",
"contentType": "application/json"
},
{
"method": "GET",
"href": "https://api.externalintegration.payex.com/psp/trustly/payments/7e6cdfc3-1276-44e9-9992-7cf4419750e1/paid",
"rel": "paid-payment",
"contentType": "application/json"
},
{
"method": "GET",
"href": "https://api.externalintegration.payex.com/psp/trustly/payments/7e6cdfc3-1276-44e9-9992-7cf4419750e1/failed",
"rel": "failed-payment",
"contentType": "application/json"
}
]
}
Field | Type | Description |
---|---|---|
payment |
object |
The payment object contains information about the specific payment. |
id |
string |
The relative URL and unique identifier of the payment resource . Please read about URL Usage to understand how this and other URLs should be used in your solution. |
number |
integer |
The payment number , useful when there’s need to reference the payment in human communication. Not usable for programmatic identification of the payment, where id should be used instead. |
created |
string |
The ISO-8601 date of when the payment was created. |
updated |
string |
The ISO-8601 date of when the payment was updated. |
state |
string |
Ready , Pending , Failed or Aborted . Indicates the state of the payment, not the state of any transactions performed on the payment. To find the state of the payment’s transactions (such as a successful authorization), see the transactions resource or the different specialized type-specific resources such as authorizations or sales . |
prices |
object |
The prices resource lists the prices related to a specific payment. |
prices.id |
string |
The relative URL and unique identifier of the prices resource . Please read about URL Usage to understand how this and other URLs should be used in your solution. |
description |
string |
A 40 character length textual description of the purchase. |
userAgent |
string |
The user agent of the payer. Should typically be set to the value of the User-Agent header sent by the payer’s web browser. |
language |
string |
sv-SE , nb-NO or en-US . |
urls |
string |
The URL to the urls resource where all URLs related to the payment can be retrieved. |
payeeInfo |
object |
The payeeInfo object, containing information about the payee (the recipient of the money). See payeeInfo for details. |
payers |
string |
The URL to the payer resource where the information about the payer can be retrieved. |
operations |
array |
The array of operations that are possible to perform on the payment in its current state. |
method |
string |
The HTTP method to use when performing the operation. |
href |
string |
The target URL to perform the operation against. |
rel |
string |
The name of the relation the operation has to the current resource. |
Operations
The operations should be performed as described in each response and not as
described here in the documentation.
Always use the href
and method
as specified in the response by finding
the appropriate operation based on its rel
value.
The only thing that should be hard coded in the client is the value of
the rel
and the request that will be sent in the HTTP body of the request
for the given operation.
Operation | Description |
---|---|
update-payment-abort |
abort s the payment order before any financial transactions are performed. |
paid-payment |
Returns the information about a payment that has the status paid . |
failed-payment |
Returns the information about a payment that has the status failed . |
view-sale |
Contains the URL of the JavaScript used to create a Seamless View iframe directly for the sale transaction without redirecting the payer to a separate payment page. |