Skip to content

Commit 72afd2e

Browse files
committed
Updated API from documentation release
1 parent f4cb4be commit 72afd2e

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

41 files changed

+670
-64
lines changed

api-specs/checkout/api.raml

Lines changed: 104 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -42,7 +42,40 @@ securedBy: [oauth_2_0]
4242
traits:
4343
secured_by_manage_payments:
4444
securedBy:
45-
[oauth_2_0: { scopes: ['manage_checkout_payment_intents:{projectKey}'] }]
45+
[
46+
oauth_2_0:
47+
{
48+
scopes:
49+
[
50+
'manage_checkout_payment_intents:{projectKey}',
51+
'manage_projects:{projectKey}',
52+
],
53+
},
54+
]
55+
secured_by_manage_transactions:
56+
securedBy:
57+
[
58+
oauth_2_0:
59+
{
60+
scopes:
61+
[
62+
'manage_checkout_transactions:{projectKey}',
63+
'manage_projects:{projectKey}',
64+
],
65+
},
66+
]
67+
secured_by_view_transactions:
68+
securedBy:
69+
[
70+
oauth_2_0:
71+
{
72+
scopes:
73+
[
74+
'view_checkout_transactions:{projectKey}',
75+
'manage_projects:{projectKey}',
76+
],
77+
},
78+
]
4679

4780
/{projectKey}:
4881
(annotations.methodName): withProjectKey
@@ -62,7 +95,7 @@ traits:
6295
is:
6396
- secured_by_manage_payments
6497
body:
65-
type: Payment
98+
type: PaymentIntent
6699
example: !include ./examples/payments/capturePayment.json
67100
description: |
68101
Specific Error Codes:
@@ -77,3 +110,72 @@ traits:
77110
description: The request was invalid.
78111
body:
79112
type: ErrorResponse
113+
/transactions:
114+
post:
115+
is:
116+
- secured_by_manage_transactions
117+
body:
118+
type: TransactionDraft
119+
example: !include ./examples/transactions/transactionDraft.json
120+
description: |
121+
Creates a Transaction on Checkout. Specific Error Codes:
122+
- [InvalidInput](ctp:checkout:type:InvalidInputError)
123+
- [ResourceNotFound](ctp:checkout:type:ResourceNotFoundError)
124+
- [ConnectorFailed](ctp:checkout:type:ConnectorFailedError)
125+
- [PaymentFailure](ctp:checkout:type:PaymentFailureError)
126+
- [RequiredField](ctp:checkout:type:RequiredFieldError)
127+
responses:
128+
201:
129+
body:
130+
type: Transaction
131+
example: !include ../checkout/examples/transactions/transaction.json
132+
400:
133+
description: The request was invalid.
134+
body:
135+
type: ErrorResponse
136+
/{id}:
137+
(annotations.methodName): withId
138+
uriParameters:
139+
id:
140+
type: string
141+
description: |
142+
`id` of the [Transaction](/transactions-api#transaction).
143+
get:
144+
is:
145+
- secured_by_view_transactions
146+
description: |
147+
Returns a Transaction with a given `id`. Specific Error Codes:
148+
- [ResourceNotFound](ctp:checkout:type:ResourceNotFoundError)
149+
- [GeneralError](ctp:checkout:type:GeneralError)
150+
responses:
151+
200:
152+
body:
153+
type: Transaction
154+
example: !include ../checkout/examples/transactions/transaction.json
155+
400:
156+
description: The request was invalid.
157+
body:
158+
type: ErrorResponse
159+
/key={key}:
160+
(annotations.methodName): withKey
161+
uriParameters:
162+
key:
163+
type: string
164+
description: |
165+
`key` of the [Transaction](/transactions-api#transaction).
166+
get:
167+
is:
168+
- secured_by_view_transactions
169+
description: |
170+
Returns a Transaction with a given `key`. Specific Error Codes:
171+
- [ResourceNotFound](ctp:checkout:type:ResourceNotFoundError)
172+
- [GeneralError](ctp:checkout:type:GeneralError)
173+
responses:
174+
200:
175+
body:
176+
type: Transaction
177+
example: !include ../checkout/examples/transactions/transaction.json
178+
400:
179+
description: The request was invalid.
180+
body:
181+
type: ErrorResponse
Lines changed: 42 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,42 @@
1+
{
2+
"id" : "6d95b6c6-5ef0-4091-8478-b26077ca2b2f",
3+
"version" : 1,
4+
"key": "transaction-key",
5+
"application" : {
6+
"typeId": "application",
7+
"id": "a84d4fe7-ae82-4c3f-8c6c-435e54204fdd"
8+
},
9+
"cart": {
10+
"typeId": "cart",
11+
"id": "a0e60229-441c-44b0-952b-981a67cbd8c4"
12+
},
13+
"order": {
14+
"typeId": "order",
15+
"id": "39ccda28-47f9-41bf-8dde-e1d720c19000"
16+
},
17+
"transactionItems": [
18+
{
19+
"paymentIntegration": {
20+
"typeId": "payment-integration",
21+
"id": "4c24762b-87df-4bd3-898a-bafed913a9ca"
22+
},
23+
"amount": {
24+
"centAmount": 1000,
25+
"currencyCode": "EUR"
26+
},
27+
"payment": {
28+
"typeId": "payment",
29+
"id": "d1fec278-22c2-4a1d-8190-8f1e8af5ccfb"
30+
}
31+
}
32+
],
33+
"transactionStatus": {
34+
"state": "Failed",
35+
"errors": [{
36+
"code": "PaymentRejected",
37+
"message": "Payment d1fec278-22c2-4a1d-8190-8f1e8af5ccfb has been rejected."
38+
}]
39+
},
40+
"createdAt": "1970-01-01T00:00:00.001Z",
41+
"lastModifiedAt": "1970-01-01T00:00:00.001Z"
42+
}
Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,23 @@
1+
{
2+
"key": "transaction-key",
3+
"application" : {
4+
"typeId": "application",
5+
"id": "a84d4fe7-ae82-4c3f-8c6c-435e54204fdd"
6+
},
7+
"cart": {
8+
"typeId": "cart",
9+
"id": "a0e60229-441c-44b0-952b-981a67cbd8c4"
10+
},
11+
"transactionItems": [
12+
{
13+
"paymentIntegration": {
14+
"typeId": "payment-integration",
15+
"id": "4c24762b-87df-4bd3-898a-bafed913a9ca"
16+
},
17+
"amount": {
18+
"centAmount": 1000,
19+
"currencyCode": "EUR"
20+
}
21+
}
22+
]
23+
}
Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
#%RAML 1.0 DataType
2+
(annotations.package): Application
3+
type: Reference
4+
displayName: ApplicationReference
5+
discriminatorValue: application
6+
description: |
7+
Reference to an [Application](/payment-connectors-applications#applications).
8+
properties:
9+
id:
10+
type: string
11+
description: |
12+
Unique identifier of the referenced Application.
Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
#%RAML 1.0 DataType
2+
(annotations.package): Application
3+
type: ResourceIdentifier
4+
displayName: ApplicationResourceIdentifier
5+
discriminatorValue: application
6+
description: |
7+
Resource identifier to an [Application](/payment-connectors-applications#applications). Either `id` or `key` is required. If both are set, an [InvalidJsonInput](/errors#invalidjsoninput) error is returned.
8+
properties:
9+
id?:
10+
type: string
11+
description: |
12+
Unique identifier of the referenced Application. Required if `key` is absent.
13+
key?:
14+
type: string
15+
description: |
16+
User-defined unique identifier of the referenced Application. Required if `id` is absent.
Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
#%RAML 1.0 DataType
2+
(annotations.package): Cart
3+
type: Reference
4+
displayName: CartReference
5+
discriminatorValue: cart
6+
description: |
7+
Reference to a [Cart](/../api/projects/carts).
8+
properties:
9+
id:
10+
type: string
11+
description: |
12+
Unique identifier of the referenced [Cart](/../api/projects/carts).
Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
#%RAML 1.0 DataType
2+
(annotations.package): Cart
3+
type: ResourceIdentifier
4+
displayName: CartResourceIdentifier
5+
discriminatorValue: cart
6+
description: |
7+
Resource identifier to a [Cart](/../api/projects/carts). Either `id` or `key` is required. If both are set, an [InvalidJsonInput](/errors#invalidjsoninput) error is returned.
8+
properties:
9+
id?:
10+
type: string
11+
description: |
12+
Unique identifier of the referenced [Cart](/../api/projects/carts). Required if `key` is absent.
13+
key?:
14+
type: string
15+
description: |
16+
User-defined unique identifier of the referenced [Cart](/../api/projects/carts). Required if `id` is absent.
Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
#%RAML 1.0 DataType
2+
(annotations.package): Cart
3+
type: Reference
4+
displayName: OrderReference
5+
discriminatorValue: order
6+
description: |
7+
Reference to an [Order](/../api/projects/orders).
8+
properties:
9+
id:
10+
type: string
11+
description: |
12+
Unique identifier of the referenced [Order](/../api/projects/orders).
Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
#%RAML 1.0 DataType
2+
(annotations.package): Order
3+
type: ResourceIdentifier
4+
displayName: OrderResourceIdentifier
5+
discriminatorValue: order
6+
description: |
7+
Resource identifier to an [Order](/../api/projects/orders). Either `id` or `key` is required. If both are set, an [InvalidJsonInput](/errors#invalidjsoninput) error is returned.
8+
properties:
9+
id?:
10+
type: string
11+
description: |
12+
Unique identifier of the referenced [Order](/../api/projects/orders). Required if `key` is absent.
13+
key?:
14+
type: string
15+
description: |
16+
User-defined unique identifier of the referenced [Order](/../api/projects/orders). Required if `id` is absent.
Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
#%RAML 1.0 DataType
2+
(annotations.package): Payment
3+
type: Reference
4+
displayName: PaymentReference
5+
discriminatorValue: payment
6+
description: |
7+
Reference to a [Payment](/../api/projects/payments).
8+
properties:
9+
id:
10+
type: string
11+
description: |
12+
Unique identifier of the referenced [Payment](/../api/projects/payments).

0 commit comments

Comments
 (0)