fluentcart-developer 2.3.0 → 2.3.1

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.
Files changed (49) hide show
  1. package/README.md +59 -59
  2. package/dist/cards/fluentcart/tools.d.ts.map +1 -1
  3. package/dist/cards/fluentcart/tools.js +2301 -2161
  4. package/dist/cards/fluentcart/tools.js.map +1 -1
  5. package/dist/skills/fluentcart-developer/.claude-plugin/plugin.json +12 -12
  6. package/dist/skills/fluentcart-developer/.mcp.json +11 -11
  7. package/dist/skills/fluentcart-developer/examples/fluentcart-starter-child-theme/fluent-cart/checkout.php +32 -32
  8. package/dist/skills/fluentcart-developer/examples/fluentcart-starter-child-theme/functions.php +40 -40
  9. package/dist/skills/fluentcart-developer/examples/sample-fee-surcharge-plugin/fluentcart-fee-surcharge.php +38 -38
  10. package/dist/skills/fluentcart-developer/references/action-hooks-cart-checkout.md +1355 -1355
  11. package/dist/skills/fluentcart-developer/references/action-hooks-customers-users.md +266 -266
  12. package/dist/skills/fluentcart-developer/references/action-hooks-licenses.md +855 -855
  13. package/dist/skills/fluentcart-developer/references/action-hooks-orders.md +631 -631
  14. package/dist/skills/fluentcart-developer/references/action-hooks-payments-integrations.md +963 -963
  15. package/dist/skills/fluentcart-developer/references/action-hooks-products-coupons.md +585 -585
  16. package/dist/skills/fluentcart-developer/references/action-hooks-subscriptions.md +661 -661
  17. package/dist/skills/fluentcart-developer/references/database-models-query-builder.md +194 -194
  18. package/dist/skills/fluentcart-developer/references/database-models-reference.md +604 -604
  19. package/dist/skills/fluentcart-developer/references/engineering-notes.md +154 -154
  20. package/dist/skills/fluentcart-developer/references/fee-system-guide.md +449 -449
  21. package/dist/skills/fluentcart-developer/references/filter-hooks-cart-checkout.md +1202 -1202
  22. package/dist/skills/fluentcart-developer/references/filter-hooks-integrations-advanced.md +1598 -1598
  23. package/dist/skills/fluentcart-developer/references/filter-hooks-products-pricing.md +628 -628
  24. package/dist/skills/fluentcart-developer/references/filter-hooks-settings-configuration.md +1177 -1177
  25. package/dist/skills/fluentcart-developer/references/fluentcart-developer-guide.md +154 -154
  26. package/dist/skills/fluentcart-developer/references/ghost-product-selling.md +458 -458
  27. package/dist/skills/fluentcart-developer/references/modules-and-extensions-reference.md +224 -224
  28. package/dist/skills/fluentcart-developer/references/payment-gateway-integration.md +761 -761
  29. package/dist/skills/fluentcart-developer/references/rest-api-customer-profile.md +190 -190
  30. package/dist/skills/fluentcart-developer/references/rest-api-customers.md +1121 -1121
  31. package/dist/skills/fluentcart-developer/references/rest-api-dashboard-utilities.md +219 -219
  32. package/dist/skills/fluentcart-developer/references/rest-api-email-notifications.md +619 -619
  33. package/dist/skills/fluentcart-developer/references/rest-api-files.md +290 -290
  34. package/dist/skills/fluentcart-developer/references/rest-api-integrations.md +324 -324
  35. package/dist/skills/fluentcart-developer/references/rest-api-labels-attributes.md +321 -321
  36. package/dist/skills/fluentcart-developer/references/rest-api-order-bumps.md +200 -200
  37. package/dist/skills/fluentcart-developer/references/rest-api-overview.md +131 -131
  38. package/dist/skills/fluentcart-developer/references/rest-api-public-shop.md +172 -172
  39. package/dist/skills/fluentcart-developer/references/rest-api-reference.md +552 -552
  40. package/dist/skills/fluentcart-developer/references/rest-api-reports.md +377 -377
  41. package/dist/skills/fluentcart-developer/references/rest-api-roles-permissions.md +147 -147
  42. package/dist/skills/fluentcart-developer/references/rest-api-settings.md +528 -528
  43. package/dist/skills/fluentcart-developer/references/rest-api-shipping.md +799 -799
  44. package/dist/skills/fluentcart-developer/references/rest-api-tax.md +356 -356
  45. package/dist/skills/fluentcart-developer/references/subscription-customization.md +197 -197
  46. package/dist/skills/fluentcart-developer/scripts/cli.js +1 -1
  47. package/dist/version.d.ts +1 -1
  48. package/dist/version.js +1 -1
  49. package/package.json +65 -65
@@ -1,619 +1,619 @@
1
- # Email Notifications API
2
-
3
- Configure email notification templates, manage scheduling reminders, preview custom/default templates, and update global email settings in FluentCart.
4
-
5
- **Base URL:** `https://your-site.com/wp-json/fluent-cart/v2/email-notification`
6
- **Policy:** `StoreSensitivePolicy`
7
- **Permission:** `store/sensitive`
8
-
9
- ---
10
-
11
- ## Endpoints Overview
12
-
13
- | Group | Method | Endpoint | Description |
14
- |-------|--------|----------|-------------|
15
- | **Notification Templates** | GET | `/email-notification` | List all registered email notification templates |
16
- | | GET | `/email-notification/{notification}` | Get single notification details & shortcodes |
17
- | | PUT | `/email-notification/{notification}` | Update notification subject, body, & active status |
18
- | | POST | `/email-notification/enable-notification/{name}` | Quick toggle enable/disable status |
19
- | | GET | `/email-notification/get-short-codes` | Get editor shortcodes, template paths, & button presets |
20
- | **Global Email Settings** | GET | `/email-notification/get-settings` | Get global sender name, email, footer, & admin recipients |
21
- | | POST | `/email-notification/save-settings` | Update global email configuration settings |
22
- | **Scheduling & Reminders** | GET | `/email-notification/reminders` | Get automated email reminder schedule settings & fields |
23
- | | POST | `/email-notification/reminders` | Update reminder schedule days & toggles |
24
- | **Template Previews** | POST | `/email-notification/preview` | Render HTML preview for custom block-editor notification |
25
- | | POST | `/email-notification/preview-default-template` | Render HTML preview for default PHP email template |
26
-
27
- ---
28
-
29
- ## Notification Templates
30
-
31
- Manage order, subscription, and reminder email templates.
32
-
33
- **Prefix:** `/fluent-cart/v2/email-notification` | **Policy:** `StoreSensitivePolicy` (`store/sensitive`)
34
-
35
- ### List All Notifications
36
-
37
- `GET /fluent-cart/v2/email-notification`
38
-
39
- Retrieve all registered email notification templates organized by event type.
40
-
41
- #### Response
42
-
43
- ```json
44
- {
45
- "data": {
46
- "order_paid_admin": {
47
- "event": "order_paid_done",
48
- "group": "order",
49
- "group_label": "Order Actions",
50
- "title": "Send mail to admin after New Order Paid",
51
- "description": "This email will be sent to the admin after an order is placed.",
52
- "recipient": "admin",
53
- "smartcode_groups": [],
54
- "template_path": "order.paid.admin",
55
- "is_async": false,
56
- "pre_header": "You got a new order on your shop...",
57
- "name": "order_paid_admin",
58
- "settings": {
59
- "active": "yes",
60
- "subject": "New Sales On {{settings.store_name}}",
61
- "is_default_body": "yes",
62
- "email_body": ""
63
- }
64
- },
65
- "order_paid_customer": {
66
- "event": "order_paid",
67
- "group": "order",
68
- "group_label": "Order Actions",
69
- "title": "Purchase receipt to customer",
70
- "description": "This email will be sent to the customer after an order is placed.",
71
- "recipient": "customer",
72
- "smartcode_groups": [],
73
- "template_path": "order.paid.customer",
74
- "is_async": false,
75
- "name": "order_paid_customer",
76
- "settings": {
77
- "active": "yes",
78
- "subject": "Purchase Receipt #{{order.invoice_no}}",
79
- "is_default_body": "yes",
80
- "email_body": ""
81
- }
82
- }
83
- }
84
- }
85
- ```
86
-
87
- #### Registered Notifications Catalog
88
-
89
- ##### Order Actions (`group: order`)
90
-
91
- | Key | Event Hook | Recipient | Description |
92
- |-----|------------|-----------|-------------|
93
- | `order_paid_admin` | `order_paid_done` | `admin` | New order paid notification to admin |
94
- | `order_paid_customer` | `order_paid` | `customer` | Purchase receipt to customer |
95
- | `order_refunded_admin` | `order_refunded` | `admin` | Refund notification to admin |
96
- | `order_refunded_customer` | `order_refunded` | `customer` | Refund confirmation to customer |
97
- | `order_shipped_customer` | `shipping_status_changed_to_shipped` | `customer` | Shipping status notification to customer |
98
- | `order_delivered_customer` | `shipping_status_changed_to_delivered` | `customer` | Delivery status notification to customer |
99
- | `order_placed_admin` | `order_placed_offline` | `admin` | Offline payment order notification to admin |
100
- | `order_placed_customer` | `order_placed_offline` | `customer` | Offline payment confirmation to customer |
101
-
102
- ##### Subscription Actions (`group: subscription`)
103
-
104
- | Key | Event Hook | Recipient | Description |
105
- |-----|------------|-----------|-------------|
106
- | `subscription_renewal_customer` | `subscription_renewed` | `customer` | Renewal confirmation to customer |
107
- | `subscription_renewal_admin` | `subscription_renewed` | `admin` | Renewal notification to admin |
108
- | `subscription_canceled_customer` | `subscription_canceled` | `customer` | Cancellation notice to customer |
109
- | `subscription_canceled_admin` | `subscription_canceled` | `admin` | Cancellation notice to admin |
110
-
111
- ##### Scheduler / Reminder Actions (`group: scheduler`)
112
-
113
- | Key | Event Hook | Recipient | Description |
114
- |-----|------------|-----------|-------------|
115
- | `invoice_reminder_overdue_customer` | `invoice_reminder_overdue` | `customer` | Payment overdue reminder to customer |
116
- | `invoice_reminder_overdue_admin` | `invoice_reminder_overdue` | `admin` | Payment overdue copy to admin |
117
- | `subscription_renewal_reminder_customer` | `subscription_renewal_reminder` | `customer` | Upcoming renewal reminder to customer |
118
- | `subscription_renewal_reminder_admin` | `subscription_renewal_reminder` | `admin` | Upcoming renewal reminder copy to admin |
119
- | `subscription_trial_end_reminder_customer` | `subscription_trial_end_reminder` | `customer` | Trial ending soon reminder to customer |
120
- | `subscription_trial_end_reminder_admin` | `subscription_trial_end_reminder` | `admin` | Trial ending soon reminder copy to admin |
121
-
122
- #### Example
123
-
124
- ```bash
125
- curl -X GET "https://example.com/wp-json/fluent-cart/v2/email-notification" \
126
- -u "username:app_password"
127
- ```
128
-
129
- ---
130
-
131
- ### Get Single Notification
132
-
133
- `GET /fluent-cart/v2/email-notification/{notification}`
134
-
135
- Retrieve single template data and available merge tags for the email editor.
136
-
137
- #### Parameters
138
-
139
- | Parameter | Type | Location | Required | Description |
140
- |-----------|------|----------|----------|-------------|
141
- | `notification` | string | path | Yes | Notification key (e.g. `order_paid_customer`, `subscription_renewal_admin`) |
142
-
143
- #### Response
144
-
145
- ```json
146
- {
147
- "data": {
148
- "event": "order_paid",
149
- "group": "order",
150
- "group_label": "Order Actions",
151
- "title": "Purchase receipt to customer",
152
- "recipient": "customer",
153
- "template_path": "order.paid.customer",
154
- "is_async": false,
155
- "name": "order_paid_customer",
156
- "settings": {
157
- "active": "yes",
158
- "subject": "Purchase Receipt #{{order.invoice_no}}",
159
- "is_default_body": "yes",
160
- "email_body": ""
161
- }
162
- },
163
- "shortcodes": {
164
- "order": {
165
- "title": "Order",
166
- "key": "order",
167
- "shortcodes": {
168
- "{{order.id}}": "Order ID",
169
- "{{order.invoice_no}}": "Order Number",
170
- "{{order.status}}": "Order Status",
171
- "{{order.total_amount_formatted}}": "Order Total Amount (Formatted)"
172
- }
173
- },
174
- "general": {
175
- "title": "General",
176
- "key": "wp",
177
- "shortcodes": {
178
- "{{wp.admin_email}}": "Admin Email",
179
- "{{wp.site_url}}": "Site URL",
180
- "{{wp.site_title}}": "Site Title"
181
- }
182
- },
183
- "customer": {
184
- "title": "Customer",
185
- "key": "customer",
186
- "shortcodes": {
187
- "{{order.billing.first_name}}": "First Name",
188
- "{{order.billing.last_name}}": "Last Name",
189
- "{{order.billing.email}}": "Email"
190
- }
191
- },
192
- "transaction": {
193
- "title": "transaction",
194
- "key": "settings",
195
- "shortcodes": {
196
- "{{transaction.total_formatted}}": "Total Amount (Formatted)",
197
- "{{transaction.payment_method}}": "Payment Method",
198
- "{{transaction.status}}": "Status"
199
- }
200
- },
201
- "settings": {
202
- "title": "Settings",
203
- "key": "settings",
204
- "shortcodes": {
205
- "{{settings.store_name}}": "Store Name",
206
- "{{settings.store_logo}}": "Store Logo"
207
- }
208
- },
209
- "license": {
210
- "title": "License (Loop)",
211
- "key": "license",
212
- "shortcodes": {
213
- "{{license.key}}": "License Key",
214
- "{{license.status}}": "Status"
215
- }
216
- }
217
- }
218
- }
219
- ```
220
-
221
- ---
222
-
223
- ### Update Notification
224
-
225
- `PUT /fluent-cart/v2/email-notification/{notification}`
226
-
227
- Update email subject, custom HTML body content, and active toggle status.
228
-
229
- #### Parameters
230
-
231
- | Parameter | Type | Location | Required | Description |
232
- |-----------|------|----------|----------|-------------|
233
- | `notification` | string | path | Yes | Notification key (e.g. `order_paid_customer`) |
234
- | `settings.subject` | string | body | Yes | Email subject line (max 255 chars). Supports shortcodes |
235
- | `settings.email_body` | string | body | No | Custom email body HTML (sanitized with `wp_kses_post`) |
236
- | `settings.active` | string | body | No | `yes` or `no` |
237
- | `settings.is_default_body` | string | body | No | `yes` or `no`. When set to `yes`, custom `email_body` is cleared |
238
-
239
- #### Response
240
-
241
- ```json
242
- {
243
- "message": "Notification updated successfully"
244
- }
245
- ```
246
-
247
- #### Example
248
-
249
- ```bash
250
- curl -X PUT "https://example.com/wp-json/fluent-cart/v2/email-notification/order_paid_customer" \
251
- -u "username:app_password" \
252
- -H "Content-Type: application/json" \
253
- -d '{
254
- "settings": {
255
- "subject": "Your Order #{{order.invoice_no}} is Confirmed!",
256
- "email_body": "<p>Thank you for your purchase, {{order.billing.first_name}}!</p>",
257
- "active": "yes",
258
- "is_default_body": "no"
259
- }
260
- }'
261
- ```
262
-
263
- ---
264
-
265
- ### Enable/Disable Notification Toggle
266
-
267
- `POST /fluent-cart/v2/email-notification/enable-notification/{name}`
268
-
269
- Toggle a notification template on or off without altering subject or body content.
270
-
271
- #### Parameters
272
-
273
- | Parameter | Type | Location | Required | Description |
274
- |-----------|------|----------|----------|-------------|
275
- | `name` | string | path | Yes | Notification key (e.g. `order_refunded_admin`) |
276
- | `active` | string | body | Yes | `yes` to enable, `no` to disable |
277
-
278
- #### Response
279
-
280
- ```json
281
- {
282
- "message": "Notification updated successfully"
283
- }
284
- ```
285
-
286
- ---
287
-
288
- ### Get Editor Shortcodes & Buttons
289
-
290
- `GET /fluent-cart/v2/email-notification/get-short-codes`
291
-
292
- Retrieve complete list of merge tags, built-in email template keys, and button HTML presets for the email editor.
293
-
294
- #### Response
295
-
296
- ```json
297
- {
298
- "data": {
299
- "email_templates": [
300
- { "path": "fluent_cart_order_paid", "label": "Order Paid" },
301
- { "path": "fluent_cart_subscription_renewal", "label": "Subscription Renewal" }
302
- ],
303
- "shortcodes": {
304
- "order": {
305
- "title": "Order",
306
- "shortcodes": {
307
- "{{order.id}}": "Order ID",
308
- "{{order.customer_dashboard_link}}": "Customer Dashboard Link",
309
- "{{order.status}}": "Order Status",
310
- "{{order.invoice_no}}": "Order Number",
311
- "{{order.total_amount_formatted}}": "Order Total Amount (Formatted)",
312
- "{{order.created_at}}": "Order Create Date"
313
- }
314
- },
315
- "general": {
316
- "title": "General",
317
- "shortcodes": {
318
- "{{wp.admin_email}}": "Admin Email",
319
- "{{wp.site_url}}": "Site URL",
320
- "{{wp.site_title}}": "Site Title",
321
- "{{user.display_name}}": "User Display Name",
322
- "{{user.user_email}}": "User Email"
323
- }
324
- },
325
- "customer": {
326
- "title": "Customer",
327
- "shortcodes": {
328
- "{{order.billing.first_name}}": "First Name",
329
- "{{order.billing.last_name}}": "Last Name",
330
- "{{order.billing.email}}": "Email",
331
- "{{order.billing.city}}": "City",
332
- "{{order.billing.state}}": "State",
333
- "{{order.billing.country}}": "Country"
334
- }
335
- },
336
- "transaction": {
337
- "title": "transaction",
338
- "shortcodes": {
339
- "{{transaction.total}}": "Total Amount",
340
- "{{transaction.total_formatted}}": "Total Amount (Formatted)",
341
- "{{transaction.refund_amount}}": "Refund Amount",
342
- "{{transaction.refund_amount_formatted}}": "Refund Amount (Formatted)",
343
- "{{transaction.payment_method}}": "Payment Method",
344
- "{{transaction.card_last_4}}": "Card Last 4",
345
- "{{transaction.card_brand}}": "Card Brand",
346
- "{{transaction.status}}": "Status",
347
- "{{transaction.currency}}": "Currency"
348
- }
349
- },
350
- "settings": {
351
- "title": "Settings",
352
- "shortcodes": {
353
- "{{settings.store_name}}": "Store Name",
354
- "{{settings.store_logo}}": "Store Logo",
355
- "{{settings.store_address}}": "Store Address Line 1",
356
- "{{settings.store_address2}}": "Store Address Line 2",
357
- "{{settings.store_country}}": "Store Country",
358
- "{{settings.store_state}}": "Store State",
359
- "{{settings.store_city}}": "Store City",
360
- "{{settings.store_postcode}}": "Store Postcode"
361
- }
362
- },
363
- "license": {
364
- "title": "License (Loop)",
365
- "shortcodes": {
366
- "{{license.sl}}": "Serial Number",
367
- "{{license.key}}": "License Key",
368
- "{{license.status}}": "Status",
369
- "{{license.product_name}}": "Product Name",
370
- "{{license.variant}}": "Variant",
371
- "{{license.limit}}": "Activation Limit",
372
- "{{license.activation_count}}": "Activation Count",
373
- "{{license.expiration_date}}": "Expiration Date"
374
- }
375
- }
376
- },
377
- "buttons": {
378
- "View Order": "<a href=\"https://example.com/wp-admin/admin.php?page=fluent-cart#/orders/{{order.id}}/view\" style=\"background-color: green; color: #fff; padding: 10px 20px; text-decoration: none; border-radius: 5px;\">View Order</a>"
379
- }
380
- }
381
- }
382
- ```
383
-
384
- ---
385
-
386
- ## Global Email Settings
387
-
388
- Manage store sender name, sender email, reply-to addresses, admin notification recipients, and email footers.
389
-
390
- **Prefix:** `/fluent-cart/v2/email-notification` | **Policy:** `StoreSensitivePolicy` (`store/sensitive`)
391
-
392
- ### Get Global Email Settings
393
-
394
- `GET /fluent-cart/v2/email-notification/get-settings`
395
-
396
- #### Response
397
-
398
- ```json
399
- {
400
- "data": {
401
- "from_name": "My Store",
402
- "from_email": "store@example.com",
403
- "reply_to_name": "",
404
- "reply_to_email": "",
405
- "email_footer": "<p>Thank you for shopping with us!</p>",
406
- "show_email_footer": "yes",
407
- "admin_email": "{{wp.admin_email}}",
408
- "notification_config": {}
409
- },
410
- "shortcodes": []
411
- }
412
- ```
413
-
414
- ---
415
-
416
- ### Save Global Email Settings
417
-
418
- `POST /fluent-cart/v2/email-notification/save-settings`
419
-
420
- #### Parameters
421
-
422
- | Parameter | Type | Location | Required | Description |
423
- |-----------|------|----------|----------|-------------|
424
- | `from_name` | string | body | Yes | Sender name (max 255 chars) |
425
- | `from_email` | string | body | Yes | Sender email address (valid email, max 255 chars) |
426
- | `reply_to_name` | string | body | No | Reply-to name (max 255 chars) |
427
- | `reply_to_email` | string | body | No | Reply-to email address (valid email, max 255 chars) |
428
- | `email_footer` | string | body | No | HTML content for email footer (sanitized with `wp_kses_post`) |
429
- | `admin_email` | string | body | Yes | Admin notification recipient email(s). Supports shortcodes like `{{wp.admin_email}}` |
430
- | `show_email_footer` | string | body | No | `yes` or `no`. (On free plans, forced to `yes`) |
431
-
432
- #### Response
433
-
434
- ```json
435
- {
436
- "message": "Email settings saved successfully"
437
- }
438
- ```
439
-
440
- #### Example
441
-
442
- ```bash
443
- curl -X POST "https://example.com/wp-json/fluent-cart/v2/email-notification/save-settings" \
444
- -u "username:app_password" \
445
- -H "Content-Type: application/json" \
446
- -d '{
447
- "from_name": "My Store",
448
- "from_email": "noreply@example.com",
449
- "reply_to_name": "Support",
450
- "reply_to_email": "support@example.com",
451
- "email_footer": "<p>Thank you for shopping with us!</p>",
452
- "admin_email": "admin@example.com",
453
- "show_email_footer": "yes"
454
- }'
455
- ```
456
-
457
- ---
458
-
459
- ## Automated Scheduling & Reminders
460
-
461
- Configure payment overdue reminders, subscription renewal notifications, and trial expiration warnings.
462
-
463
- **Prefix:** `/fluent-cart/v2/email-notification/reminders` | **Policy:** `StoreSensitivePolicy` (`store/sensitive`)
464
-
465
- ### Get Scheduling Settings
466
-
467
- `GET /fluent-cart/v2/email-notification/reminders`
468
-
469
- ---
470
-
471
- ### Save Scheduling Settings
472
-
473
- `POST /fluent-cart/v2/email-notification/reminders`
474
-
475
- #### Parameters
476
-
477
- | Parameter | Type | Location | Required | Description |
478
- |-----------|------|----------|----------|-------------|
479
- | `reminders_enabled` | string | body | No | Master toggle for all automated reminders: `yes` or `no` |
480
- | `invoice_reminders_enabled` | string | body | No | Enable invoice payment reminders: `yes` or `no` |
481
- | `invoice_reminder_due_days` | integer | body | No | Days before due date to send reminder (0-365). Required when invoice reminders enabled |
482
- | `invoice_reminder_overdue_days` | string | body | No | Comma-separated day intervals for overdue reminders (e.g. `1,3,7`) |
483
- | `yearly_renewal_reminders_enabled` | string | body | No | Enable yearly subscription renewal reminders: `yes` or `no` |
484
- | `yearly_renewal_reminder_days` | integer | body | No | Days before renewal to send reminder (7-90). Required when yearly reminders enabled |
485
- | `trial_end_reminders_enabled` | string | body | No | Enable trial ending reminders: `yes` or `no` |
486
- | `trial_end_reminder_days` | integer | body | No | Days before trial ends to send reminder (1-14). Required when trial end reminders enabled |
487
- | `monthly_renewal_reminders_enabled` | string | body | No | Enable monthly renewal reminders: `yes` or `no` |
488
- | `monthly_renewal_reminder_days` | integer | body | No | Days before renewal to send reminder (3-28). Required when monthly reminders enabled |
489
- | `quarterly_renewal_reminders_enabled` | string | body | No | Enable quarterly renewal reminders: `yes` or `no` |
490
- | `quarterly_renewal_reminder_days` | integer | body | No | Days before renewal to send reminder (7-60). Required when quarterly reminders enabled |
491
- | `half_yearly_renewal_reminders_enabled` | string | body | No | Enable half-yearly renewal reminders: `yes` or `no` |
492
- | `half_yearly_renewal_reminder_days` | integer | body | No | Days before renewal to send reminder (7-60). Required when half-yearly reminders enabled |
493
-
494
- #### Validation Rules (Enforced When Toggle is Enabled)
495
-
496
- | Enabled Toggle | Days Field | Allowed Range |
497
- |----------------|------------|---------------|
498
- | `invoice_reminders_enabled` | `invoice_reminder_due_days` | Integer, min: 0, max: 365 |
499
- | `yearly_renewal_reminders_enabled` | `yearly_renewal_reminder_days` | Integer, min: 7, max: 90 |
500
- | `trial_end_reminders_enabled` | `trial_end_reminder_days` | Integer, min: 1, max: 14 |
501
- | `monthly_renewal_reminders_enabled` | `monthly_renewal_reminder_days` | Integer, min: 3, max: 28 |
502
- | `quarterly_renewal_reminders_enabled` | `quarterly_renewal_reminder_days` | Integer, min: 7, max: 60 |
503
- | `half_yearly_renewal_reminders_enabled` | `half_yearly_renewal_reminder_days` | Integer, min: 7, max: 60 |
504
-
505
- #### Response
506
-
507
- ```json
508
- {
509
- "data": {},
510
- "message": "Scheduling settings saved successfully"
511
- }
512
- ```
513
-
514
- ---
515
-
516
- ## Template HTML Previews
517
-
518
- Render real-time email previews for block editor templates or default PHP templates.
519
-
520
- **Prefix:** `/fluent-cart/v2/email-notification` | **Policy:** `StoreSensitivePolicy` (`store/sensitive`)
521
-
522
- ### Preview Custom Notification Template
523
-
524
- `POST /fluent-cart/v2/email-notification/preview`
525
-
526
- Generate an HTML preview of a custom block-editor notification template using actual order data or fallbacks.
527
-
528
- #### Parameters
529
-
530
- | Parameter | Type | Location | Required | Description |
531
- |-----------|------|----------|----------|-------------|
532
- | `notification_name` | string | body | Yes | Notification key (e.g., `order_paid_customer`) |
533
- | `order_id` | integer | body | No | Specific order ID for merge tag values. Defaults to latest order |
534
-
535
- #### Response
536
-
537
- ```json
538
- {
539
- "html": "<!DOCTYPE html><html>...rendered email HTML...</html>"
540
- }
541
- ```
542
-
543
- ---
544
-
545
- ### Preview Default PHP Template
546
-
547
- `POST /fluent-cart/v2/email-notification/preview-default-template`
548
-
549
- Generate an HTML preview of a built-in PHP email template rendered with dummy data and disabled links.
550
-
551
- #### Parameters
552
-
553
- | Parameter | Type | Location | Required | Description |
554
- |-----------|------|----------|----------|-------------|
555
- | `template` | string | body | Yes | Template path key (e.g. `order.paid.customer`, `subscription.renewal.admin`) |
556
-
557
- #### Registered Template Paths Catalog
558
-
559
- | Template Path | Target Event / Description |
560
- |---------------|---------------------------|
561
- | `order.paid.admin` | Admin notification for paid order |
562
- | `order.paid.customer` | Customer receipt for paid order |
563
- | `order.refunded.admin` | Admin notification for refund |
564
- | `order.refunded.customer` | Customer refund confirmation |
565
- | `order.shipped.customer` | Customer shipping notification |
566
- | `order.delivered.customer` | Customer delivery notification |
567
- | `order.placed.admin` | Admin notification for offline payment order |
568
- | `order.placed.customer` | Customer confirmation for offline payment order |
569
- | `order.reminder.overdue.customer` | Customer payment reminder |
570
- | `order.reminder.overdue.admin` | Admin copy of payment reminder |
571
- | `subscription.renewal.customer` | Customer renewal confirmation |
572
- | `subscription.renewal.admin` | Admin renewal notification |
573
- | `subscription.canceled.customer` | Customer cancellation notice |
574
- | `subscription.canceled.admin` | Admin cancellation notice |
575
- | `subscription.reminder.customer` | Customer renewal reminder |
576
- | `subscription.reminder.admin` | Admin copy of renewal reminder |
577
- | `subscription.trial_end.customer` | Customer trial ending reminder |
578
- | `subscription.trial_end.admin` | Admin copy of trial ending reminder |
579
-
580
- #### Response
581
-
582
- ```json
583
- {
584
- "data": {
585
- "content": "<!DOCTYPE html><html>...rendered email HTML...</html>"
586
- }
587
- }
588
- ```
589
-
590
- ---
591
-
592
- ## Data Models
593
-
594
- ### Notification Object
595
-
596
- | Property | Type | Description |
597
- |----------|------|-------------|
598
- | `name` | string | Unique notification key identifier |
599
- | `event` | string | Event hook triggering notification |
600
- | `group` | string | Category: `order`, `subscription`, or `scheduler` |
601
- | `group_label` | string | Human-readable group label |
602
- | `title` | string | Descriptive title |
603
- | `description` | string | Explanation of notification trigger |
604
- | `recipient` | string | Target recipient: `admin` or `customer` |
605
- | `smartcode_groups` | array | Additional shortcode groups |
606
- | `template_path` | string | Dot-notation path to built-in PHP template |
607
- | `is_async` | boolean | Whether email is dispatched asynchronously |
608
- | `pre_header` | string | Email pre-header text (admin emails) |
609
- | `manage_toggle` | string | If set to `no`, notification cannot be disabled |
610
- | `settings` | object | Notification settings object |
611
-
612
- ### Notification Settings Object
613
-
614
- | Property | Type | Description |
615
- |----------|------|-------------|
616
- | `active` | string | Enabled toggle: `yes` or `no` |
617
- | `subject` | string | Email subject line (supports shortcodes) |
618
- | `is_default_body` | string | Use built-in PHP template: `yes` or `no` |
619
- | `email_body` | string | Custom email body HTML (cleared when `is_default_body` is `yes`) |
1
+ # Email Notifications API
2
+
3
+ Configure email notification templates, manage scheduling reminders, preview custom/default templates, and update global email settings in FluentCart.
4
+
5
+ **Base URL:** `https://your-site.com/wp-json/fluent-cart/v2/email-notification`
6
+ **Policy:** `StoreSensitivePolicy`
7
+ **Permission:** `store/sensitive`
8
+
9
+ ---
10
+
11
+ ## Endpoints Overview
12
+
13
+ | Group | Method | Endpoint | Description |
14
+ |-------|--------|----------|-------------|
15
+ | **Notification Templates** | GET | `/email-notification` | List all registered email notification templates |
16
+ | | GET | `/email-notification/{notification}` | Get single notification details & shortcodes |
17
+ | | PUT | `/email-notification/{notification}` | Update notification subject, body, & active status |
18
+ | | POST | `/email-notification/enable-notification/{name}` | Quick toggle enable/disable status |
19
+ | | GET | `/email-notification/get-short-codes` | Get editor shortcodes, template paths, & button presets |
20
+ | **Global Email Settings** | GET | `/email-notification/get-settings` | Get global sender name, email, footer, & admin recipients |
21
+ | | POST | `/email-notification/save-settings` | Update global email configuration settings |
22
+ | **Scheduling & Reminders** | GET | `/email-notification/reminders` | Get automated email reminder schedule settings & fields |
23
+ | | POST | `/email-notification/reminders` | Update reminder schedule days & toggles |
24
+ | **Template Previews** | POST | `/email-notification/preview` | Render HTML preview for custom block-editor notification |
25
+ | | POST | `/email-notification/preview-default-template` | Render HTML preview for default PHP email template |
26
+
27
+ ---
28
+
29
+ ## Notification Templates
30
+
31
+ Manage order, subscription, and reminder email templates.
32
+
33
+ **Prefix:** `/fluent-cart/v2/email-notification` | **Policy:** `StoreSensitivePolicy` (`store/sensitive`)
34
+
35
+ ### List All Notifications
36
+
37
+ `GET /fluent-cart/v2/email-notification`
38
+
39
+ Retrieve all registered email notification templates organized by event type.
40
+
41
+ #### Response
42
+
43
+ ```json
44
+ {
45
+ "data": {
46
+ "order_paid_admin": {
47
+ "event": "order_paid_done",
48
+ "group": "order",
49
+ "group_label": "Order Actions",
50
+ "title": "Send mail to admin after New Order Paid",
51
+ "description": "This email will be sent to the admin after an order is placed.",
52
+ "recipient": "admin",
53
+ "smartcode_groups": [],
54
+ "template_path": "order.paid.admin",
55
+ "is_async": false,
56
+ "pre_header": "You got a new order on your shop...",
57
+ "name": "order_paid_admin",
58
+ "settings": {
59
+ "active": "yes",
60
+ "subject": "New Sales On {{settings.store_name}}",
61
+ "is_default_body": "yes",
62
+ "email_body": ""
63
+ }
64
+ },
65
+ "order_paid_customer": {
66
+ "event": "order_paid",
67
+ "group": "order",
68
+ "group_label": "Order Actions",
69
+ "title": "Purchase receipt to customer",
70
+ "description": "This email will be sent to the customer after an order is placed.",
71
+ "recipient": "customer",
72
+ "smartcode_groups": [],
73
+ "template_path": "order.paid.customer",
74
+ "is_async": false,
75
+ "name": "order_paid_customer",
76
+ "settings": {
77
+ "active": "yes",
78
+ "subject": "Purchase Receipt #{{order.invoice_no}}",
79
+ "is_default_body": "yes",
80
+ "email_body": ""
81
+ }
82
+ }
83
+ }
84
+ }
85
+ ```
86
+
87
+ #### Registered Notifications Catalog
88
+
89
+ ##### Order Actions (`group: order`)
90
+
91
+ | Key | Event Hook | Recipient | Description |
92
+ |-----|------------|-----------|-------------|
93
+ | `order_paid_admin` | `order_paid_done` | `admin` | New order paid notification to admin |
94
+ | `order_paid_customer` | `order_paid` | `customer` | Purchase receipt to customer |
95
+ | `order_refunded_admin` | `order_refunded` | `admin` | Refund notification to admin |
96
+ | `order_refunded_customer` | `order_refunded` | `customer` | Refund confirmation to customer |
97
+ | `order_shipped_customer` | `shipping_status_changed_to_shipped` | `customer` | Shipping status notification to customer |
98
+ | `order_delivered_customer` | `shipping_status_changed_to_delivered` | `customer` | Delivery status notification to customer |
99
+ | `order_placed_admin` | `order_placed_offline` | `admin` | Offline payment order notification to admin |
100
+ | `order_placed_customer` | `order_placed_offline` | `customer` | Offline payment confirmation to customer |
101
+
102
+ ##### Subscription Actions (`group: subscription`)
103
+
104
+ | Key | Event Hook | Recipient | Description |
105
+ |-----|------------|-----------|-------------|
106
+ | `subscription_renewal_customer` | `subscription_renewed` | `customer` | Renewal confirmation to customer |
107
+ | `subscription_renewal_admin` | `subscription_renewed` | `admin` | Renewal notification to admin |
108
+ | `subscription_canceled_customer` | `subscription_canceled` | `customer` | Cancellation notice to customer |
109
+ | `subscription_canceled_admin` | `subscription_canceled` | `admin` | Cancellation notice to admin |
110
+
111
+ ##### Scheduler / Reminder Actions (`group: scheduler`)
112
+
113
+ | Key | Event Hook | Recipient | Description |
114
+ |-----|------------|-----------|-------------|
115
+ | `invoice_reminder_overdue_customer` | `invoice_reminder_overdue` | `customer` | Payment overdue reminder to customer |
116
+ | `invoice_reminder_overdue_admin` | `invoice_reminder_overdue` | `admin` | Payment overdue copy to admin |
117
+ | `subscription_renewal_reminder_customer` | `subscription_renewal_reminder` | `customer` | Upcoming renewal reminder to customer |
118
+ | `subscription_renewal_reminder_admin` | `subscription_renewal_reminder` | `admin` | Upcoming renewal reminder copy to admin |
119
+ | `subscription_trial_end_reminder_customer` | `subscription_trial_end_reminder` | `customer` | Trial ending soon reminder to customer |
120
+ | `subscription_trial_end_reminder_admin` | `subscription_trial_end_reminder` | `admin` | Trial ending soon reminder copy to admin |
121
+
122
+ #### Example
123
+
124
+ ```bash
125
+ curl -X GET "https://example.com/wp-json/fluent-cart/v2/email-notification" \
126
+ -u "username:app_password"
127
+ ```
128
+
129
+ ---
130
+
131
+ ### Get Single Notification
132
+
133
+ `GET /fluent-cart/v2/email-notification/{notification}`
134
+
135
+ Retrieve single template data and available merge tags for the email editor.
136
+
137
+ #### Parameters
138
+
139
+ | Parameter | Type | Location | Required | Description |
140
+ |-----------|------|----------|----------|-------------|
141
+ | `notification` | string | path | Yes | Notification key (e.g. `order_paid_customer`, `subscription_renewal_admin`) |
142
+
143
+ #### Response
144
+
145
+ ```json
146
+ {
147
+ "data": {
148
+ "event": "order_paid",
149
+ "group": "order",
150
+ "group_label": "Order Actions",
151
+ "title": "Purchase receipt to customer",
152
+ "recipient": "customer",
153
+ "template_path": "order.paid.customer",
154
+ "is_async": false,
155
+ "name": "order_paid_customer",
156
+ "settings": {
157
+ "active": "yes",
158
+ "subject": "Purchase Receipt #{{order.invoice_no}}",
159
+ "is_default_body": "yes",
160
+ "email_body": ""
161
+ }
162
+ },
163
+ "shortcodes": {
164
+ "order": {
165
+ "title": "Order",
166
+ "key": "order",
167
+ "shortcodes": {
168
+ "{{order.id}}": "Order ID",
169
+ "{{order.invoice_no}}": "Order Number",
170
+ "{{order.status}}": "Order Status",
171
+ "{{order.total_amount_formatted}}": "Order Total Amount (Formatted)"
172
+ }
173
+ },
174
+ "general": {
175
+ "title": "General",
176
+ "key": "wp",
177
+ "shortcodes": {
178
+ "{{wp.admin_email}}": "Admin Email",
179
+ "{{wp.site_url}}": "Site URL",
180
+ "{{wp.site_title}}": "Site Title"
181
+ }
182
+ },
183
+ "customer": {
184
+ "title": "Customer",
185
+ "key": "customer",
186
+ "shortcodes": {
187
+ "{{order.billing.first_name}}": "First Name",
188
+ "{{order.billing.last_name}}": "Last Name",
189
+ "{{order.billing.email}}": "Email"
190
+ }
191
+ },
192
+ "transaction": {
193
+ "title": "transaction",
194
+ "key": "settings",
195
+ "shortcodes": {
196
+ "{{transaction.total_formatted}}": "Total Amount (Formatted)",
197
+ "{{transaction.payment_method}}": "Payment Method",
198
+ "{{transaction.status}}": "Status"
199
+ }
200
+ },
201
+ "settings": {
202
+ "title": "Settings",
203
+ "key": "settings",
204
+ "shortcodes": {
205
+ "{{settings.store_name}}": "Store Name",
206
+ "{{settings.store_logo}}": "Store Logo"
207
+ }
208
+ },
209
+ "license": {
210
+ "title": "License (Loop)",
211
+ "key": "license",
212
+ "shortcodes": {
213
+ "{{license.key}}": "License Key",
214
+ "{{license.status}}": "Status"
215
+ }
216
+ }
217
+ }
218
+ }
219
+ ```
220
+
221
+ ---
222
+
223
+ ### Update Notification
224
+
225
+ `PUT /fluent-cart/v2/email-notification/{notification}`
226
+
227
+ Update email subject, custom HTML body content, and active toggle status.
228
+
229
+ #### Parameters
230
+
231
+ | Parameter | Type | Location | Required | Description |
232
+ |-----------|------|----------|----------|-------------|
233
+ | `notification` | string | path | Yes | Notification key (e.g. `order_paid_customer`) |
234
+ | `settings.subject` | string | body | Yes | Email subject line (max 255 chars). Supports shortcodes |
235
+ | `settings.email_body` | string | body | No | Custom email body HTML (sanitized with `wp_kses_post`) |
236
+ | `settings.active` | string | body | No | `yes` or `no` |
237
+ | `settings.is_default_body` | string | body | No | `yes` or `no`. When set to `yes`, custom `email_body` is cleared |
238
+
239
+ #### Response
240
+
241
+ ```json
242
+ {
243
+ "message": "Notification updated successfully"
244
+ }
245
+ ```
246
+
247
+ #### Example
248
+
249
+ ```bash
250
+ curl -X PUT "https://example.com/wp-json/fluent-cart/v2/email-notification/order_paid_customer" \
251
+ -u "username:app_password" \
252
+ -H "Content-Type: application/json" \
253
+ -d '{
254
+ "settings": {
255
+ "subject": "Your Order #{{order.invoice_no}} is Confirmed!",
256
+ "email_body": "<p>Thank you for your purchase, {{order.billing.first_name}}!</p>",
257
+ "active": "yes",
258
+ "is_default_body": "no"
259
+ }
260
+ }'
261
+ ```
262
+
263
+ ---
264
+
265
+ ### Enable/Disable Notification Toggle
266
+
267
+ `POST /fluent-cart/v2/email-notification/enable-notification/{name}`
268
+
269
+ Toggle a notification template on or off without altering subject or body content.
270
+
271
+ #### Parameters
272
+
273
+ | Parameter | Type | Location | Required | Description |
274
+ |-----------|------|----------|----------|-------------|
275
+ | `name` | string | path | Yes | Notification key (e.g. `order_refunded_admin`) |
276
+ | `active` | string | body | Yes | `yes` to enable, `no` to disable |
277
+
278
+ #### Response
279
+
280
+ ```json
281
+ {
282
+ "message": "Notification updated successfully"
283
+ }
284
+ ```
285
+
286
+ ---
287
+
288
+ ### Get Editor Shortcodes & Buttons
289
+
290
+ `GET /fluent-cart/v2/email-notification/get-short-codes`
291
+
292
+ Retrieve complete list of merge tags, built-in email template keys, and button HTML presets for the email editor.
293
+
294
+ #### Response
295
+
296
+ ```json
297
+ {
298
+ "data": {
299
+ "email_templates": [
300
+ { "path": "fluent_cart_order_paid", "label": "Order Paid" },
301
+ { "path": "fluent_cart_subscription_renewal", "label": "Subscription Renewal" }
302
+ ],
303
+ "shortcodes": {
304
+ "order": {
305
+ "title": "Order",
306
+ "shortcodes": {
307
+ "{{order.id}}": "Order ID",
308
+ "{{order.customer_dashboard_link}}": "Customer Dashboard Link",
309
+ "{{order.status}}": "Order Status",
310
+ "{{order.invoice_no}}": "Order Number",
311
+ "{{order.total_amount_formatted}}": "Order Total Amount (Formatted)",
312
+ "{{order.created_at}}": "Order Create Date"
313
+ }
314
+ },
315
+ "general": {
316
+ "title": "General",
317
+ "shortcodes": {
318
+ "{{wp.admin_email}}": "Admin Email",
319
+ "{{wp.site_url}}": "Site URL",
320
+ "{{wp.site_title}}": "Site Title",
321
+ "{{user.display_name}}": "User Display Name",
322
+ "{{user.user_email}}": "User Email"
323
+ }
324
+ },
325
+ "customer": {
326
+ "title": "Customer",
327
+ "shortcodes": {
328
+ "{{order.billing.first_name}}": "First Name",
329
+ "{{order.billing.last_name}}": "Last Name",
330
+ "{{order.billing.email}}": "Email",
331
+ "{{order.billing.city}}": "City",
332
+ "{{order.billing.state}}": "State",
333
+ "{{order.billing.country}}": "Country"
334
+ }
335
+ },
336
+ "transaction": {
337
+ "title": "transaction",
338
+ "shortcodes": {
339
+ "{{transaction.total}}": "Total Amount",
340
+ "{{transaction.total_formatted}}": "Total Amount (Formatted)",
341
+ "{{transaction.refund_amount}}": "Refund Amount",
342
+ "{{transaction.refund_amount_formatted}}": "Refund Amount (Formatted)",
343
+ "{{transaction.payment_method}}": "Payment Method",
344
+ "{{transaction.card_last_4}}": "Card Last 4",
345
+ "{{transaction.card_brand}}": "Card Brand",
346
+ "{{transaction.status}}": "Status",
347
+ "{{transaction.currency}}": "Currency"
348
+ }
349
+ },
350
+ "settings": {
351
+ "title": "Settings",
352
+ "shortcodes": {
353
+ "{{settings.store_name}}": "Store Name",
354
+ "{{settings.store_logo}}": "Store Logo",
355
+ "{{settings.store_address}}": "Store Address Line 1",
356
+ "{{settings.store_address2}}": "Store Address Line 2",
357
+ "{{settings.store_country}}": "Store Country",
358
+ "{{settings.store_state}}": "Store State",
359
+ "{{settings.store_city}}": "Store City",
360
+ "{{settings.store_postcode}}": "Store Postcode"
361
+ }
362
+ },
363
+ "license": {
364
+ "title": "License (Loop)",
365
+ "shortcodes": {
366
+ "{{license.sl}}": "Serial Number",
367
+ "{{license.key}}": "License Key",
368
+ "{{license.status}}": "Status",
369
+ "{{license.product_name}}": "Product Name",
370
+ "{{license.variant}}": "Variant",
371
+ "{{license.limit}}": "Activation Limit",
372
+ "{{license.activation_count}}": "Activation Count",
373
+ "{{license.expiration_date}}": "Expiration Date"
374
+ }
375
+ }
376
+ },
377
+ "buttons": {
378
+ "View Order": "<a href=\"https://example.com/wp-admin/admin.php?page=fluent-cart#/orders/{{order.id}}/view\" style=\"background-color: green; color: #fff; padding: 10px 20px; text-decoration: none; border-radius: 5px;\">View Order</a>"
379
+ }
380
+ }
381
+ }
382
+ ```
383
+
384
+ ---
385
+
386
+ ## Global Email Settings
387
+
388
+ Manage store sender name, sender email, reply-to addresses, admin notification recipients, and email footers.
389
+
390
+ **Prefix:** `/fluent-cart/v2/email-notification` | **Policy:** `StoreSensitivePolicy` (`store/sensitive`)
391
+
392
+ ### Get Global Email Settings
393
+
394
+ `GET /fluent-cart/v2/email-notification/get-settings`
395
+
396
+ #### Response
397
+
398
+ ```json
399
+ {
400
+ "data": {
401
+ "from_name": "My Store",
402
+ "from_email": "store@example.com",
403
+ "reply_to_name": "",
404
+ "reply_to_email": "",
405
+ "email_footer": "<p>Thank you for shopping with us!</p>",
406
+ "show_email_footer": "yes",
407
+ "admin_email": "{{wp.admin_email}}",
408
+ "notification_config": {}
409
+ },
410
+ "shortcodes": []
411
+ }
412
+ ```
413
+
414
+ ---
415
+
416
+ ### Save Global Email Settings
417
+
418
+ `POST /fluent-cart/v2/email-notification/save-settings`
419
+
420
+ #### Parameters
421
+
422
+ | Parameter | Type | Location | Required | Description |
423
+ |-----------|------|----------|----------|-------------|
424
+ | `from_name` | string | body | Yes | Sender name (max 255 chars) |
425
+ | `from_email` | string | body | Yes | Sender email address (valid email, max 255 chars) |
426
+ | `reply_to_name` | string | body | No | Reply-to name (max 255 chars) |
427
+ | `reply_to_email` | string | body | No | Reply-to email address (valid email, max 255 chars) |
428
+ | `email_footer` | string | body | No | HTML content for email footer (sanitized with `wp_kses_post`) |
429
+ | `admin_email` | string | body | Yes | Admin notification recipient email(s). Supports shortcodes like `{{wp.admin_email}}` |
430
+ | `show_email_footer` | string | body | No | `yes` or `no`. (On free plans, forced to `yes`) |
431
+
432
+ #### Response
433
+
434
+ ```json
435
+ {
436
+ "message": "Email settings saved successfully"
437
+ }
438
+ ```
439
+
440
+ #### Example
441
+
442
+ ```bash
443
+ curl -X POST "https://example.com/wp-json/fluent-cart/v2/email-notification/save-settings" \
444
+ -u "username:app_password" \
445
+ -H "Content-Type: application/json" \
446
+ -d '{
447
+ "from_name": "My Store",
448
+ "from_email": "noreply@example.com",
449
+ "reply_to_name": "Support",
450
+ "reply_to_email": "support@example.com",
451
+ "email_footer": "<p>Thank you for shopping with us!</p>",
452
+ "admin_email": "admin@example.com",
453
+ "show_email_footer": "yes"
454
+ }'
455
+ ```
456
+
457
+ ---
458
+
459
+ ## Automated Scheduling & Reminders
460
+
461
+ Configure payment overdue reminders, subscription renewal notifications, and trial expiration warnings.
462
+
463
+ **Prefix:** `/fluent-cart/v2/email-notification/reminders` | **Policy:** `StoreSensitivePolicy` (`store/sensitive`)
464
+
465
+ ### Get Scheduling Settings
466
+
467
+ `GET /fluent-cart/v2/email-notification/reminders`
468
+
469
+ ---
470
+
471
+ ### Save Scheduling Settings
472
+
473
+ `POST /fluent-cart/v2/email-notification/reminders`
474
+
475
+ #### Parameters
476
+
477
+ | Parameter | Type | Location | Required | Description |
478
+ |-----------|------|----------|----------|-------------|
479
+ | `reminders_enabled` | string | body | No | Master toggle for all automated reminders: `yes` or `no` |
480
+ | `invoice_reminders_enabled` | string | body | No | Enable invoice payment reminders: `yes` or `no` |
481
+ | `invoice_reminder_due_days` | integer | body | No | Days before due date to send reminder (0-365). Required when invoice reminders enabled |
482
+ | `invoice_reminder_overdue_days` | string | body | No | Comma-separated day intervals for overdue reminders (e.g. `1,3,7`) |
483
+ | `yearly_renewal_reminders_enabled` | string | body | No | Enable yearly subscription renewal reminders: `yes` or `no` |
484
+ | `yearly_renewal_reminder_days` | integer | body | No | Days before renewal to send reminder (7-90). Required when yearly reminders enabled |
485
+ | `trial_end_reminders_enabled` | string | body | No | Enable trial ending reminders: `yes` or `no` |
486
+ | `trial_end_reminder_days` | integer | body | No | Days before trial ends to send reminder (1-14). Required when trial end reminders enabled |
487
+ | `monthly_renewal_reminders_enabled` | string | body | No | Enable monthly renewal reminders: `yes` or `no` |
488
+ | `monthly_renewal_reminder_days` | integer | body | No | Days before renewal to send reminder (3-28). Required when monthly reminders enabled |
489
+ | `quarterly_renewal_reminders_enabled` | string | body | No | Enable quarterly renewal reminders: `yes` or `no` |
490
+ | `quarterly_renewal_reminder_days` | integer | body | No | Days before renewal to send reminder (7-60). Required when quarterly reminders enabled |
491
+ | `half_yearly_renewal_reminders_enabled` | string | body | No | Enable half-yearly renewal reminders: `yes` or `no` |
492
+ | `half_yearly_renewal_reminder_days` | integer | body | No | Days before renewal to send reminder (7-60). Required when half-yearly reminders enabled |
493
+
494
+ #### Validation Rules (Enforced When Toggle is Enabled)
495
+
496
+ | Enabled Toggle | Days Field | Allowed Range |
497
+ |----------------|------------|---------------|
498
+ | `invoice_reminders_enabled` | `invoice_reminder_due_days` | Integer, min: 0, max: 365 |
499
+ | `yearly_renewal_reminders_enabled` | `yearly_renewal_reminder_days` | Integer, min: 7, max: 90 |
500
+ | `trial_end_reminders_enabled` | `trial_end_reminder_days` | Integer, min: 1, max: 14 |
501
+ | `monthly_renewal_reminders_enabled` | `monthly_renewal_reminder_days` | Integer, min: 3, max: 28 |
502
+ | `quarterly_renewal_reminders_enabled` | `quarterly_renewal_reminder_days` | Integer, min: 7, max: 60 |
503
+ | `half_yearly_renewal_reminders_enabled` | `half_yearly_renewal_reminder_days` | Integer, min: 7, max: 60 |
504
+
505
+ #### Response
506
+
507
+ ```json
508
+ {
509
+ "data": {},
510
+ "message": "Scheduling settings saved successfully"
511
+ }
512
+ ```
513
+
514
+ ---
515
+
516
+ ## Template HTML Previews
517
+
518
+ Render real-time email previews for block editor templates or default PHP templates.
519
+
520
+ **Prefix:** `/fluent-cart/v2/email-notification` | **Policy:** `StoreSensitivePolicy` (`store/sensitive`)
521
+
522
+ ### Preview Custom Notification Template
523
+
524
+ `POST /fluent-cart/v2/email-notification/preview`
525
+
526
+ Generate an HTML preview of a custom block-editor notification template using actual order data or fallbacks.
527
+
528
+ #### Parameters
529
+
530
+ | Parameter | Type | Location | Required | Description |
531
+ |-----------|------|----------|----------|-------------|
532
+ | `notification_name` | string | body | Yes | Notification key (e.g., `order_paid_customer`) |
533
+ | `order_id` | integer | body | No | Specific order ID for merge tag values. Defaults to latest order |
534
+
535
+ #### Response
536
+
537
+ ```json
538
+ {
539
+ "html": "<!DOCTYPE html><html>...rendered email HTML...</html>"
540
+ }
541
+ ```
542
+
543
+ ---
544
+
545
+ ### Preview Default PHP Template
546
+
547
+ `POST /fluent-cart/v2/email-notification/preview-default-template`
548
+
549
+ Generate an HTML preview of a built-in PHP email template rendered with dummy data and disabled links.
550
+
551
+ #### Parameters
552
+
553
+ | Parameter | Type | Location | Required | Description |
554
+ |-----------|------|----------|----------|-------------|
555
+ | `template` | string | body | Yes | Template path key (e.g. `order.paid.customer`, `subscription.renewal.admin`) |
556
+
557
+ #### Registered Template Paths Catalog
558
+
559
+ | Template Path | Target Event / Description |
560
+ |---------------|---------------------------|
561
+ | `order.paid.admin` | Admin notification for paid order |
562
+ | `order.paid.customer` | Customer receipt for paid order |
563
+ | `order.refunded.admin` | Admin notification for refund |
564
+ | `order.refunded.customer` | Customer refund confirmation |
565
+ | `order.shipped.customer` | Customer shipping notification |
566
+ | `order.delivered.customer` | Customer delivery notification |
567
+ | `order.placed.admin` | Admin notification for offline payment order |
568
+ | `order.placed.customer` | Customer confirmation for offline payment order |
569
+ | `order.reminder.overdue.customer` | Customer payment reminder |
570
+ | `order.reminder.overdue.admin` | Admin copy of payment reminder |
571
+ | `subscription.renewal.customer` | Customer renewal confirmation |
572
+ | `subscription.renewal.admin` | Admin renewal notification |
573
+ | `subscription.canceled.customer` | Customer cancellation notice |
574
+ | `subscription.canceled.admin` | Admin cancellation notice |
575
+ | `subscription.reminder.customer` | Customer renewal reminder |
576
+ | `subscription.reminder.admin` | Admin copy of renewal reminder |
577
+ | `subscription.trial_end.customer` | Customer trial ending reminder |
578
+ | `subscription.trial_end.admin` | Admin copy of trial ending reminder |
579
+
580
+ #### Response
581
+
582
+ ```json
583
+ {
584
+ "data": {
585
+ "content": "<!DOCTYPE html><html>...rendered email HTML...</html>"
586
+ }
587
+ }
588
+ ```
589
+
590
+ ---
591
+
592
+ ## Data Models
593
+
594
+ ### Notification Object
595
+
596
+ | Property | Type | Description |
597
+ |----------|------|-------------|
598
+ | `name` | string | Unique notification key identifier |
599
+ | `event` | string | Event hook triggering notification |
600
+ | `group` | string | Category: `order`, `subscription`, or `scheduler` |
601
+ | `group_label` | string | Human-readable group label |
602
+ | `title` | string | Descriptive title |
603
+ | `description` | string | Explanation of notification trigger |
604
+ | `recipient` | string | Target recipient: `admin` or `customer` |
605
+ | `smartcode_groups` | array | Additional shortcode groups |
606
+ | `template_path` | string | Dot-notation path to built-in PHP template |
607
+ | `is_async` | boolean | Whether email is dispatched asynchronously |
608
+ | `pre_header` | string | Email pre-header text (admin emails) |
609
+ | `manage_toggle` | string | If set to `no`, notification cannot be disabled |
610
+ | `settings` | object | Notification settings object |
611
+
612
+ ### Notification Settings Object
613
+
614
+ | Property | Type | Description |
615
+ |----------|------|-------------|
616
+ | `active` | string | Enabled toggle: `yes` or `no` |
617
+ | `subject` | string | Email subject line (supports shortcodes) |
618
+ | `is_default_body` | string | Use built-in PHP template: `yes` or `no` |
619
+ | `email_body` | string | Custom email body HTML (cleared when `is_default_body` is `yes`) |