You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Updates the customer's cart. You can post customer information, redeem a discount code, or pass any other order fields here.
8
14
15
+
[//]: #(Note: Parameters are duplicated in frontend/tags/cart.md)
9
16
@blade
10
-
@include('markdown.api-endpoint', [
11
-
'method' => 'GET',
12
-
'path' => '/!/cargo/cart',
13
-
'description' => "Returns the customer's cart.",
14
-
])
15
-
16
-
@include('markdown.api-endpoint', [
17
-
'method' => 'POST',
18
-
'path' => '/!/cargo/cart',
19
-
'description' => "Updates the customer's cart. You can post customer information, redeem a discount code, or pass any other order fields here.",
20
-
'parameters' => [
17
+
<x-api-endpoint
18
+
method="POST"
19
+
path="/!/cargo/cart"
20
+
:parameters="[
21
21
[
22
22
'key' => 'customer',
23
23
'type' => 'array',
@@ -47,20 +47,26 @@ title: "JSON API: Endpoints"
47
47
['key' => 'billing_country', 'type' => 'string', 'description' => 'Must be in [ISO3](https://www.iso.org/obp/ui#iso:pub:PUB500001:en) format.'],
48
48
['key' => 'billing_state', 'type' => 'string', 'description' => 'Must match one of the states in [Cargo\'s `states.json` file](https://github.com/duncanmcclean/statamic-cargo/blob/main/resources/json/states.json).'],
49
49
['key' => '*', 'description' => 'Any other fields defined in your [order blueprint](/docs/orders#blueprint).'],
50
-
],
51
-
])
52
-
53
-
@include('markdown.api-endpoint', [
54
-
'method' => 'DELETE',
55
-
'path' => '/!/cargo/cart',
56
-
'description' => "Deletes the customer's cart.",
57
-
])
58
-
59
-
@include('markdown.api-endpoint', [
60
-
'method' => 'POST',
61
-
'path' => '/!/cargo/cart/line-items',
62
-
'description' => "Adds a line item to the customer's cart.",
['key' => '*', 'description' => 'Any other data you\'d like to persist on the line item.'],
105
-
],
106
-
])
107
-
108
-
@include('markdown.api-endpoint', [
109
-
'method' => 'DELETE',
110
-
'path' => '/!/cargo/cart/line-items/{lineItem}',
111
-
'description' => "Removes a line item from the customer's cart. The `{lineItem}` should be the ID of the line item you wish to remove.",
112
-
])
113
-
114
-
@include('markdown.api-endpoint', [
115
-
'method' => 'GET',
116
-
'path' => '/!/cargo/cart/shipping',
117
-
'description' => "Returns the available shipping options for the customer's cart. <br><br> When there's no address on the cart, this endpoint will return a 422 status code. When the customer doesn't have a cart, this endpoint will return a 404 status code.",
118
-
])
119
-
120
-
@include('markdown.api-endpoint', [
121
-
'method' => 'GET',
122
-
'path' => '/!/cargo/cart/payment-gateways',
123
-
'description' => "Returns the available payment gateways for the customer's cart, including the array returned by the payment gateway's `setup` method. <br><br> Payment Gateways will be returned *even* when the cart total is £0. In this case, no `setup` data will be returned. <br><br> When the customer doesn't have a cart, this endpoint will return a 404 status code.",
124
-
])
116
+
]"
117
+
/>
125
118
@endblade
126
119
127
-
## Checkout
120
+
## Remove a line item
121
+
Removes a line item from the customer's cart. The `{lineItem}` should be the ID of the line item you wish to remove.
128
122
129
123
@blade
130
-
@include('markdown.api-endpoint', [
131
-
'method' => 'GET & POST',
132
-
'path' => '/!/cargo/cart/checkout',
133
-
'description' => "When the cart total is equals to £0, you may use this endpoint to create an order without payment. <br><br> When successful, this endpoint will return a redirect response to the checkout confirmation page. <br><br> When the order requires payment, this endpoint will return a 404 status code.",
When the cart total is equals to £0, you may use this endpoint to create an order without payment.
149
+
150
+
When successful, this endpoint will return a redirect response to the checkout confirmation page.
151
+
152
+
When the order requires payment, this endpoint will report a `404` status code.
153
+
154
+
@blade
155
+
<x-api-endpoint
156
+
method="GET / POST"
157
+
path="/!/cargo/cart/checkout"
158
+
:parameters="[
135
159
['key' => 'discount_code', 'type' => 'string'],
136
-
],
137
-
])
138
-
139
-
@include('markdown.api-endpoint', [
140
-
'method' => 'GET & POST',
141
-
'path' => '/!/cargo/payments/{gateway}/checkout',
142
-
'description' => "When the order requires payment, you may use this endpoint to create the order. The `{gateway}` should be the handle of the payment gateway you wish to check out using. <br><br> When successful, this endpoint will return a redirect response to the checkout confirmation page. <br><br> When the order does not require payment, this endpoint will return a 404 status code.",
143
-
'parameters' => [
160
+
]"
161
+
/>
162
+
@endblade
163
+
164
+
## Checkout: Paid Order
165
+
When the order requires payment, you may use this endpoint to create the order. The `{gateway}` should be the handle of the payment gateway you wish to check out using.
166
+
167
+
When successful, this endpoint will return a redirect response to the checkout confirmation page.
168
+
169
+
When the order does not require payment, this endpoint will return a `404` status code.
170
+
171
+
@blade
172
+
<x-api-endpoint
173
+
method="GET / POST"
174
+
path="/!/cargo/cart/payments/{gateway}/checkout"
175
+
:parameters="[
144
176
['key' => 'discount_code', 'type' => 'string'],
145
-
],
146
-
])
177
+
]"
178
+
/>
147
179
@endblade
148
180
149
181
## States
182
+
Returns an array of states for a given country.
150
183
151
184
@blade
152
-
@include('markdown.api-endpoint', [
153
-
'method' => 'GET',
154
-
'path' => '/!/cargo/states',
155
-
'description' => "Returns an array of states for a given country.",
156
-
'parameters' => [
185
+
<x-api-endpoint
186
+
method="GET"
187
+
path="/!/cargo/states"
188
+
:parameters="[
157
189
['key' => 'country', 'type' => 'string', 'required' => true, 'description' => 'Must be in [ISO3](https://www.iso.org/obp/ui#iso:pub:PUB500001:en) format.'],
0 commit comments