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,290 @@
|
|
|
1
|
+
# Files API
|
|
2
|
+
|
|
3
|
+
Upload, manage, list, and delete downloadable product files across local and cloud storage drivers (S3, Bunny, R2), and upload image assets to the WordPress Media Library for the rich text editor in FluentCart.
|
|
4
|
+
|
|
5
|
+
**Base URL:** `https://your-site.com/wp-json/fluent-cart/v2`
|
|
6
|
+
**Policies:** `StoreSensitivePolicy` (File Management) / `AdminPolicy` (Editor Uploads)
|
|
7
|
+
|
|
8
|
+
---
|
|
9
|
+
|
|
10
|
+
## Endpoints Overview
|
|
11
|
+
|
|
12
|
+
| Group | Method | Endpoint | Permission / Policy | Description |
|
|
13
|
+
|-------|--------|----------|--------------------|-------------|
|
|
14
|
+
| **File Management** | GET | `/files` | `store/sensitive` (`StoreSensitivePolicy`) | List files from specified storage driver |
|
|
15
|
+
| | POST | `/files/upload` | `store/sensitive` (`StoreSensitivePolicy`) | Upload downloadable file (`multipart/form-data`) |
|
|
16
|
+
| | GET | `/files/bucket-list` | `store/sensitive` (`StoreSensitivePolicy`) | Retrieve available storage buckets for driver |
|
|
17
|
+
| | DELETE | `/files/delete` | `store/sensitive` (`StoreSensitivePolicy`) | Delete file from storage (`manage_options` for local) |
|
|
18
|
+
| **Editor Uploads** | POST | `/upload-editor-file` | `is_super_admin` (`AdminPolicy`) | Upload image to WP Media Library for description editor |
|
|
19
|
+
|
|
20
|
+
---
|
|
21
|
+
|
|
22
|
+
## File Management
|
|
23
|
+
|
|
24
|
+
Manage digital downloadable product files across active storage drivers (local filesystem, Amazon S3, DigitalOcean Spaces, Cloudflare R2, etc.).
|
|
25
|
+
|
|
26
|
+
**Base URL:** `https://your-site.com/wp-json/fluent-cart/v2/files`
|
|
27
|
+
**Policy:** `StoreSensitivePolicy` | **Permission:** `store/sensitive`
|
|
28
|
+
|
|
29
|
+
### List Files
|
|
30
|
+
|
|
31
|
+
`GET /fluent-cart/v2/files`
|
|
32
|
+
|
|
33
|
+
Retrieve a paginated list of files stored under the specified driver.
|
|
34
|
+
|
|
35
|
+
#### Parameters
|
|
36
|
+
|
|
37
|
+
| Parameter | Type | Location | Required | Description |
|
|
38
|
+
|-----------|------|----------|----------|-------------|
|
|
39
|
+
| `driver` | string | query | No | Storage driver key (default: `local`). Supported values depend on active drivers |
|
|
40
|
+
| `search` | string | query | No | Case-insensitive substring search filter |
|
|
41
|
+
| `per_page` | integer | query | No | Maximum number of files to return (default: 10) |
|
|
42
|
+
|
|
43
|
+
#### Response
|
|
44
|
+
|
|
45
|
+
```json
|
|
46
|
+
{
|
|
47
|
+
"files": [
|
|
48
|
+
{
|
|
49
|
+
"name": "ebook__fluent-cart__.1710345600.pdf",
|
|
50
|
+
"size": 2048576,
|
|
51
|
+
"driver": "local",
|
|
52
|
+
"bucket": ""
|
|
53
|
+
},
|
|
54
|
+
{
|
|
55
|
+
"name": "software-v2__fluent-cart__.1710345700.zip",
|
|
56
|
+
"size": 10485760,
|
|
57
|
+
"driver": "local",
|
|
58
|
+
"bucket": ""
|
|
59
|
+
}
|
|
60
|
+
]
|
|
61
|
+
}
|
|
62
|
+
```
|
|
63
|
+
|
|
64
|
+
#### Example
|
|
65
|
+
|
|
66
|
+
```bash
|
|
67
|
+
curl -X GET "https://example.com/wp-json/fluent-cart/v2/files?driver=local&search=ebook&per_page=20" \
|
|
68
|
+
-u "username:app_password"
|
|
69
|
+
```
|
|
70
|
+
|
|
71
|
+
---
|
|
72
|
+
|
|
73
|
+
### Upload File
|
|
74
|
+
|
|
75
|
+
`POST /fluent-cart/v2/files/upload`
|
|
76
|
+
|
|
77
|
+
Upload a downloadable file. Files are assigned a unique timestamp suffix (`name__fluent-cart__.1710345600.ext`) to prevent name collisions.
|
|
78
|
+
|
|
79
|
+
**Content-Type:** `multipart/form-data`
|
|
80
|
+
|
|
81
|
+
#### Parameters
|
|
82
|
+
|
|
83
|
+
| Parameter | Type | Location | Required | Description |
|
|
84
|
+
|-----------|------|----------|----------|-------------|
|
|
85
|
+
| `file` | file | body | Yes | File binary data to upload |
|
|
86
|
+
| `name` | string | body | Yes | Display name for the file (max 160 chars). File extension is appended automatically |
|
|
87
|
+
| `driver` | string | body | No | Storage driver key (default: `local`) |
|
|
88
|
+
|
|
89
|
+
> **Blocked Extensions (Local Driver):**
|
|
90
|
+
> The local driver blocks executable/script file types by default: `php`, `phtml`, `html`, `htm`, `svg`, `exe`, `sh`, `bat`, `cmd`, `dll`.
|
|
91
|
+
> *Customizable via filter hook:* `fluent_cart/local_file_blocked_extensions`.
|
|
92
|
+
|
|
93
|
+
#### Response
|
|
94
|
+
|
|
95
|
+
```json
|
|
96
|
+
{
|
|
97
|
+
"message": "File Uploaded Successfully",
|
|
98
|
+
"path": "my-ebook__fluent-cart__.1710345600.pdf",
|
|
99
|
+
"file": {
|
|
100
|
+
"driver": "local",
|
|
101
|
+
"size": 2048576,
|
|
102
|
+
"name": "my-ebook__fluent-cart__.1710345600.pdf",
|
|
103
|
+
"bucket": ""
|
|
104
|
+
}
|
|
105
|
+
}
|
|
106
|
+
```
|
|
107
|
+
|
|
108
|
+
#### Error Response
|
|
109
|
+
|
|
110
|
+
```json
|
|
111
|
+
{
|
|
112
|
+
"message": "Failed To Upload File",
|
|
113
|
+
"additional": "File is empty"
|
|
114
|
+
}
|
|
115
|
+
```
|
|
116
|
+
|
|
117
|
+
#### Example
|
|
118
|
+
|
|
119
|
+
```bash
|
|
120
|
+
curl -X POST "https://example.com/wp-json/fluent-cart/v2/files/upload" \
|
|
121
|
+
-u "username:app_password" \
|
|
122
|
+
-F "file=@/path/to/ebook.pdf" \
|
|
123
|
+
-F "name=my-ebook" \
|
|
124
|
+
-F "driver=local"
|
|
125
|
+
```
|
|
126
|
+
|
|
127
|
+
---
|
|
128
|
+
|
|
129
|
+
### Get Bucket List
|
|
130
|
+
|
|
131
|
+
`GET /fluent-cart/v2/files/bucket-list`
|
|
132
|
+
|
|
133
|
+
Retrieve available storage buckets for cloud storage drivers (e.g. S3, R2).
|
|
134
|
+
|
|
135
|
+
#### Parameters
|
|
136
|
+
|
|
137
|
+
| Parameter | Type | Location | Required | Description |
|
|
138
|
+
|-----------|------|----------|----------|-------------|
|
|
139
|
+
| `driver` | string | query | No | Storage driver key (default: uses the first active driver) |
|
|
140
|
+
|
|
141
|
+
#### Response
|
|
142
|
+
|
|
143
|
+
```json
|
|
144
|
+
{
|
|
145
|
+
"default_bucket": "my-store-files",
|
|
146
|
+
"buckets": [
|
|
147
|
+
{
|
|
148
|
+
"label": "my-store-files",
|
|
149
|
+
"value": "my-store-files"
|
|
150
|
+
},
|
|
151
|
+
{
|
|
152
|
+
"label": "my-store-backups",
|
|
153
|
+
"value": "my-store-backups"
|
|
154
|
+
}
|
|
155
|
+
]
|
|
156
|
+
}
|
|
157
|
+
```
|
|
158
|
+
|
|
159
|
+
---
|
|
160
|
+
|
|
161
|
+
### Delete File
|
|
162
|
+
|
|
163
|
+
`DELETE /fluent-cart/v2/files/delete`
|
|
164
|
+
|
|
165
|
+
Delete a file from the specified storage driver.
|
|
166
|
+
|
|
167
|
+
> **Permission Note (Local Driver):** Deleting files from the local driver requires the WordPress `manage_options` administrator capability.
|
|
168
|
+
|
|
169
|
+
#### Parameters
|
|
170
|
+
|
|
171
|
+
| Parameter | Type | Location | Required | Description |
|
|
172
|
+
|-----------|------|----------|----------|-------------|
|
|
173
|
+
| `file_path` | string | query | Yes | Relative file path in storage directory |
|
|
174
|
+
| `driver` | string | query | Yes | Storage driver key (e.g., `local`, `s3`) |
|
|
175
|
+
| `bucket` | string | query | No | Bucket name (required for cloud storage drivers) |
|
|
176
|
+
|
|
177
|
+
#### Response
|
|
178
|
+
|
|
179
|
+
```json
|
|
180
|
+
{
|
|
181
|
+
"message": "File Deleted Successfully",
|
|
182
|
+
"driver": "local",
|
|
183
|
+
"path": "my-ebook__fluent-cart__.1710345600.pdf"
|
|
184
|
+
}
|
|
185
|
+
```
|
|
186
|
+
|
|
187
|
+
#### Error Responses
|
|
188
|
+
|
|
189
|
+
```json
|
|
190
|
+
{
|
|
191
|
+
"message": "File not found"
|
|
192
|
+
}
|
|
193
|
+
```
|
|
194
|
+
|
|
195
|
+
```json
|
|
196
|
+
{
|
|
197
|
+
"message": "You are not allowed to delete file"
|
|
198
|
+
}
|
|
199
|
+
```
|
|
200
|
+
|
|
201
|
+
#### Example
|
|
202
|
+
|
|
203
|
+
```bash
|
|
204
|
+
curl -X DELETE "https://example.com/wp-json/fluent-cart/v2/files/delete?file_path=my-ebook__fluent-cart__.1710345600.pdf&driver=local" \
|
|
205
|
+
-u "username:app_password"
|
|
206
|
+
```
|
|
207
|
+
|
|
208
|
+
---
|
|
209
|
+
|
|
210
|
+
## Editor File Upload
|
|
211
|
+
|
|
212
|
+
Upload images to the WordPress Media Library for product description block editors.
|
|
213
|
+
|
|
214
|
+
**Prefix:** `/fluent-cart/v2/upload-editor-file` | **Policy:** `AdminPolicy` | **Permission:** `is_super_admin`
|
|
215
|
+
**Content-Type:** `multipart/form-data`
|
|
216
|
+
|
|
217
|
+
### Upload Editor File
|
|
218
|
+
|
|
219
|
+
`POST /fluent-cart/v2/upload-editor-file`
|
|
220
|
+
|
|
221
|
+
Uploads an image file to the WordPress Media Library via `media_handle_upload`. Only valid image MIME types are allowed (`image/jpeg`, `image/png`, `image/gif`, `image/webp`).
|
|
222
|
+
|
|
223
|
+
#### Parameters
|
|
224
|
+
|
|
225
|
+
| Parameter | Type | Location | Required | Description |
|
|
226
|
+
|-----------|------|----------|----------|-------------|
|
|
227
|
+
| `file` | file | body | Yes | Image binary file to upload |
|
|
228
|
+
|
|
229
|
+
#### Response
|
|
230
|
+
|
|
231
|
+
Returns standard WordPress attachment payload prepared via `wp_prepare_attachment_for_js`.
|
|
232
|
+
|
|
233
|
+
```json
|
|
234
|
+
{
|
|
235
|
+
"id": 456,
|
|
236
|
+
"title": "product-banner",
|
|
237
|
+
"filename": "product-banner.jpg",
|
|
238
|
+
"url": "https://example.com/wp-content/uploads/2025/01/product-banner.jpg",
|
|
239
|
+
"link": "https://example.com/?attachment_id=456",
|
|
240
|
+
"alt": "",
|
|
241
|
+
"author": "1",
|
|
242
|
+
"description": "",
|
|
243
|
+
"caption": "",
|
|
244
|
+
"name": "product-banner",
|
|
245
|
+
"status": "inherit",
|
|
246
|
+
"uploadedTo": 0,
|
|
247
|
+
"date": "2025-01-15T12:00:00.000Z",
|
|
248
|
+
"modified": "2025-01-15T12:00:00.000Z",
|
|
249
|
+
"menuOrder": 0,
|
|
250
|
+
"mime": "image/jpeg",
|
|
251
|
+
"type": "image",
|
|
252
|
+
"subtype": "jpeg",
|
|
253
|
+
"icon": "https://example.com/wp-includes/images/media/default.png",
|
|
254
|
+
"dateFormatted": "January 15, 2025",
|
|
255
|
+
"nonces": {},
|
|
256
|
+
"editLink": "https://example.com/wp-admin/post.php?post=456&action=edit",
|
|
257
|
+
"meta": false,
|
|
258
|
+
"authorName": "admin",
|
|
259
|
+
"authorLink": "https://example.com/wp-admin/profile.php",
|
|
260
|
+
"filesizeInBytes": 204800,
|
|
261
|
+
"filesizeHumanReadable": "200 KB",
|
|
262
|
+
"sizes": {
|
|
263
|
+
"thumbnail": {
|
|
264
|
+
"url": "https://example.com/wp-content/uploads/2025/01/product-banner-150x150.jpg",
|
|
265
|
+
"height": 150,
|
|
266
|
+
"width": 150
|
|
267
|
+
},
|
|
268
|
+
"medium": {
|
|
269
|
+
"url": "https://example.com/wp-content/uploads/2025/01/product-banner-300x200.jpg",
|
|
270
|
+
"height": 200,
|
|
271
|
+
"width": 300
|
|
272
|
+
},
|
|
273
|
+
"full": {
|
|
274
|
+
"url": "https://example.com/wp-content/uploads/2025/01/product-banner.jpg",
|
|
275
|
+
"height": 800,
|
|
276
|
+
"width": 1200
|
|
277
|
+
}
|
|
278
|
+
},
|
|
279
|
+
"height": 800,
|
|
280
|
+
"width": 1200
|
|
281
|
+
}
|
|
282
|
+
```
|
|
283
|
+
|
|
284
|
+
#### Example
|
|
285
|
+
|
|
286
|
+
```bash
|
|
287
|
+
curl -X POST "https://example.com/wp-json/fluent-cart/v2/upload-editor-file" \
|
|
288
|
+
-u "username:app_password" \
|
|
289
|
+
-F "file=@/path/to/product-banner.jpg"
|
|
290
|
+
```
|
|
@@ -0,0 +1,324 @@
|
|
|
1
|
+
# Integrations API
|
|
2
|
+
|
|
3
|
+
Manage third-party CRM, LMS, marketing, and email integrations (e.g. FluentCRM, FluentSMTP, Webhooks), global integration feeds, and product-specific automation triggers in FluentCart.
|
|
4
|
+
|
|
5
|
+
**Base URLs:**
|
|
6
|
+
- Global: `https://your-site.com/wp-json/fluent-cart/v2/integration`
|
|
7
|
+
- Product-Level: `https://your-site.com/wp-json/fluent-cart/v2/products/{product_id}/integrations`
|
|
8
|
+
|
|
9
|
+
**Policies:** `IntegrationPolicy` (Global) / `ProductPolicy` (Product-Level)
|
|
10
|
+
|
|
11
|
+
---
|
|
12
|
+
|
|
13
|
+
## Endpoints Overview
|
|
14
|
+
|
|
15
|
+
| Group | Method | Endpoint | Permission / Policy | Controller Method | Description |
|
|
16
|
+
|-------|--------|----------|--------------------|-------------------|-------------|
|
|
17
|
+
| **Global Add-ons** | GET | `/integration/addons` | `integrations/view` | `AddonsController@getAddons` | List all integration add-ons & installation status |
|
|
18
|
+
| | GET | `/integration/global-settings` | `integrations/view` | `IntegrationController@getGlobalSettings` | Get global configuration settings for provider |
|
|
19
|
+
| | POST | `/integration/global-settings` | `integrations/manage` | `IntegrationController@setGlobalSettings` | Save global provider credentials (API keys, etc.) |
|
|
20
|
+
| | POST | `/integration/feed/install-plugin` | `integrations/manage` | `AddonsController@installAndActivate` | Install & activate whitelisted WP.org plugin add-on |
|
|
21
|
+
| **Global Feeds** | GET | `/integration/global-feeds` | `integrations/view` | `IntegrationController@getFeeds` | List all configured global integration feeds |
|
|
22
|
+
| | GET | `/integration/global-feeds/settings` | `integrations/view` | `IntegrationController@getSettings` | Get form schema & saved values for feed editor |
|
|
23
|
+
| | POST | `/integration/global-feeds/settings` | `integrations/manage` | `IntegrationController@saveSettings` | Create or update a global integration feed |
|
|
24
|
+
| | POST | `/integration/global-feeds/change-status/{id}` | `integrations/manage` | `IntegrationController@changeStatus` | Toggle global feed enabled status (`yes`/`no`) |
|
|
25
|
+
| | DELETE | `/integration/global-feeds/{id}` | `integrations/delete` | `IntegrationController@deleteSettings` | Permanently delete a global integration feed |
|
|
26
|
+
| | GET | `/integration/feed/lists` | `integrations/view` | `IntegrationController@lists` | Fetch field mapping options for chosen list |
|
|
27
|
+
| | GET | `/integration/feed/dynamic_options` | `integrations/view` | `IntegrationController@getDynamicOptions` | Fetch dynamic options (post types, CRM tags) |
|
|
28
|
+
| | POST | `/integration/feed/chained` | `integrations/manage` | `IntegrationController@chained` | Handle dependent select fields via provider action |
|
|
29
|
+
| **Product Feeds** | GET | `/products/{id}/integrations` | `products/view` | `ProductIntegrationsController@getFeeds` | List integration feeds for a specific product |
|
|
30
|
+
| | GET | `/products/{id}/integrations/{provider}/settings` | `products/view` | `ProductIntegrationsController@getProductIntegrationSettings` | Get product feed editor schema & variation choices |
|
|
31
|
+
| | POST | `/products/{id}/integrations` | `products/edit` | `ProductIntegrationsController@saveProductIntegration` | Create or update product-level integration feed |
|
|
32
|
+
| | POST | `/products/{id}/integrations/feed/change-status` | `products/edit` | `ProductIntegrationsController@changeStatus` | Toggle product-level feed status (`yes`/`no`) |
|
|
33
|
+
| | DELETE | `/products/{id}/integrations/{feed_id}` | `products/delete` | `ProductIntegrationsController@deleteProductIntegration` | Delete product-level integration feed |
|
|
34
|
+
|
|
35
|
+
---
|
|
36
|
+
|
|
37
|
+
## Global Add-ons & Integration Settings
|
|
38
|
+
|
|
39
|
+
Manage integration provider connections and global authentication details.
|
|
40
|
+
|
|
41
|
+
**Prefix:** `/fluent-cart/v2/integration` | **Policy:** `IntegrationPolicy`
|
|
42
|
+
|
|
43
|
+
### List Available Add-ons
|
|
44
|
+
|
|
45
|
+
`GET /fluent-cart/v2/integration/addons`
|
|
46
|
+
|
|
47
|
+
#### Response
|
|
48
|
+
|
|
49
|
+
```json
|
|
50
|
+
{
|
|
51
|
+
"addons": {
|
|
52
|
+
"fluent-crm": {
|
|
53
|
+
"installable": "fluent-crm",
|
|
54
|
+
"enabled": true,
|
|
55
|
+
"title": "FluentCRM",
|
|
56
|
+
"logo": "https://example.com/wp-content/plugins/fluent-cart/assets/images/integrations/fluentcrm.svg",
|
|
57
|
+
"categories": ["crm", "core", "marketing"],
|
|
58
|
+
"description": "The most powerful email marketing automation plugin for WordPress."
|
|
59
|
+
},
|
|
60
|
+
"webhook": {
|
|
61
|
+
"title": "Webhook",
|
|
62
|
+
"description": "Send data anywhere via webhook",
|
|
63
|
+
"enabled": true,
|
|
64
|
+
"is_pro": true,
|
|
65
|
+
"is_pro_active": true,
|
|
66
|
+
"categories": ["core"]
|
|
67
|
+
}
|
|
68
|
+
}
|
|
69
|
+
}
|
|
70
|
+
```
|
|
71
|
+
|
|
72
|
+
---
|
|
73
|
+
|
|
74
|
+
### Get Global Integration Settings
|
|
75
|
+
|
|
76
|
+
`GET /fluent-cart/v2/integration/global-settings`
|
|
77
|
+
|
|
78
|
+
#### Parameters
|
|
79
|
+
|
|
80
|
+
| Parameter | Type | Location | Required | Description |
|
|
81
|
+
|-----------|------|----------|----------|-------------|
|
|
82
|
+
| `settings_key` | string | query | Yes | Integration provider key (e.g., `fluent-crm`, `webhook`) |
|
|
83
|
+
|
|
84
|
+
---
|
|
85
|
+
|
|
86
|
+
### Save Global Integration Settings
|
|
87
|
+
|
|
88
|
+
`POST /fluent-cart/v2/integration/global-settings`
|
|
89
|
+
|
|
90
|
+
#### Parameters
|
|
91
|
+
|
|
92
|
+
| Parameter | Type | Location | Required | Description |
|
|
93
|
+
|-----------|------|----------|----------|-------------|
|
|
94
|
+
| `settings_key` | string | body | Yes | Integration provider key |
|
|
95
|
+
| `integration` | object | body | Yes | Key-value settings object for the provider |
|
|
96
|
+
|
|
97
|
+
> **Hook Trigger:** Execution is dispatched to `fluent_cart/integration/save_global_integration_settings_{settings_key}`.
|
|
98
|
+
|
|
99
|
+
---
|
|
100
|
+
|
|
101
|
+
### Install and Activate Add-on Plugin
|
|
102
|
+
|
|
103
|
+
`POST /fluent-cart/v2/integration/feed/install-plugin`
|
|
104
|
+
|
|
105
|
+
Installs a whitelisted plugin from WordPress.org.
|
|
106
|
+
|
|
107
|
+
#### Parameters
|
|
108
|
+
|
|
109
|
+
| Parameter | Type | Location | Required | Description |
|
|
110
|
+
|-----------|------|----------|----------|-------------|
|
|
111
|
+
| `addon` | string | body | Yes | Allowed slugs: `fluent-crm`, `fluent-smtp`, `fluent-community`, `fluent-security`, `fluentform`, `fluent-support` |
|
|
112
|
+
|
|
113
|
+
#### Response
|
|
114
|
+
|
|
115
|
+
```json
|
|
116
|
+
{
|
|
117
|
+
"message": "Addon installation started successfully.",
|
|
118
|
+
"redirect": "https://example.com/wp-admin/admin.php?page=fluent-cart#/integrations"
|
|
119
|
+
}
|
|
120
|
+
```
|
|
121
|
+
|
|
122
|
+
---
|
|
123
|
+
|
|
124
|
+
## Global Integration Feeds
|
|
125
|
+
|
|
126
|
+
Global feeds fire automations on every matching order.
|
|
127
|
+
|
|
128
|
+
**Prefix:** `/fluent-cart/v2/integration/global-feeds` | **Policy:** `IntegrationPolicy`
|
|
129
|
+
|
|
130
|
+
### List Global Integration Feeds
|
|
131
|
+
|
|
132
|
+
`GET /fluent-cart/v2/integration/global-feeds`
|
|
133
|
+
|
|
134
|
+
#### Response
|
|
135
|
+
|
|
136
|
+
```json
|
|
137
|
+
{
|
|
138
|
+
"feeds": [
|
|
139
|
+
{
|
|
140
|
+
"id": 42,
|
|
141
|
+
"name": "Add to FluentCRM list",
|
|
142
|
+
"enabled": "yes",
|
|
143
|
+
"provider": "fluent-crm",
|
|
144
|
+
"feed": {
|
|
145
|
+
"name": "Add to FluentCRM list",
|
|
146
|
+
"enabled": "yes",
|
|
147
|
+
"list_id": "2",
|
|
148
|
+
"list_name": "Customers",
|
|
149
|
+
"merge_fields": {},
|
|
150
|
+
"conditionals": {
|
|
151
|
+
"conditions": [],
|
|
152
|
+
"status": false,
|
|
153
|
+
"type": "all"
|
|
154
|
+
}
|
|
155
|
+
},
|
|
156
|
+
"scope": "global"
|
|
157
|
+
}
|
|
158
|
+
],
|
|
159
|
+
"available_integrations": {}
|
|
160
|
+
}
|
|
161
|
+
```
|
|
162
|
+
|
|
163
|
+
---
|
|
164
|
+
|
|
165
|
+
### Save Feed Settings
|
|
166
|
+
|
|
167
|
+
`POST /fluent-cart/v2/integration/global-feeds/settings`
|
|
168
|
+
|
|
169
|
+
#### Parameters
|
|
170
|
+
|
|
171
|
+
| Parameter | Type | Location | Required | Description |
|
|
172
|
+
|-----------|------|----------|----------|-------------|
|
|
173
|
+
| `integration_name` | string | body | Yes | Integration provider key (e.g. `fluent-crm`, `webhook`) |
|
|
174
|
+
| `integration_id` | integer | body | No | Existing feed ID to update. Omit to create new feed |
|
|
175
|
+
| `integration` | string (JSON) | body | Yes | JSON string containing feed settings (`name`, `enabled`, `list_id`, `merge_fields`, `conditionals`) |
|
|
176
|
+
|
|
177
|
+
#### Example
|
|
178
|
+
|
|
179
|
+
```bash
|
|
180
|
+
curl -X POST "https://example.com/wp-json/fluent-cart/v2/integration/global-feeds/settings" \
|
|
181
|
+
-u "username:app_password" \
|
|
182
|
+
-H "Content-Type: application/json" \
|
|
183
|
+
-d '{
|
|
184
|
+
"integration_name": "fluent-crm",
|
|
185
|
+
"integration": "{\"name\":\"Add to customers\",\"enabled\":\"yes\",\"list_id\":\"2\",\"list_name\":\"Customers\",\"merge_fields\":{},\"conditionals\":{\"conditions\":[],\"status\":false,\"type\":\"all\"}}"
|
|
186
|
+
}'
|
|
187
|
+
```
|
|
188
|
+
|
|
189
|
+
---
|
|
190
|
+
|
|
191
|
+
### Change Feed Status
|
|
192
|
+
|
|
193
|
+
`POST /fluent-cart/v2/integration/global-feeds/change-status/{integration_id}`
|
|
194
|
+
|
|
195
|
+
#### Parameters
|
|
196
|
+
|
|
197
|
+
| Parameter | Type | Location | Required | Description |
|
|
198
|
+
|-----------|------|----------|----------|-------------|
|
|
199
|
+
| `integration_id` | integer | path | Yes | Feed ID to toggle |
|
|
200
|
+
| `status` | string | body | Yes | `yes` (enable) or `no` (disable) |
|
|
201
|
+
|
|
202
|
+
---
|
|
203
|
+
|
|
204
|
+
### Delete Feed
|
|
205
|
+
|
|
206
|
+
`DELETE /fluent-cart/v2/integration/global-feeds/{integration_id}`
|
|
207
|
+
|
|
208
|
+
---
|
|
209
|
+
|
|
210
|
+
### Helper Endpoints (`lists`, `dynamic_options`, `chained`)
|
|
211
|
+
|
|
212
|
+
- `GET /integration/feed/lists?integration_name={key}&list_id={id}` — Fetch list merge fields.
|
|
213
|
+
- `GET /integration/feed/dynamic_options?option_key={key}&sub_option_key={slug}&search={term}` — Asynchronously fetch dynamic option dropdowns (WP post types, CRM tags, etc.).
|
|
214
|
+
- `POST /integration/feed/chained` — Dependent input handling via `fluent_cart/integration/chained_{route}` filter.
|
|
215
|
+
|
|
216
|
+
---
|
|
217
|
+
|
|
218
|
+
## Product-Level Integrations
|
|
219
|
+
|
|
220
|
+
Product-specific integration feeds fire automations only when orders contain the specific product (and optional variations).
|
|
221
|
+
|
|
222
|
+
**Prefix:** `/fluent-cart/v2/products/{product_id}/integrations` | **Policy:** `ProductPolicy`
|
|
223
|
+
|
|
224
|
+
### List Product Integration Feeds
|
|
225
|
+
|
|
226
|
+
`GET /fluent-cart/v2/products/{productId}/integrations`
|
|
227
|
+
|
|
228
|
+
#### Response
|
|
229
|
+
|
|
230
|
+
```json
|
|
231
|
+
{
|
|
232
|
+
"feeds": [
|
|
233
|
+
{
|
|
234
|
+
"id": 15,
|
|
235
|
+
"name": "Tag VIP buyers",
|
|
236
|
+
"enabled": "yes",
|
|
237
|
+
"provider": "fluent-crm",
|
|
238
|
+
"feed": {
|
|
239
|
+
"name": "Tag VIP buyers",
|
|
240
|
+
"enabled": "yes",
|
|
241
|
+
"list_id": "3",
|
|
242
|
+
"list_name": "VIP Customers",
|
|
243
|
+
"merge_fields": {},
|
|
244
|
+
"conditional_variation_ids": [101, 102],
|
|
245
|
+
"conditionals": {
|
|
246
|
+
"conditions": [],
|
|
247
|
+
"status": false,
|
|
248
|
+
"type": "all"
|
|
249
|
+
}
|
|
250
|
+
},
|
|
251
|
+
"scope": "product"
|
|
252
|
+
}
|
|
253
|
+
]
|
|
254
|
+
}
|
|
255
|
+
```
|
|
256
|
+
|
|
257
|
+
---
|
|
258
|
+
|
|
259
|
+
### Get Product Integration Settings
|
|
260
|
+
|
|
261
|
+
`GET /fluent-cart/v2/products/{product_id}/integrations/{integration_name}/settings`
|
|
262
|
+
|
|
263
|
+
Returns form schema, saved feed values, and `product_variations` list for targeting specific variations.
|
|
264
|
+
|
|
265
|
+
#### Response
|
|
266
|
+
|
|
267
|
+
```json
|
|
268
|
+
{
|
|
269
|
+
"settings": {
|
|
270
|
+
"conditional_variation_ids": []
|
|
271
|
+
},
|
|
272
|
+
"product_variations": [
|
|
273
|
+
{ "id": 101, "title": "Basic Plan" },
|
|
274
|
+
{ "id": 102, "title": "Pro Plan" }
|
|
275
|
+
],
|
|
276
|
+
"scope": "product"
|
|
277
|
+
}
|
|
278
|
+
```
|
|
279
|
+
|
|
280
|
+
---
|
|
281
|
+
|
|
282
|
+
### Save Product Integration Feed
|
|
283
|
+
|
|
284
|
+
`POST /fluent-cart/v2/products/{product_id}/integrations`
|
|
285
|
+
|
|
286
|
+
#### Parameters
|
|
287
|
+
|
|
288
|
+
| Parameter | Type | Location | Required | Description |
|
|
289
|
+
|-----------|------|----------|----------|-------------|
|
|
290
|
+
| `product_id` | integer | path | Yes | Product ID |
|
|
291
|
+
| `integration_name` | string | body | Yes | Integration provider key (e.g. `fluent-crm`) |
|
|
292
|
+
| `integration_id` | integer | body | No | Feed ID to update. Omit to create new feed |
|
|
293
|
+
| `integration` | string (JSON) | body | Yes | JSON string containing `name`, `enabled`, `list_id`, `merge_fields`, `conditional_variation_ids`, `conditionals` |
|
|
294
|
+
|
|
295
|
+
#### Request Example
|
|
296
|
+
|
|
297
|
+
```json
|
|
298
|
+
{
|
|
299
|
+
"integration_name": "fluent-crm",
|
|
300
|
+
"integration": "{\"name\":\"Tag VIP buyers\",\"enabled\":\"yes\",\"list_id\":\"3\",\"conditional_variation_ids\":[101],\"merge_fields\":{},\"conditionals\":{\"conditions\":[],\"status\":false,\"type\":\"all\"}}"
|
|
301
|
+
}
|
|
302
|
+
```
|
|
303
|
+
|
|
304
|
+
---
|
|
305
|
+
|
|
306
|
+
### Change Product Feed Status
|
|
307
|
+
|
|
308
|
+
`POST /fluent-cart/v2/products/{product_id}/integrations/feed/change-status`
|
|
309
|
+
|
|
310
|
+
> **Note:** Requires `product_id` in both URL path and request body!
|
|
311
|
+
|
|
312
|
+
#### Parameters
|
|
313
|
+
|
|
314
|
+
| Parameter | Type | Location | Required | Description |
|
|
315
|
+
|-----------|------|----------|----------|-------------|
|
|
316
|
+
| `product_id` | integer | path & body | Yes | Product ID |
|
|
317
|
+
| `notification_id` | integer | body | Yes | Feed ID to toggle |
|
|
318
|
+
| `status` | string | body | Yes | `yes` or `no` |
|
|
319
|
+
|
|
320
|
+
---
|
|
321
|
+
|
|
322
|
+
### Delete Product Integration Feed
|
|
323
|
+
|
|
324
|
+
`DELETE /fluent-cart/v2/products/{product_id}/integrations/{integration_id}`
|