fluentcart-developer 1.1.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/.gitattributes +2 -0
- package/CLAUDE.md +22 -0
- package/CONTRIBUTING.md +73 -0
- package/LICENSE +21 -0
- package/README.md +127 -0
- package/SKILL.md +127 -0
- package/bin/index.js +281 -0
- package/copy-skills.js +43 -0
- package/package.json +38 -0
- package/skills/fluentcart-developer/SKILL.md +172 -0
- package/skills/fluentcart-developer/examples/README.md +25 -0
- package/skills/fluentcart-developer/examples/fluentcart-starter-child-theme/fluent-cart/checkout.php +32 -0
- package/skills/fluentcart-developer/examples/fluentcart-starter-child-theme/functions.php +40 -0
- package/skills/fluentcart-developer/examples/sample-custom-addon/fluentcart-custom-addon.php +114 -0
- package/skills/fluentcart-developer/examples/sample-custom-payment-gateway/fluentcart-custom-gateway-example.php +149 -0
- package/skills/fluentcart-developer/examples/sample-fee-surcharge-plugin/fluentcart-fee-surcharge.php +38 -0
- package/skills/fluentcart-developer/examples/sample-shipping-carrier/fluentcart-custom-shipping-carrier.php +62 -0
- package/skills/fluentcart-developer/references/action-hooks-admin-templates.md +787 -0
- package/skills/fluentcart-developer/references/action-hooks-cart-checkout.md +1355 -0
- package/skills/fluentcart-developer/references/action-hooks-customers-users.md +266 -0
- package/skills/fluentcart-developer/references/action-hooks-licenses.md +855 -0
- package/skills/fluentcart-developer/references/action-hooks-orders.md +631 -0
- package/skills/fluentcart-developer/references/action-hooks-payments-integrations.md +963 -0
- package/skills/fluentcart-developer/references/action-hooks-products-coupons.md +585 -0
- package/skills/fluentcart-developer/references/action-hooks-subscriptions.md +661 -0
- package/skills/fluentcart-developer/references/database-models-query-builder.md +194 -0
- package/skills/fluentcart-developer/references/database-models-reference.md +604 -0
- package/skills/fluentcart-developer/references/database-schema-reference.md +940 -0
- package/skills/fluentcart-developer/references/engineering-notes.md +154 -0
- package/skills/fluentcart-developer/references/fee-system-guide.md +449 -0
- package/skills/fluentcart-developer/references/filter-hooks-cart-checkout.md +1202 -0
- package/skills/fluentcart-developer/references/filter-hooks-customers-subscriptions.md +902 -0
- package/skills/fluentcart-developer/references/filter-hooks-integrations-advanced.md +1598 -0
- package/skills/fluentcart-developer/references/filter-hooks-orders-payments.md +1319 -0
- package/skills/fluentcart-developer/references/filter-hooks-products-pricing.md +628 -0
- package/skills/fluentcart-developer/references/filter-hooks-settings-configuration.md +1177 -0
- package/skills/fluentcart-developer/references/fluentcart-developer-guide.md +154 -0
- package/skills/fluentcart-developer/references/ghost-product-selling.md +458 -0
- package/skills/fluentcart-developer/references/modules-and-extensions-reference.md +224 -0
- package/skills/fluentcart-developer/references/paddle-gateway-case-study.md +1925 -0
- package/skills/fluentcart-developer/references/payment-gateway-integration.md +761 -0
- package/skills/fluentcart-developer/references/rest-api-checkout.md +286 -0
- package/skills/fluentcart-developer/references/rest-api-coupons.md +794 -0
- package/skills/fluentcart-developer/references/rest-api-customer-profile.md +190 -0
- package/skills/fluentcart-developer/references/rest-api-customers.md +1121 -0
- package/skills/fluentcart-developer/references/rest-api-dashboard-utilities.md +219 -0
- package/skills/fluentcart-developer/references/rest-api-email-notifications.md +619 -0
- package/skills/fluentcart-developer/references/rest-api-files.md +290 -0
- package/skills/fluentcart-developer/references/rest-api-integrations.md +324 -0
- package/skills/fluentcart-developer/references/rest-api-labels-attributes.md +321 -0
- package/skills/fluentcart-developer/references/rest-api-licensing.md +171 -0
- package/skills/fluentcart-developer/references/rest-api-order-bumps.md +200 -0
- package/skills/fluentcart-developer/references/rest-api-orders.md +1241 -0
- package/skills/fluentcart-developer/references/rest-api-overview.md +131 -0
- package/skills/fluentcart-developer/references/rest-api-products.md +2563 -0
- package/skills/fluentcart-developer/references/rest-api-public-shop.md +172 -0
- package/skills/fluentcart-developer/references/rest-api-reference.md +552 -0
- package/skills/fluentcart-developer/references/rest-api-reports.md +377 -0
- package/skills/fluentcart-developer/references/rest-api-roles-permissions.md +147 -0
- package/skills/fluentcart-developer/references/rest-api-settings.md +528 -0
- package/skills/fluentcart-developer/references/rest-api-shipping.md +800 -0
- package/skills/fluentcart-developer/references/rest-api-subscriptions.md +606 -0
- package/skills/fluentcart-developer/references/rest-api-tax.md +356 -0
- package/skills/fluentcart-developer/references/subscription-customization.md +197 -0
- package/skills/fluentcart-developer/scripts/cli.js +1 -0
- package/skills.sh.json +13 -0
|
@@ -0,0 +1,1241 @@
|
|
|
1
|
+
# Orders API
|
|
2
|
+
|
|
3
|
+
Manage customer orders including creation, updates, payments, refunds, shipping, and status management.
|
|
4
|
+
|
|
5
|
+
**Base URL:** `https://your-site.com/wp-json/fluent-cart/v2/orders`
|
|
6
|
+
|
|
7
|
+
**Policy:** `OrderPolicy`
|
|
8
|
+
|
|
9
|
+
> All monetary values are in cents (e.g., `$10.00` = `1000`).
|
|
10
|
+
|
|
11
|
+
---
|
|
12
|
+
|
|
13
|
+
## Endpoints Overview
|
|
14
|
+
|
|
15
|
+
| Method | Endpoint | Description |
|
|
16
|
+
|--------|----------|-------------|
|
|
17
|
+
| GET | `/orders` | List Orders |
|
|
18
|
+
| GET | `/orders/{order_id}` | Get Order Details |
|
|
19
|
+
| POST | `/orders` | Create Order |
|
|
20
|
+
| POST | `/orders/{order_id}` | Update Order |
|
|
21
|
+
| DELETE | `/orders/{order_id}` | Delete Order |
|
|
22
|
+
| POST | `/orders/{order}/mark-as-paid` | Mark Order as Paid |
|
|
23
|
+
| POST | `/orders/{order_id}/refund` | Refund Order |
|
|
24
|
+
| POST | `/orders/{order}/transactions/{transaction_id}/accept-dispute/` | Accept Dispute |
|
|
25
|
+
| PUT | `/orders/{order}/address/{id}` | Update Order Address |
|
|
26
|
+
| POST | `/orders/{order_id}/update-address-id` | Update Order Address ID |
|
|
27
|
+
| POST | `/orders/{order_id}/change-customer` | Change Customer |
|
|
28
|
+
| POST | `/orders/{order_id}/create-and-change-customer` | Create and Change Customer |
|
|
29
|
+
| GET | `/orders/{order}/transactions` | Get Order Transactions |
|
|
30
|
+
| GET | `/orders/{id}/transactions/{transaction_id}` | Get Single Transaction |
|
|
31
|
+
| PUT | `/orders/{order}/transactions/{transaction}/status` | Update Transaction Status |
|
|
32
|
+
| POST | `/orders/{order}/create-custom` | Create Custom Order Item |
|
|
33
|
+
| PUT | `/orders/{order}/statuses` | Update Statuses |
|
|
34
|
+
| PUT | `/orders/{order}/sync-statuses` | Sync Order Statuses |
|
|
35
|
+
| GET | `/orders/shipping_methods` | Get Shipping Methods |
|
|
36
|
+
| POST | `/orders/calculate-shipping` | Calculate Shipping |
|
|
37
|
+
| POST | `/orders/{order}/generate-missing-licenses` | Generate Missing Licenses |
|
|
38
|
+
| POST | `/orders/do-bulk-action` | Bulk Actions |
|
|
39
|
+
|
|
40
|
+
---
|
|
41
|
+
|
|
42
|
+
## List Orders
|
|
43
|
+
|
|
44
|
+
`GET /fluent-cart/v2/orders`
|
|
45
|
+
|
|
46
|
+
Retrieve a paginated list of orders with optional filtering, sorting, and search.
|
|
47
|
+
|
|
48
|
+
**Permission:** `orders/view`
|
|
49
|
+
|
|
50
|
+
### Parameters
|
|
51
|
+
|
|
52
|
+
| Parameter | Type | Location | Required | Description |
|
|
53
|
+
|-----------|------|----------|----------|-------------|
|
|
54
|
+
| `page` | integer | query | No | Page number for pagination |
|
|
55
|
+
| `per_page` | integer | query | No | Number of records per page (default: 10, max: 200) |
|
|
56
|
+
| `search` | string | query | No | Search term. Searches invoice number, customer name/email, and order item titles. Also supports operator syntax (e.g., `status = completed`, `id > 5`, `id :: 1-10`) |
|
|
57
|
+
| `sort_by` | string | query | No | Column to sort by (default: `id`). Must be a fillable column on the Order model |
|
|
58
|
+
| `sort_type` | string | query | No | Sort direction: `asc` or `desc` (default: `desc`) |
|
|
59
|
+
| `active_view` | string | query | No | Tab filter. One of: `on-hold`, `paid`, `completed`, `processing`, `renewal`, `subscription`, `onetime`, `refunded`, `partially_refunded`, `upgraded_to`, `upgraded_from` |
|
|
60
|
+
| `filter_type` | string | query | No | Filter mode: `simple` (default) or `advanced` |
|
|
61
|
+
| `advanced_filters` | string (JSON) | query | No | JSON-encoded array of advanced filter groups (requires Pro). Supports filtering by order properties, customer properties, transaction properties, license properties, and UTM properties |
|
|
62
|
+
| `with` | array/string | query | No | Eager-load relations. Supports relation names and `{relation}Count` for counts |
|
|
63
|
+
| `select` | array/string | query | No | Comma-separated list of columns to select |
|
|
64
|
+
| `scopes` | array | query | No | Model scopes to apply |
|
|
65
|
+
| `include_ids` | array/string | query | No | Comma-separated IDs that must always be included in results |
|
|
66
|
+
| `limit` | integer | query | No | Limit number of records (used with non-paginated queries) |
|
|
67
|
+
| `offset` | integer | query | No | Offset for records |
|
|
68
|
+
| `user_tz` | string | query | No | User timezone for date filtering (e.g., `America/New_York`) |
|
|
69
|
+
| `payment_statuses` | array | query | No | Filter by payment statuses |
|
|
70
|
+
| `order_statuses` | array | query | No | Filter by order statuses |
|
|
71
|
+
| `shipping_statuses` | array | query | No | Filter by shipping statuses |
|
|
72
|
+
|
|
73
|
+
### Searchable Fields (Operator Syntax)
|
|
74
|
+
|
|
75
|
+
The `search` parameter supports operator syntax like `field = value`, `field > value`, or `field :: range`:
|
|
76
|
+
|
|
77
|
+
| Field | Column | Type | Examples |
|
|
78
|
+
|-------|--------|------|----------|
|
|
79
|
+
| `id` | `id` | numeric | `id = 1`, `id > 5`, `id :: 1-10` |
|
|
80
|
+
| `status` | `status` | string | `status = completed` |
|
|
81
|
+
| `invoice` | `status` | string | Invoice number search |
|
|
82
|
+
| `payment` | `payment_status` | string | `payment = paid`, `payment = partially_refunded` |
|
|
83
|
+
| `payment_by` | `payment_method` | string | `payment_by = stripe`, `payment_by = paypal` |
|
|
84
|
+
| `customer` | (custom) | custom | `customer = john` (searches name and email) |
|
|
85
|
+
| `license` | (custom) | custom | `license = ff-78d47b3fed89bda25cdc5b60d0298d60` (Pro only) |
|
|
86
|
+
|
|
87
|
+
### Response
|
|
88
|
+
|
|
89
|
+
```json
|
|
90
|
+
{
|
|
91
|
+
"orders": {
|
|
92
|
+
"current_page": 1,
|
|
93
|
+
"data": [
|
|
94
|
+
{
|
|
95
|
+
"id": 1,
|
|
96
|
+
"uuid": "abc123-def456",
|
|
97
|
+
"invoice_no": "INV-001",
|
|
98
|
+
"status": "completed",
|
|
99
|
+
"payment_status": "paid",
|
|
100
|
+
"payment_method": "stripe",
|
|
101
|
+
"type": "payment",
|
|
102
|
+
"fulfillment_type": "digital",
|
|
103
|
+
"currency": "USD",
|
|
104
|
+
"subtotal": 5000,
|
|
105
|
+
"total_amount": 5000,
|
|
106
|
+
"total_paid": 5000,
|
|
107
|
+
"total_refund": 0,
|
|
108
|
+
"shipping_total": 0,
|
|
109
|
+
"tax_total": 0,
|
|
110
|
+
"manual_discount_total": 0,
|
|
111
|
+
"coupon_discount_total": 0,
|
|
112
|
+
"customer_id": 1,
|
|
113
|
+
"customer": { ... },
|
|
114
|
+
"created_at": "2025-01-15 10:30:00",
|
|
115
|
+
"updated_at": "2025-01-15 10:35:00"
|
|
116
|
+
}
|
|
117
|
+
],
|
|
118
|
+
"per_page": 10,
|
|
119
|
+
"total": 100,
|
|
120
|
+
"last_page": 10
|
|
121
|
+
}
|
|
122
|
+
}
|
|
123
|
+
```
|
|
124
|
+
|
|
125
|
+
### Example
|
|
126
|
+
|
|
127
|
+
```bash
|
|
128
|
+
curl -X GET "https://example.com/wp-json/fluent-cart/v2/orders?page=1&per_page=10&sort_by=id&sort_type=desc" \
|
|
129
|
+
-u "username:app_password"
|
|
130
|
+
```
|
|
131
|
+
|
|
132
|
+
---
|
|
133
|
+
|
|
134
|
+
## Calculate Shipping
|
|
135
|
+
|
|
136
|
+
`POST /fluent-cart/v2/orders/calculate-shipping`
|
|
137
|
+
|
|
138
|
+
Calculate shipping charges for order items with a specific shipping method.
|
|
139
|
+
|
|
140
|
+
**Permission:** `orders/create` or `orders/manage`
|
|
141
|
+
|
|
142
|
+
### Parameters
|
|
143
|
+
|
|
144
|
+
| Parameter | Type | Location | Required | Description |
|
|
145
|
+
|-----------|------|----------|----------|-------------|
|
|
146
|
+
| `order_items` | array | body | Yes | Array of order items, each with `id` (variation ID) and `quantity` |
|
|
147
|
+
| `shipping_id` | integer | body | Yes | ID of the shipping method to calculate charges for |
|
|
148
|
+
|
|
149
|
+
### Response
|
|
150
|
+
|
|
151
|
+
```json
|
|
152
|
+
{
|
|
153
|
+
"message": "Shipping updated",
|
|
154
|
+
"shipping_charge": 500,
|
|
155
|
+
"order_items": {
|
|
156
|
+
"1": {
|
|
157
|
+
"id": 1,
|
|
158
|
+
"quantity": 2,
|
|
159
|
+
"shipping_charge": 500,
|
|
160
|
+
"unit_price": 2500,
|
|
161
|
+
"other_info": {},
|
|
162
|
+
"discount_total": 0,
|
|
163
|
+
"fulfillment_type": "physical"
|
|
164
|
+
}
|
|
165
|
+
}
|
|
166
|
+
}
|
|
167
|
+
```
|
|
168
|
+
|
|
169
|
+
### Example
|
|
170
|
+
|
|
171
|
+
```bash
|
|
172
|
+
curl -X POST "https://example.com/wp-json/fluent-cart/v2/orders/calculate-shipping" \
|
|
173
|
+
-u "username:app_password" \
|
|
174
|
+
-H "Content-Type: application/json" \
|
|
175
|
+
-d '{
|
|
176
|
+
"order_items": [{"id": 1, "quantity": 2}],
|
|
177
|
+
"shipping_id": 5
|
|
178
|
+
}'
|
|
179
|
+
```
|
|
180
|
+
|
|
181
|
+
---
|
|
182
|
+
|
|
183
|
+
## Create Order
|
|
184
|
+
|
|
185
|
+
`POST /fluent-cart/v2/orders`
|
|
186
|
+
|
|
187
|
+
Create a new order manually from the admin panel.
|
|
188
|
+
|
|
189
|
+
**Permission:** `orders/create`
|
|
190
|
+
|
|
191
|
+
**Request Class:** `OrderRequest`
|
|
192
|
+
|
|
193
|
+
### Parameters
|
|
194
|
+
|
|
195
|
+
| Parameter | Type | Location | Required | Description |
|
|
196
|
+
|-----------|------|----------|----------|-------------|
|
|
197
|
+
| `customer_id` | integer | body | Yes | ID of the customer placing the order |
|
|
198
|
+
| `order_items` | array | body | Yes | Array of order items (see Order Items below) |
|
|
199
|
+
| `status` | string | body | No | Order status (max 50 chars) |
|
|
200
|
+
| `invoice_no` | string | body | No | Invoice number (max 100 chars) |
|
|
201
|
+
| `fulfillment_type` | string | body | No | Fulfillment type (max 50 chars) |
|
|
202
|
+
| `type` | string | body | No | Order type (max 50 chars) |
|
|
203
|
+
| `payment_method` | string | body | No | Payment method key (max 50 chars) |
|
|
204
|
+
| `payment_method_title` | string | body | No | Payment method display title (max 50 chars) |
|
|
205
|
+
| `payment_status` | string | body | No | Payment status (max 50 chars) |
|
|
206
|
+
| `currency` | string | body | No | Currency code, e.g., `USD` (max 10 chars) |
|
|
207
|
+
| `subtotal` | numeric | body | No | Order subtotal in cents |
|
|
208
|
+
| `discount_tax` | numeric | body | No | Discount tax amount in cents |
|
|
209
|
+
| `manual_discount_total` | numeric | body | No | Manual discount total in cents |
|
|
210
|
+
| `coupon_discount_total` | numeric | body | No | Coupon discount total in cents |
|
|
211
|
+
| `shipping_tax` | numeric | body | No | Shipping tax in cents |
|
|
212
|
+
| `shipping_total` | numeric | body | No | Shipping total in cents |
|
|
213
|
+
| `tax_total` | numeric | body | No | Tax total in cents |
|
|
214
|
+
| `total_amount` | numeric | body | No | Total order amount in cents |
|
|
215
|
+
| `rate` | numeric | body | No | Exchange rate |
|
|
216
|
+
| `note` | string | body | No | Order note (max 5000 chars) |
|
|
217
|
+
| `uuid` | string | body | No | Order UUID (max 100 chars) |
|
|
218
|
+
| `ip_address` | string | body | No | Customer IP address (max 100 chars) |
|
|
219
|
+
| `completed_at` | string | body | No | Completion timestamp (max 100 chars) |
|
|
220
|
+
| `refunded_at` | string | body | No | Refund timestamp (max 100 chars) |
|
|
221
|
+
| `user_tz` | string | body | No | User timezone (max 50 chars) |
|
|
222
|
+
| `discount` | object | body | No | Manual discount details |
|
|
223
|
+
| `shipping` | array | body | No | Shipping method details |
|
|
224
|
+
| `applied_coupon` | array | body | No | Applied coupon details |
|
|
225
|
+
| `trigger` | string | body | No | Trigger source |
|
|
226
|
+
|
|
227
|
+
### Order Items Object
|
|
228
|
+
|
|
229
|
+
| Field | Type | Required | Description |
|
|
230
|
+
|-------|------|----------|-------------|
|
|
231
|
+
| `id` | integer | No | Order item ID (for updates) |
|
|
232
|
+
| `order_id` | integer | No | Parent order ID |
|
|
233
|
+
| `post_id` | integer | No | WordPress post ID of the product |
|
|
234
|
+
| `variation_id` | integer | No | Product variation ID |
|
|
235
|
+
| `object_id` | integer | No | Object reference ID |
|
|
236
|
+
| `fulfillment_type` | string | No | `digital` or `physical` |
|
|
237
|
+
| `payment_type` | string | No | Payment type (max 100 chars), e.g., `subscription` |
|
|
238
|
+
| `quantity` | integer | No | Item quantity (min: 1) |
|
|
239
|
+
| `post_title` | string | No | Product title (max 255 chars) |
|
|
240
|
+
| `title` | string | No | Item title (max 255 chars) |
|
|
241
|
+
| `price` | numeric | No | Item price in cents |
|
|
242
|
+
| `unit_price` | numeric | No | Unit price in cents |
|
|
243
|
+
| `shipping_charge` | numeric | No | Shipping charge in cents |
|
|
244
|
+
| `item_cost` | numeric | No | Item cost in cents |
|
|
245
|
+
| `item_total` | numeric | No | Item total in cents |
|
|
246
|
+
| `tax_amount` | numeric | No | Tax amount in cents |
|
|
247
|
+
| `discount_total` | numeric | No | Discount total in cents |
|
|
248
|
+
| `total` | numeric | No | Total in cents |
|
|
249
|
+
| `line_total` | numeric | No | Line total in cents |
|
|
250
|
+
| `cart_index` | integer | No | Cart position index |
|
|
251
|
+
| `rate` | numeric | No | Exchange rate |
|
|
252
|
+
| `line_meta` | array | No | Line item metadata |
|
|
253
|
+
| `other_info` | array | No | Additional item information |
|
|
254
|
+
|
|
255
|
+
### Discount Object
|
|
256
|
+
|
|
257
|
+
| Field | Type | Required | Description |
|
|
258
|
+
|-------|------|----------|-------------|
|
|
259
|
+
| `type` | string | No | Discount type (max 100 chars) |
|
|
260
|
+
| `value` | numeric | No | Discount value |
|
|
261
|
+
| `label` | string | No | Discount label (max 100 chars) |
|
|
262
|
+
| `reason` | string | No | Discount reason (max 100 chars) |
|
|
263
|
+
| `action` | string | No | Discount action (max 100 chars) |
|
|
264
|
+
|
|
265
|
+
### Shipping Object (array)
|
|
266
|
+
|
|
267
|
+
| Field | Type | Required | Description |
|
|
268
|
+
|-------|------|----------|-------------|
|
|
269
|
+
| `type` | string | No | Shipping type (max 100 chars) |
|
|
270
|
+
| `rate_name` | string | No | Shipping rate name (max 100 chars) |
|
|
271
|
+
| `custom_price` | numeric | No | Custom shipping price in cents |
|
|
272
|
+
|
|
273
|
+
### Applied Coupon Object (array)
|
|
274
|
+
|
|
275
|
+
| Field | Type | Required | Description |
|
|
276
|
+
|-------|------|----------|-------------|
|
|
277
|
+
| `id` | integer | No | Applied coupon record ID |
|
|
278
|
+
| `order_id` | integer | No | Order ID |
|
|
279
|
+
| `coupon_id` | integer | Yes | Coupon ID (min: 1) |
|
|
280
|
+
| `code` | string | Yes | Coupon code (max 100 chars) |
|
|
281
|
+
| `amount` | numeric | No | Coupon amount |
|
|
282
|
+
| `discounted_amount` | numeric | Yes | Discounted amount in cents |
|
|
283
|
+
| `discount` | numeric | No | Discount value |
|
|
284
|
+
| `stackable` | integer | Yes | Whether coupon is stackable (0 or 1) |
|
|
285
|
+
| `priority` | integer | No | Coupon priority |
|
|
286
|
+
| `max_uses` | integer | No | Maximum uses |
|
|
287
|
+
| `use_count` | integer | No | Current use count |
|
|
288
|
+
| `max_per_customer` | integer | No | Max uses per customer (min: 1) |
|
|
289
|
+
| `min_purchase_amount` | numeric | No | Minimum purchase amount in cents |
|
|
290
|
+
| `max_discount_amount` | numeric | No | Maximum discount amount in cents |
|
|
291
|
+
| `notes` | string | No | Coupon notes (max 100 chars) |
|
|
292
|
+
|
|
293
|
+
### Response
|
|
294
|
+
|
|
295
|
+
```json
|
|
296
|
+
{
|
|
297
|
+
"message": "Order created successfully!",
|
|
298
|
+
"order_id": 42,
|
|
299
|
+
"uuid": "abc123-def456-ghi789"
|
|
300
|
+
}
|
|
301
|
+
```
|
|
302
|
+
|
|
303
|
+
### Example
|
|
304
|
+
|
|
305
|
+
```bash
|
|
306
|
+
curl -X POST "https://example.com/wp-json/fluent-cart/v2/orders" \
|
|
307
|
+
-u "username:app_password" \
|
|
308
|
+
-H "Content-Type: application/json" \
|
|
309
|
+
-d '{
|
|
310
|
+
"customer_id": 1,
|
|
311
|
+
"order_items": [
|
|
312
|
+
{
|
|
313
|
+
"post_id": 10,
|
|
314
|
+
"variation_id": 5,
|
|
315
|
+
"object_id": 5,
|
|
316
|
+
"quantity": 1,
|
|
317
|
+
"unit_price": 2500,
|
|
318
|
+
"price": 2500,
|
|
319
|
+
"item_total": 2500,
|
|
320
|
+
"total": 2500,
|
|
321
|
+
"line_total": 2500,
|
|
322
|
+
"title": "Pro License"
|
|
323
|
+
}
|
|
324
|
+
],
|
|
325
|
+
"subtotal": 2500,
|
|
326
|
+
"total_amount": 2500,
|
|
327
|
+
"payment_method": "offline_payment"
|
|
328
|
+
}'
|
|
329
|
+
```
|
|
330
|
+
|
|
331
|
+
---
|
|
332
|
+
|
|
333
|
+
## Bulk Actions
|
|
334
|
+
|
|
335
|
+
`POST /fluent-cart/v2/orders/do-bulk-action`
|
|
336
|
+
|
|
337
|
+
Perform bulk actions on multiple orders at once.
|
|
338
|
+
|
|
339
|
+
**Permission:** `orders/manage`
|
|
340
|
+
|
|
341
|
+
### Parameters
|
|
342
|
+
|
|
343
|
+
| Parameter | Type | Location | Required | Description |
|
|
344
|
+
|-----------|------|----------|----------|-------------|
|
|
345
|
+
| `action` | string | body | Yes | Bulk action to perform. One of: `delete_orders`, `change_shipping_status`, `change_order_status`, `capture_payments`, `change_payment_status` |
|
|
346
|
+
| `order_ids` | array | body | Yes | Array of order IDs to act upon |
|
|
347
|
+
| `new_status` | string | body | Conditional | New status value. Required for `change_shipping_status`, `change_order_status`, and `change_payment_status` actions |
|
|
348
|
+
| `manage_stock` | string | body | No | Whether to manage stock on status change (`true`/`false`) |
|
|
349
|
+
|
|
350
|
+
### Supported Actions
|
|
351
|
+
|
|
352
|
+
| Action | Description | Valid `new_status` Values |
|
|
353
|
+
|--------|-------------|--------------------------|
|
|
354
|
+
| `delete_orders` | Delete selected orders and related data | N/A |
|
|
355
|
+
| `change_shipping_status` | Update shipping status | Valid shipping statuses (e.g., `shipped`, `delivered`) |
|
|
356
|
+
| `change_order_status` | Update order status | `completed`, `processing`, `on-hold`, `canceled` |
|
|
357
|
+
| `capture_payments` | Capture authorized payments | N/A |
|
|
358
|
+
| `change_payment_status` | Update payment status | Valid transaction statuses |
|
|
359
|
+
|
|
360
|
+
### Response
|
|
361
|
+
|
|
362
|
+
```json
|
|
363
|
+
{
|
|
364
|
+
"message": "Order Status has been changed for the selected orders"
|
|
365
|
+
}
|
|
366
|
+
```
|
|
367
|
+
|
|
368
|
+
### Example
|
|
369
|
+
|
|
370
|
+
```bash
|
|
371
|
+
curl -X POST "https://example.com/wp-json/fluent-cart/v2/orders/do-bulk-action" \
|
|
372
|
+
-u "username:app_password" \
|
|
373
|
+
-H "Content-Type: application/json" \
|
|
374
|
+
-d '{
|
|
375
|
+
"action": "change_order_status",
|
|
376
|
+
"order_ids": [1, 2, 3],
|
|
377
|
+
"new_status": "processing"
|
|
378
|
+
}'
|
|
379
|
+
```
|
|
380
|
+
|
|
381
|
+
---
|
|
382
|
+
|
|
383
|
+
## Mark Order as Paid
|
|
384
|
+
|
|
385
|
+
`POST /fluent-cart/v2/orders/{order}/mark-as-paid`
|
|
386
|
+
|
|
387
|
+
Mark a pending order as paid, creating or updating the transaction record.
|
|
388
|
+
|
|
389
|
+
**Permission:** `orders/manage`
|
|
390
|
+
|
|
391
|
+
### Parameters
|
|
392
|
+
|
|
393
|
+
| Parameter | Type | Location | Required | Description |
|
|
394
|
+
|-----------|------|----------|----------|-------------|
|
|
395
|
+
| `order` | integer | path | Yes | Order ID |
|
|
396
|
+
| `payment_method` | string | body | No | Payment method used (e.g., `offline_payment`, `stripe`) |
|
|
397
|
+
| `vendor_charge_id` | string | body | No | External payment reference/charge ID |
|
|
398
|
+
| `transaction_type` | string | body | No | Transaction type identifier |
|
|
399
|
+
| `mark_paid_note` | string | body | No | Note to attach to the order |
|
|
400
|
+
|
|
401
|
+
### Response
|
|
402
|
+
|
|
403
|
+
```json
|
|
404
|
+
{
|
|
405
|
+
"message": "Order has been marked as paid"
|
|
406
|
+
}
|
|
407
|
+
```
|
|
408
|
+
|
|
409
|
+
### Error Responses
|
|
410
|
+
|
|
411
|
+
| Status | Message |
|
|
412
|
+
|--------|---------|
|
|
413
|
+
| 423 | Order has already been paid |
|
|
414
|
+
| 423 | Unable to mark paid for canceled order |
|
|
415
|
+
|
|
416
|
+
### Example
|
|
417
|
+
|
|
418
|
+
```bash
|
|
419
|
+
curl -X POST "https://example.com/wp-json/fluent-cart/v2/orders/42/mark-as-paid" \
|
|
420
|
+
-u "username:app_password" \
|
|
421
|
+
-H "Content-Type: application/json" \
|
|
422
|
+
-d '{
|
|
423
|
+
"payment_method": "offline_payment",
|
|
424
|
+
"vendor_charge_id": "CHK-12345",
|
|
425
|
+
"mark_paid_note": "Payment received via bank transfer"
|
|
426
|
+
}'
|
|
427
|
+
```
|
|
428
|
+
|
|
429
|
+
---
|
|
430
|
+
|
|
431
|
+
## Generate Missing Licenses
|
|
432
|
+
|
|
433
|
+
`POST /fluent-cart/v2/orders/{order}/generate-missing-licenses`
|
|
434
|
+
|
|
435
|
+
Generate any missing license keys for an order's items (requires Pro with licensing module).
|
|
436
|
+
|
|
437
|
+
**Permission:** `orders/manage`
|
|
438
|
+
|
|
439
|
+
### Parameters
|
|
440
|
+
|
|
441
|
+
| Parameter | Type | Location | Required | Description |
|
|
442
|
+
|-----------|------|----------|----------|-------------|
|
|
443
|
+
| `order` | integer | path | Yes | Order ID |
|
|
444
|
+
|
|
445
|
+
### Error Responses
|
|
446
|
+
|
|
447
|
+
| Status | Message |
|
|
448
|
+
|--------|---------|
|
|
449
|
+
| 404 | Order not found |
|
|
450
|
+
| 400 | No missing licenses found! |
|
|
451
|
+
|
|
452
|
+
### Example
|
|
453
|
+
|
|
454
|
+
```bash
|
|
455
|
+
curl -X POST "https://example.com/wp-json/fluent-cart/v2/orders/42/generate-missing-licenses" \
|
|
456
|
+
-u "username:app_password"
|
|
457
|
+
```
|
|
458
|
+
|
|
459
|
+
---
|
|
460
|
+
|
|
461
|
+
## Get Order Details
|
|
462
|
+
|
|
463
|
+
`GET /fluent-cart/v2/orders/{order_id}`
|
|
464
|
+
|
|
465
|
+
Retrieve detailed information about a specific order, including items, transactions, addresses, subscriptions, and activities.
|
|
466
|
+
|
|
467
|
+
**Permission:** `orders/view`
|
|
468
|
+
|
|
469
|
+
### Parameters
|
|
470
|
+
|
|
471
|
+
| Parameter | Type | Location | Required | Description |
|
|
472
|
+
|-----------|------|----------|----------|-------------|
|
|
473
|
+
| `order_id` | integer | path | Yes | Order ID |
|
|
474
|
+
|
|
475
|
+
### Response
|
|
476
|
+
|
|
477
|
+
```json
|
|
478
|
+
{
|
|
479
|
+
"order": {
|
|
480
|
+
"id": 42,
|
|
481
|
+
"uuid": "abc123-def456",
|
|
482
|
+
"invoice_no": "INV-042",
|
|
483
|
+
"status": "completed",
|
|
484
|
+
"payment_status": "paid",
|
|
485
|
+
"payment_method": "stripe",
|
|
486
|
+
"type": "payment",
|
|
487
|
+
"fulfillment_type": "digital",
|
|
488
|
+
"currency": "USD",
|
|
489
|
+
"subtotal": 5000,
|
|
490
|
+
"total_amount": 5000,
|
|
491
|
+
"total_paid": 5000,
|
|
492
|
+
"total_refund": 0,
|
|
493
|
+
"shipping_total": 0,
|
|
494
|
+
"tax_total": 0,
|
|
495
|
+
"manual_discount_total": 0,
|
|
496
|
+
"coupon_discount_total": 0,
|
|
497
|
+
"customer_id": 1,
|
|
498
|
+
"customer": { ... },
|
|
499
|
+
"order_items": [ ... ],
|
|
500
|
+
"transactions": [ ... ],
|
|
501
|
+
"billing_address": { ... },
|
|
502
|
+
"shipping_address": { ... },
|
|
503
|
+
"subscriptions": [ ... ],
|
|
504
|
+
"activities": [ ... ],
|
|
505
|
+
"labels": [ ... ],
|
|
506
|
+
"applied_coupons": [ ... ],
|
|
507
|
+
"children": [ ... ],
|
|
508
|
+
"parent_order": null,
|
|
509
|
+
"order_operation": { ... },
|
|
510
|
+
"receipt_url": "https://example.com/receipt/?order_hash=abc123",
|
|
511
|
+
"custom_checkout_url": "https://example.com/checkout/?payment_hash=...",
|
|
512
|
+
"has_missing_licenses": false,
|
|
513
|
+
"created_at": "2025-01-15 10:30:00",
|
|
514
|
+
"updated_at": "2025-01-15 10:35:00"
|
|
515
|
+
},
|
|
516
|
+
"discount_meta": { ... },
|
|
517
|
+
"shipping_meta": { ... },
|
|
518
|
+
"order_settings": {},
|
|
519
|
+
"selected_labels": [1, 2],
|
|
520
|
+
"tax_id": null
|
|
521
|
+
}
|
|
522
|
+
```
|
|
523
|
+
|
|
524
|
+
### Example
|
|
525
|
+
|
|
526
|
+
```bash
|
|
527
|
+
curl -X GET "https://example.com/wp-json/fluent-cart/v2/orders/42" \
|
|
528
|
+
-u "username:app_password"
|
|
529
|
+
```
|
|
530
|
+
|
|
531
|
+
---
|
|
532
|
+
|
|
533
|
+
## Update Order
|
|
534
|
+
|
|
535
|
+
`POST /fluent-cart/v2/orders/{order_id}`
|
|
536
|
+
|
|
537
|
+
Update an existing order's details, items, discounts, shipping, and coupons. Subscription orders cannot be edited.
|
|
538
|
+
|
|
539
|
+
**Permission:** `orders/manage`
|
|
540
|
+
|
|
541
|
+
**Request Class:** `OrderRequest`
|
|
542
|
+
|
|
543
|
+
### Parameters
|
|
544
|
+
|
|
545
|
+
| Parameter | Type | Location | Required | Description |
|
|
546
|
+
|-----------|------|----------|----------|-------------|
|
|
547
|
+
| `order_id` | integer | path | Yes | Order ID |
|
|
548
|
+
| `customer_id` | integer | body | Yes | Customer ID |
|
|
549
|
+
| `order_items` | array | body | Yes | Updated array of order items (same structure as Create Order) |
|
|
550
|
+
| `status` | string | body | No | Order status (cannot be set to `completed`) |
|
|
551
|
+
| `payment_status` | string | body | No | Payment status |
|
|
552
|
+
| `subtotal` | numeric | body | No | Updated subtotal in cents |
|
|
553
|
+
| `total_amount` | numeric | body | No | Updated total amount in cents |
|
|
554
|
+
| `total_paid` | numeric | body | No | Total amount already paid in cents |
|
|
555
|
+
| `shipping_total` | numeric | body | No | Updated shipping total in cents |
|
|
556
|
+
| `tax_total` | numeric | body | No | Updated tax total in cents |
|
|
557
|
+
| `manual_discount_total` | numeric | body | No | Manual discount in cents |
|
|
558
|
+
| `coupon_discount_total` | numeric | body | No | Coupon discount in cents |
|
|
559
|
+
| `discount` | object | body | No | Discount details (see Create Order) |
|
|
560
|
+
| `shipping` | array | body | No | Shipping details (see Create Order) |
|
|
561
|
+
| `applied_coupon` | array | body | No | Applied coupon details (see Create Order) |
|
|
562
|
+
| `deletedItems` | array | body | No | Array of order item IDs to remove |
|
|
563
|
+
| `couponCalculation` | array | body | No | Coupon calculation details |
|
|
564
|
+
|
|
565
|
+
All other fields from `OrderRequest` are also accepted (see Create Order).
|
|
566
|
+
|
|
567
|
+
### Error Responses
|
|
568
|
+
|
|
569
|
+
| Status | Message |
|
|
570
|
+
|--------|---------|
|
|
571
|
+
| 400 | Subscription Order cannot be edited |
|
|
572
|
+
| 400 | Completed status can not be updated |
|
|
573
|
+
|
|
574
|
+
### Response
|
|
575
|
+
|
|
576
|
+
```json
|
|
577
|
+
{
|
|
578
|
+
"message": "Order updated successfully",
|
|
579
|
+
"order": { ... }
|
|
580
|
+
}
|
|
581
|
+
```
|
|
582
|
+
|
|
583
|
+
### Example
|
|
584
|
+
|
|
585
|
+
```bash
|
|
586
|
+
curl -X POST "https://example.com/wp-json/fluent-cart/v2/orders/42" \
|
|
587
|
+
-u "username:app_password" \
|
|
588
|
+
-H "Content-Type: application/json" \
|
|
589
|
+
-d '{
|
|
590
|
+
"customer_id": 1,
|
|
591
|
+
"order_items": [
|
|
592
|
+
{
|
|
593
|
+
"id": 10,
|
|
594
|
+
"order_id": 42,
|
|
595
|
+
"quantity": 2,
|
|
596
|
+
"unit_price": 2500,
|
|
597
|
+
"line_total": 5000
|
|
598
|
+
}
|
|
599
|
+
],
|
|
600
|
+
"subtotal": 5000,
|
|
601
|
+
"total_amount": 5000
|
|
602
|
+
}'
|
|
603
|
+
```
|
|
604
|
+
|
|
605
|
+
---
|
|
606
|
+
|
|
607
|
+
## Update Order Address ID
|
|
608
|
+
|
|
609
|
+
`POST /fluent-cart/v2/orders/{order_id}/update-address-id`
|
|
610
|
+
|
|
611
|
+
Assign an existing customer address to an order's billing or shipping address.
|
|
612
|
+
|
|
613
|
+
**Permission:** `orders/manage`
|
|
614
|
+
|
|
615
|
+
### Parameters
|
|
616
|
+
|
|
617
|
+
| Parameter | Type | Location | Required | Description |
|
|
618
|
+
|-----------|------|----------|----------|-------------|
|
|
619
|
+
| `order_id` | integer | path | Yes | Order ID |
|
|
620
|
+
| `address_id` | integer | body | Yes | Customer address ID to assign |
|
|
621
|
+
| `address_type` | string | body | No | Address type: `billing` (default) or `shipping` |
|
|
622
|
+
|
|
623
|
+
### Response
|
|
624
|
+
|
|
625
|
+
```json
|
|
626
|
+
{
|
|
627
|
+
"message": "Address updated successfully"
|
|
628
|
+
}
|
|
629
|
+
```
|
|
630
|
+
|
|
631
|
+
### Error Responses
|
|
632
|
+
|
|
633
|
+
| Status | Message |
|
|
634
|
+
|--------|---------|
|
|
635
|
+
| 404 | Order not found |
|
|
636
|
+
|
|
637
|
+
### Example
|
|
638
|
+
|
|
639
|
+
```bash
|
|
640
|
+
curl -X POST "https://example.com/wp-json/fluent-cart/v2/orders/42/update-address-id" \
|
|
641
|
+
-u "username:app_password" \
|
|
642
|
+
-H "Content-Type: application/json" \
|
|
643
|
+
-d '{
|
|
644
|
+
"address_id": 5,
|
|
645
|
+
"address_type": "billing"
|
|
646
|
+
}'
|
|
647
|
+
```
|
|
648
|
+
|
|
649
|
+
---
|
|
650
|
+
|
|
651
|
+
## Refund Order
|
|
652
|
+
|
|
653
|
+
`POST /fluent-cart/v2/orders/{order_id}/refund`
|
|
654
|
+
|
|
655
|
+
Process a full or partial refund for an order. Supports both gateway refunds and manual refunds, with optional subscription cancellation.
|
|
656
|
+
|
|
657
|
+
**Permission:** `orders/can_refund`
|
|
658
|
+
|
|
659
|
+
### Parameters
|
|
660
|
+
|
|
661
|
+
| Parameter | Type | Location | Required | Description |
|
|
662
|
+
|-----------|------|----------|----------|-------------|
|
|
663
|
+
| `order_id` | integer | path | Yes | Order ID |
|
|
664
|
+
| `refund_info` | object | body | Yes | Refund details object |
|
|
665
|
+
| `refund_info.transaction_id` | integer | body | Yes | ID of the transaction to refund |
|
|
666
|
+
| `refund_info.amount` | numeric | body | Yes | Refund amount in decimal format (e.g., `10.00` not cents). Will be converted to cents internally |
|
|
667
|
+
| `refund_info.cancelSubscription` | string | body | No | Set to `"true"` to cancel associated subscription |
|
|
668
|
+
|
|
669
|
+
### Response
|
|
670
|
+
|
|
671
|
+
```json
|
|
672
|
+
{
|
|
673
|
+
"fluent_cart_refund": {
|
|
674
|
+
"status": "success",
|
|
675
|
+
"message": "Refund processed on FluentCart."
|
|
676
|
+
},
|
|
677
|
+
"gateway_refund": {
|
|
678
|
+
"status": "success",
|
|
679
|
+
"message": "Refund processed on Stripe"
|
|
680
|
+
},
|
|
681
|
+
"subscription_cancel": {
|
|
682
|
+
"status": "success",
|
|
683
|
+
"message": "Subscription cancelled successfully"
|
|
684
|
+
}
|
|
685
|
+
}
|
|
686
|
+
```
|
|
687
|
+
|
|
688
|
+
### Error Responses
|
|
689
|
+
|
|
690
|
+
| Status | Message |
|
|
691
|
+
|--------|---------|
|
|
692
|
+
| 400 | Order can not be refunded |
|
|
693
|
+
| 422 | Transaction ID is required |
|
|
694
|
+
| 422 | Refund amount is required |
|
|
695
|
+
|
|
696
|
+
### Example
|
|
697
|
+
|
|
698
|
+
```bash
|
|
699
|
+
curl -X POST "https://example.com/wp-json/fluent-cart/v2/orders/42/refund" \
|
|
700
|
+
-u "username:app_password" \
|
|
701
|
+
-H "Content-Type: application/json" \
|
|
702
|
+
-d '{
|
|
703
|
+
"refund_info": {
|
|
704
|
+
"transaction_id": 15,
|
|
705
|
+
"amount": 25.00,
|
|
706
|
+
"cancelSubscription": "true"
|
|
707
|
+
}
|
|
708
|
+
}'
|
|
709
|
+
```
|
|
710
|
+
|
|
711
|
+
---
|
|
712
|
+
|
|
713
|
+
## Change Customer
|
|
714
|
+
|
|
715
|
+
`POST /fluent-cart/v2/orders/{order_id}/change-customer`
|
|
716
|
+
|
|
717
|
+
Reassign an order to a different existing customer. Updates all connected orders (parent/child/renewals), subscriptions, and customer statistics.
|
|
718
|
+
|
|
719
|
+
**Permission:** `orders/manage`
|
|
720
|
+
|
|
721
|
+
### Parameters
|
|
722
|
+
|
|
723
|
+
| Parameter | Type | Location | Required | Description |
|
|
724
|
+
|-----------|------|----------|----------|-------------|
|
|
725
|
+
| `order_id` | integer | path | Yes | Order ID |
|
|
726
|
+
| `customer_id` | integer | body | Yes | New customer ID to assign |
|
|
727
|
+
|
|
728
|
+
### Response
|
|
729
|
+
|
|
730
|
+
```json
|
|
731
|
+
{
|
|
732
|
+
"message": "Customer changed successfully"
|
|
733
|
+
}
|
|
734
|
+
```
|
|
735
|
+
|
|
736
|
+
### Error Responses
|
|
737
|
+
|
|
738
|
+
| Status | Message |
|
|
739
|
+
|--------|---------|
|
|
740
|
+
| 423 | Customer id is required |
|
|
741
|
+
|
|
742
|
+
### Example
|
|
743
|
+
|
|
744
|
+
```bash
|
|
745
|
+
curl -X POST "https://example.com/wp-json/fluent-cart/v2/orders/42/change-customer" \
|
|
746
|
+
-u "username:app_password" \
|
|
747
|
+
-H "Content-Type: application/json" \
|
|
748
|
+
-d '{
|
|
749
|
+
"customer_id": 15
|
|
750
|
+
}'
|
|
751
|
+
```
|
|
752
|
+
|
|
753
|
+
---
|
|
754
|
+
|
|
755
|
+
## Create and Change Customer
|
|
756
|
+
|
|
757
|
+
`POST /fluent-cart/v2/orders/{order_id}/create-and-change-customer`
|
|
758
|
+
|
|
759
|
+
Create a new customer and immediately assign them to the order. Combines customer creation with order reassignment.
|
|
760
|
+
|
|
761
|
+
**Permission:** `orders/manage`
|
|
762
|
+
|
|
763
|
+
**Request Class:** `CustomerRequest`
|
|
764
|
+
|
|
765
|
+
### Parameters
|
|
766
|
+
|
|
767
|
+
| Parameter | Type | Location | Required | Description |
|
|
768
|
+
|-----------|------|----------|----------|-------------|
|
|
769
|
+
| `order_id` | integer | path | Yes | Order ID |
|
|
770
|
+
| `first_name` | string | body | Conditional | Customer first name (max 255 chars). Required if full name mode is disabled |
|
|
771
|
+
| `last_name` | string | body | No | Customer last name (max 255 chars) |
|
|
772
|
+
| `full_name` | string | body | Conditional | Customer full name (max 255 chars). Required if full name mode is enabled |
|
|
773
|
+
| `email` | string | body | Yes | Customer email address (max 255 chars, must be unique) |
|
|
774
|
+
| `city` | string | body | No | Customer city |
|
|
775
|
+
| `user_id` | integer | body | No | WordPress user ID to link |
|
|
776
|
+
| `status` | string | body | No | Customer status |
|
|
777
|
+
| `country` | string | body | No | Customer country |
|
|
778
|
+
| `state` | string | body | No | Customer state |
|
|
779
|
+
| `postcode` | string | body | No | Customer postal code |
|
|
780
|
+
| `notes` | string | body | No | Customer notes |
|
|
781
|
+
|
|
782
|
+
### Response
|
|
783
|
+
|
|
784
|
+
```json
|
|
785
|
+
{
|
|
786
|
+
"message": "Customer changed successfully"
|
|
787
|
+
}
|
|
788
|
+
```
|
|
789
|
+
|
|
790
|
+
### Error Responses
|
|
791
|
+
|
|
792
|
+
| Status | Message |
|
|
793
|
+
|--------|---------|
|
|
794
|
+
| 422 | Email is required |
|
|
795
|
+
| 422 | Email already exists |
|
|
796
|
+
| 422 | First Name is required |
|
|
797
|
+
| 400 | Failed to attach customer |
|
|
798
|
+
|
|
799
|
+
### Example
|
|
800
|
+
|
|
801
|
+
```bash
|
|
802
|
+
curl -X POST "https://example.com/wp-json/fluent-cart/v2/orders/42/create-and-change-customer" \
|
|
803
|
+
-u "username:app_password" \
|
|
804
|
+
-H "Content-Type: application/json" \
|
|
805
|
+
-d '{
|
|
806
|
+
"first_name": "Jane",
|
|
807
|
+
"last_name": "Doe",
|
|
808
|
+
"email": "jane@example.com"
|
|
809
|
+
}'
|
|
810
|
+
```
|
|
811
|
+
|
|
812
|
+
---
|
|
813
|
+
|
|
814
|
+
## Delete Order
|
|
815
|
+
|
|
816
|
+
`DELETE /fluent-cart/v2/orders/{order_id}`
|
|
817
|
+
|
|
818
|
+
Permanently delete an order and all associated data (transactions, items, meta, addresses, coupons, cart data, download permissions, labels). For subscription orders, also deletes all child renewal orders and subscriptions.
|
|
819
|
+
|
|
820
|
+
**Permission:** `orders/delete`
|
|
821
|
+
|
|
822
|
+
### Parameters
|
|
823
|
+
|
|
824
|
+
| Parameter | Type | Location | Required | Description |
|
|
825
|
+
|-----------|------|----------|----------|-------------|
|
|
826
|
+
| `order_id` | integer | path | Yes | Order ID to delete |
|
|
827
|
+
|
|
828
|
+
### Response
|
|
829
|
+
|
|
830
|
+
```json
|
|
831
|
+
{
|
|
832
|
+
"message": "Order 42 deleted successfully",
|
|
833
|
+
"data": {
|
|
834
|
+
"order_id": 42,
|
|
835
|
+
"invoice_no": "INV-042",
|
|
836
|
+
"status": "success"
|
|
837
|
+
},
|
|
838
|
+
"errors": []
|
|
839
|
+
}
|
|
840
|
+
```
|
|
841
|
+
|
|
842
|
+
### Error Responses
|
|
843
|
+
|
|
844
|
+
| Status | Message |
|
|
845
|
+
|--------|---------|
|
|
846
|
+
| 404 | Order not found |
|
|
847
|
+
| 400 | (Various reasons why order cannot be deleted) |
|
|
848
|
+
|
|
849
|
+
### Example
|
|
850
|
+
|
|
851
|
+
```bash
|
|
852
|
+
curl -X DELETE "https://example.com/wp-json/fluent-cart/v2/orders/42" \
|
|
853
|
+
-u "username:app_password"
|
|
854
|
+
```
|
|
855
|
+
|
|
856
|
+
---
|
|
857
|
+
|
|
858
|
+
## Update Statuses
|
|
859
|
+
|
|
860
|
+
`PUT /fluent-cart/v2/orders/{order}/statuses`
|
|
861
|
+
|
|
862
|
+
Update the order status or shipping status for an order.
|
|
863
|
+
|
|
864
|
+
**Permission:** `orders/manage_statuses`
|
|
865
|
+
|
|
866
|
+
### Parameters
|
|
867
|
+
|
|
868
|
+
| Parameter | Type | Location | Required | Description |
|
|
869
|
+
|-----------|------|----------|----------|-------------|
|
|
870
|
+
| `order` | integer | path | Yes | Order ID |
|
|
871
|
+
| `action` | string | body | Yes | Status change type: `change_order_status` or `change_shipping_status` |
|
|
872
|
+
| `statuses` | object | body | Yes | Status values object |
|
|
873
|
+
| `statuses.order_status` | string | body | Conditional | New order status. Required when action is `change_order_status`. One of: `completed`, `processing`, `on-hold`, `canceled` |
|
|
874
|
+
| `statuses.shipping_status` | string | body | Conditional | New shipping status. Required when action is `change_shipping_status` |
|
|
875
|
+
| `manage_stock` | string/boolean | body | No | Whether to adjust stock levels on status change |
|
|
876
|
+
|
|
877
|
+
### Response
|
|
878
|
+
|
|
879
|
+
```json
|
|
880
|
+
{
|
|
881
|
+
"message": "Status has been updated",
|
|
882
|
+
"data": { ... }
|
|
883
|
+
}
|
|
884
|
+
```
|
|
885
|
+
|
|
886
|
+
### Error Responses
|
|
887
|
+
|
|
888
|
+
| Status | Message |
|
|
889
|
+
|--------|---------|
|
|
890
|
+
| 400 | Order already has the same status |
|
|
891
|
+
| 400 | You cannot change the order status once it has been canceled |
|
|
892
|
+
|
|
893
|
+
### Example
|
|
894
|
+
|
|
895
|
+
```bash
|
|
896
|
+
curl -X PUT "https://example.com/wp-json/fluent-cart/v2/orders/42/statuses" \
|
|
897
|
+
-u "username:app_password" \
|
|
898
|
+
-H "Content-Type: application/json" \
|
|
899
|
+
-d '{
|
|
900
|
+
"action": "change_order_status",
|
|
901
|
+
"statuses": {
|
|
902
|
+
"order_status": "processing"
|
|
903
|
+
},
|
|
904
|
+
"manage_stock": true
|
|
905
|
+
}'
|
|
906
|
+
```
|
|
907
|
+
|
|
908
|
+
---
|
|
909
|
+
|
|
910
|
+
## Get Order Transactions
|
|
911
|
+
|
|
912
|
+
`GET /fluent-cart/v2/orders/{order}/transactions`
|
|
913
|
+
|
|
914
|
+
Retrieve all transactions for an order. This endpoint returns the full order details (same as Get Order Details), which includes the transactions relation.
|
|
915
|
+
|
|
916
|
+
**Permission:** `orders/view`
|
|
917
|
+
|
|
918
|
+
### Parameters
|
|
919
|
+
|
|
920
|
+
| Parameter | Type | Location | Required | Description |
|
|
921
|
+
|-----------|------|----------|----------|-------------|
|
|
922
|
+
| `order` | integer | path | Yes | Order ID |
|
|
923
|
+
|
|
924
|
+
### Response
|
|
925
|
+
|
|
926
|
+
Same response structure as Get Order Details, with the `order.transactions` array populated.
|
|
927
|
+
|
|
928
|
+
### Example
|
|
929
|
+
|
|
930
|
+
```bash
|
|
931
|
+
curl -X GET "https://example.com/wp-json/fluent-cart/v2/orders/42/transactions" \
|
|
932
|
+
-u "username:app_password"
|
|
933
|
+
```
|
|
934
|
+
|
|
935
|
+
---
|
|
936
|
+
|
|
937
|
+
## Accept Dispute
|
|
938
|
+
|
|
939
|
+
`POST /fluent-cart/v2/orders/{order}/transactions/{transaction_id}/accept-dispute/`
|
|
940
|
+
|
|
941
|
+
Accept a payment dispute (chargeback) for a specific transaction.
|
|
942
|
+
|
|
943
|
+
**Permission:** `orders/manage`
|
|
944
|
+
|
|
945
|
+
### Parameters
|
|
946
|
+
|
|
947
|
+
| Parameter | Type | Location | Required | Description |
|
|
948
|
+
|-----------|------|----------|----------|-------------|
|
|
949
|
+
| `order` | integer | path | Yes | Order ID |
|
|
950
|
+
| `transaction_id` | integer | path | Yes | Transaction ID with the dispute |
|
|
951
|
+
| `dispute_note` | string | body | No | Note about the dispute acceptance |
|
|
952
|
+
|
|
953
|
+
### Response
|
|
954
|
+
|
|
955
|
+
```json
|
|
956
|
+
{
|
|
957
|
+
"message": "Dispute accepted!"
|
|
958
|
+
}
|
|
959
|
+
```
|
|
960
|
+
|
|
961
|
+
### Example
|
|
962
|
+
|
|
963
|
+
```bash
|
|
964
|
+
curl -X POST "https://example.com/wp-json/fluent-cart/v2/orders/42/transactions/15/accept-dispute/" \
|
|
965
|
+
-u "username:app_password" \
|
|
966
|
+
-H "Content-Type: application/json" \
|
|
967
|
+
-d '{
|
|
968
|
+
"dispute_note": "Customer provided valid reason for dispute"
|
|
969
|
+
}'
|
|
970
|
+
```
|
|
971
|
+
|
|
972
|
+
---
|
|
973
|
+
|
|
974
|
+
## Get Single Transaction
|
|
975
|
+
|
|
976
|
+
`GET /fluent-cart/v2/orders/{id}/transactions/{transaction_id}`
|
|
977
|
+
|
|
978
|
+
Retrieve details of a specific transaction within an order. This endpoint returns the full order details (same as Get Order Details).
|
|
979
|
+
|
|
980
|
+
**Permission:** `orders/view`
|
|
981
|
+
|
|
982
|
+
### Parameters
|
|
983
|
+
|
|
984
|
+
| Parameter | Type | Location | Required | Description |
|
|
985
|
+
|-----------|------|----------|----------|-------------|
|
|
986
|
+
| `id` | integer | path | Yes | Order ID |
|
|
987
|
+
| `transaction_id` | integer | path | Yes | Transaction ID |
|
|
988
|
+
|
|
989
|
+
### Response
|
|
990
|
+
|
|
991
|
+
Same response structure as Get Order Details.
|
|
992
|
+
|
|
993
|
+
### Example
|
|
994
|
+
|
|
995
|
+
```bash
|
|
996
|
+
curl -X GET "https://example.com/wp-json/fluent-cart/v2/orders/42/transactions/15" \
|
|
997
|
+
-u "username:app_password"
|
|
998
|
+
```
|
|
999
|
+
|
|
1000
|
+
---
|
|
1001
|
+
|
|
1002
|
+
## Update Order Address
|
|
1003
|
+
|
|
1004
|
+
`PUT /fluent-cart/v2/orders/{order}/address/{id}`
|
|
1005
|
+
|
|
1006
|
+
Update an existing order address (billing or shipping) with new address data.
|
|
1007
|
+
|
|
1008
|
+
**Permission:** `orders/manage`
|
|
1009
|
+
|
|
1010
|
+
### Parameters
|
|
1011
|
+
|
|
1012
|
+
| Parameter | Type | Location | Required | Description |
|
|
1013
|
+
|-----------|------|----------|----------|-------------|
|
|
1014
|
+
| `order` | integer | path | Yes | Order ID |
|
|
1015
|
+
| `id` | integer | path | Yes | Order address ID |
|
|
1016
|
+
| `order_id` | integer | body | Yes | Order ID (must match the path parameter) |
|
|
1017
|
+
| `name` | string | body | No | Full name |
|
|
1018
|
+
| `first_name` | string | body | No | First name |
|
|
1019
|
+
| `last_name` | string | body | No | Last name |
|
|
1020
|
+
| `full_name` | string | body | No | Full name |
|
|
1021
|
+
| `address_1` | string | body | No | Address line 1 |
|
|
1022
|
+
| `address_2` | string | body | No | Address line 2 |
|
|
1023
|
+
| `city` | string | body | No | City |
|
|
1024
|
+
| `state` | string | body | No | State/province |
|
|
1025
|
+
| `postcode` | string | body | No | Postal/ZIP code |
|
|
1026
|
+
| `country` | string | body | No | Country code |
|
|
1027
|
+
|
|
1028
|
+
### Response
|
|
1029
|
+
|
|
1030
|
+
```json
|
|
1031
|
+
{
|
|
1032
|
+
"message": "Address updated successfully"
|
|
1033
|
+
}
|
|
1034
|
+
```
|
|
1035
|
+
|
|
1036
|
+
### Error Responses
|
|
1037
|
+
|
|
1038
|
+
| Status | Message |
|
|
1039
|
+
|--------|---------|
|
|
1040
|
+
| 404 | The address information does not match |
|
|
1041
|
+
|
|
1042
|
+
### Example
|
|
1043
|
+
|
|
1044
|
+
```bash
|
|
1045
|
+
curl -X PUT "https://example.com/wp-json/fluent-cart/v2/orders/42/address/5" \
|
|
1046
|
+
-u "username:app_password" \
|
|
1047
|
+
-H "Content-Type: application/json" \
|
|
1048
|
+
-d '{
|
|
1049
|
+
"order_id": 42,
|
|
1050
|
+
"first_name": "John",
|
|
1051
|
+
"last_name": "Doe",
|
|
1052
|
+
"address_1": "123 Main St",
|
|
1053
|
+
"city": "New York",
|
|
1054
|
+
"state": "NY",
|
|
1055
|
+
"postcode": "10001",
|
|
1056
|
+
"country": "US"
|
|
1057
|
+
}'
|
|
1058
|
+
```
|
|
1059
|
+
|
|
1060
|
+
---
|
|
1061
|
+
|
|
1062
|
+
## Update Transaction Status
|
|
1063
|
+
|
|
1064
|
+
`PUT /fluent-cart/v2/orders/{order}/transactions/{transaction}/status`
|
|
1065
|
+
|
|
1066
|
+
Update the payment status of a specific transaction and sync the order's payment status accordingly.
|
|
1067
|
+
|
|
1068
|
+
**Permission:** `orders/manage`
|
|
1069
|
+
|
|
1070
|
+
### Parameters
|
|
1071
|
+
|
|
1072
|
+
| Parameter | Type | Location | Required | Description |
|
|
1073
|
+
|-----------|------|----------|----------|-------------|
|
|
1074
|
+
| `order` | integer | path | Yes | Order ID |
|
|
1075
|
+
| `transaction` | integer | path | Yes | Transaction ID |
|
|
1076
|
+
| `status` | string | body | Yes | New transaction status (e.g., `succeeded`, `pending`, `refunded`, `failed`) |
|
|
1077
|
+
|
|
1078
|
+
### Response
|
|
1079
|
+
|
|
1080
|
+
```json
|
|
1081
|
+
{
|
|
1082
|
+
"transaction": {
|
|
1083
|
+
"id": 15,
|
|
1084
|
+
"order_id": 42,
|
|
1085
|
+
"status": "succeeded",
|
|
1086
|
+
"total": 5000,
|
|
1087
|
+
"payment_method": "stripe"
|
|
1088
|
+
},
|
|
1089
|
+
"message": "Payment status has been successfully updated"
|
|
1090
|
+
}
|
|
1091
|
+
```
|
|
1092
|
+
|
|
1093
|
+
### Error Responses
|
|
1094
|
+
|
|
1095
|
+
| Status | Message |
|
|
1096
|
+
|--------|---------|
|
|
1097
|
+
| 400 | Transaction already has the same status |
|
|
1098
|
+
| 400 | The selected transaction does not match with the provided order |
|
|
1099
|
+
|
|
1100
|
+
### Example
|
|
1101
|
+
|
|
1102
|
+
```bash
|
|
1103
|
+
curl -X PUT "https://example.com/wp-json/fluent-cart/v2/orders/42/transactions/15/status" \
|
|
1104
|
+
-u "username:app_password" \
|
|
1105
|
+
-H "Content-Type: application/json" \
|
|
1106
|
+
-d '{
|
|
1107
|
+
"status": "succeeded"
|
|
1108
|
+
}'
|
|
1109
|
+
```
|
|
1110
|
+
|
|
1111
|
+
---
|
|
1112
|
+
|
|
1113
|
+
## Create Custom Order Item
|
|
1114
|
+
|
|
1115
|
+
`POST /fluent-cart/v2/orders/{order}/create-custom`
|
|
1116
|
+
|
|
1117
|
+
Add a custom product/item to an existing order.
|
|
1118
|
+
|
|
1119
|
+
**Permission:** `orders/create`
|
|
1120
|
+
|
|
1121
|
+
### Parameters
|
|
1122
|
+
|
|
1123
|
+
| Parameter | Type | Location | Required | Description |
|
|
1124
|
+
|-----------|------|----------|----------|-------------|
|
|
1125
|
+
| `order` | integer | path | Yes | Order ID |
|
|
1126
|
+
| `product` | object | body | Yes | Product data to add as a custom item |
|
|
1127
|
+
|
|
1128
|
+
### Response
|
|
1129
|
+
|
|
1130
|
+
Returns the result of processing the custom item addition.
|
|
1131
|
+
|
|
1132
|
+
### Error Responses
|
|
1133
|
+
|
|
1134
|
+
| Status | Message |
|
|
1135
|
+
|--------|---------|
|
|
1136
|
+
| 423 | (Error message from processing) |
|
|
1137
|
+
|
|
1138
|
+
### Example
|
|
1139
|
+
|
|
1140
|
+
```bash
|
|
1141
|
+
curl -X POST "https://example.com/wp-json/fluent-cart/v2/orders/42/create-custom" \
|
|
1142
|
+
-u "username:app_password" \
|
|
1143
|
+
-H "Content-Type: application/json" \
|
|
1144
|
+
-d '{
|
|
1145
|
+
"product": {
|
|
1146
|
+
"title": "Custom Service",
|
|
1147
|
+
"price": 1500,
|
|
1148
|
+
"quantity": 1
|
|
1149
|
+
}
|
|
1150
|
+
}'
|
|
1151
|
+
```
|
|
1152
|
+
|
|
1153
|
+
---
|
|
1154
|
+
|
|
1155
|
+
## Get Shipping Methods
|
|
1156
|
+
|
|
1157
|
+
`GET /fluent-cart/v2/orders/shipping_methods`
|
|
1158
|
+
|
|
1159
|
+
Retrieve available shipping methods, optionally filtered by country and state. Returns methods applicable to the specified location and all other enabled methods separately.
|
|
1160
|
+
|
|
1161
|
+
**Permission:** `orders/manage`
|
|
1162
|
+
|
|
1163
|
+
### Parameters
|
|
1164
|
+
|
|
1165
|
+
| Parameter | Type | Location | Required | Description |
|
|
1166
|
+
|-----------|------|----------|----------|-------------|
|
|
1167
|
+
| `country_code` | string | query | No | Country code to filter applicable shipping methods (e.g., `US`, `GB`) |
|
|
1168
|
+
| `state` | string | query | No | State/province code for more specific filtering |
|
|
1169
|
+
| `order_items` | array | query | No | Array of order items (each with `id` and `quantity`) to calculate shipping charges |
|
|
1170
|
+
|
|
1171
|
+
### Response
|
|
1172
|
+
|
|
1173
|
+
```json
|
|
1174
|
+
{
|
|
1175
|
+
"shipping_methods": [
|
|
1176
|
+
{
|
|
1177
|
+
"id": 1,
|
|
1178
|
+
"title": "Standard Shipping",
|
|
1179
|
+
"is_enabled": "1",
|
|
1180
|
+
"shipping_charge": 500
|
|
1181
|
+
}
|
|
1182
|
+
],
|
|
1183
|
+
"other_shipping_methods": [
|
|
1184
|
+
{
|
|
1185
|
+
"id": 2,
|
|
1186
|
+
"title": "International Shipping",
|
|
1187
|
+
"is_enabled": "1",
|
|
1188
|
+
"shipping_charge": 1500
|
|
1189
|
+
}
|
|
1190
|
+
]
|
|
1191
|
+
}
|
|
1192
|
+
```
|
|
1193
|
+
|
|
1194
|
+
When `country_code` is empty, `shipping_methods` will be an empty array and all enabled methods appear in `other_shipping_methods`.
|
|
1195
|
+
|
|
1196
|
+
### Example
|
|
1197
|
+
|
|
1198
|
+
```bash
|
|
1199
|
+
curl -X GET "https://example.com/wp-json/fluent-cart/v2/orders/shipping_methods?country_code=US&state=CA" \
|
|
1200
|
+
-u "username:app_password"
|
|
1201
|
+
```
|
|
1202
|
+
|
|
1203
|
+
---
|
|
1204
|
+
|
|
1205
|
+
## Sync Order Statuses
|
|
1206
|
+
|
|
1207
|
+
`PUT /fluent-cart/v2/orders/{order}/sync-statuses`
|
|
1208
|
+
|
|
1209
|
+
Synchronize the order's status and payment status based on the latest transaction data. Useful for resolving status mismatches.
|
|
1210
|
+
|
|
1211
|
+
**Permission:** `orders/manage`
|
|
1212
|
+
|
|
1213
|
+
### Parameters
|
|
1214
|
+
|
|
1215
|
+
| Parameter | Type | Location | Required | Description |
|
|
1216
|
+
|-----------|------|----------|----------|-------------|
|
|
1217
|
+
| `order` | integer | path | Yes | Order ID |
|
|
1218
|
+
|
|
1219
|
+
### Response
|
|
1220
|
+
|
|
1221
|
+
```json
|
|
1222
|
+
{
|
|
1223
|
+
"message": "Order statuses synced successfully",
|
|
1224
|
+
"order": { ... },
|
|
1225
|
+
"payment_status": "paid",
|
|
1226
|
+
"status": "processing"
|
|
1227
|
+
}
|
|
1228
|
+
```
|
|
1229
|
+
|
|
1230
|
+
### Error Responses
|
|
1231
|
+
|
|
1232
|
+
| Status | Message |
|
|
1233
|
+
|--------|---------|
|
|
1234
|
+
| 404 | No transaction found for this order |
|
|
1235
|
+
|
|
1236
|
+
### Example
|
|
1237
|
+
|
|
1238
|
+
```bash
|
|
1239
|
+
curl -X PUT "https://example.com/wp-json/fluent-cart/v2/orders/42/sync-statuses" \
|
|
1240
|
+
-u "username:app_password"
|
|
1241
|
+
```
|