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,356 @@
|
|
|
1
|
+
# Tax API
|
|
2
|
+
|
|
3
|
+
Configure tax classes, manage country-specific tax rates, set up tax configuration, and handle EU VAT/OSS compliance and tax filing.
|
|
4
|
+
|
|
5
|
+
**Base URL:** `https://your-site.com/wp-json/fluent-cart/v2`
|
|
6
|
+
|
|
7
|
+
> All monetary values are in cents (e.g., `$10.00` = `1000`).
|
|
8
|
+
|
|
9
|
+
---
|
|
10
|
+
|
|
11
|
+
## Endpoints Overview
|
|
12
|
+
|
|
13
|
+
| Group | Method | Endpoint | Description |
|
|
14
|
+
|-------|--------|----------|-------------|
|
|
15
|
+
| **Tax Filing** | GET | `/taxes` | List Tax Records (Order-level filing) |
|
|
16
|
+
| | POST | `/taxes` | Mark Taxes as Filed |
|
|
17
|
+
| **Tax Classes** | GET | `/tax/classes` | List Tax Classes |
|
|
18
|
+
| | POST | `/tax/classes` | Create Tax Class |
|
|
19
|
+
| | DELETE | `/tax/classes/{id}` | Delete Tax Class |
|
|
20
|
+
| **Tax Rates** | GET | `/tax/rates` | List All Tax Rates (grouped by region) |
|
|
21
|
+
| | GET | `/tax/rates/country/rates/{country_code}` | Get Country Tax Rates |
|
|
22
|
+
| | POST | `/tax/country-status/{country_code}` | Enable/Disable Country Tax Status |
|
|
23
|
+
| | POST | `/tax/country/rate` | Create Tax Rate |
|
|
24
|
+
| | PUT | `/tax/country/rate/{id}` | Update Tax Rate |
|
|
25
|
+
| | DELETE | `/tax/country/rate/{id}` | Delete Tax Rate |
|
|
26
|
+
| | POST | `/tax/rates/country/override` | Save Shipping Tax Override |
|
|
27
|
+
| | DELETE | `/tax/rates/country/override/{id}` | Delete Shipping Tax Override |
|
|
28
|
+
| | GET | `/tax/product-overrides/{country_code}` | Get Product Category Tax Overrides |
|
|
29
|
+
| | POST | `/tax/product-overrides` | Save Product Category Tax Override |
|
|
30
|
+
| | DELETE | `/tax/product-overrides/{id}` | Delete Product Category Tax Override |
|
|
31
|
+
| | GET | `/tax/country-tax-id/{country_code}` | Get Country Tax ID |
|
|
32
|
+
| | POST | `/tax/country-tax-id/{country_code}` | Save Country Tax ID |
|
|
33
|
+
| **Tax Config** | GET | `/tax/configuration/rates` | Get Preconfigured Tax Rates |
|
|
34
|
+
| | POST | `/tax/configuration/countries` | Save Configured Countries |
|
|
35
|
+
| | GET | `/tax/configuration/settings` | Get Tax Settings |
|
|
36
|
+
| | POST | `/tax/configuration/settings` | Save Tax Settings |
|
|
37
|
+
| **EU VAT** | POST | `/tax/configuration/settings/eu-vat` | Save EU VAT Cross-Border Settings |
|
|
38
|
+
| | POST | `/tax/configuration/settings/eu-vat/reset-rates` | Reset EU VAT Rates |
|
|
39
|
+
| | GET | `/tax/configuration/settings/eu-vat/product-overrides` | Get EU VAT Product Overrides |
|
|
40
|
+
| | GET | `/tax/configuration/settings/eu-vat/oss-rates` | Get OSS Country Rates |
|
|
41
|
+
| | POST | `/tax/configuration/settings/eu-vat/oss-rates` | Save OSS Country Rates |
|
|
42
|
+
|
|
43
|
+
---
|
|
44
|
+
|
|
45
|
+
## Tax Filing
|
|
46
|
+
|
|
47
|
+
Manage order-level tax records for filing and reporting purposes.
|
|
48
|
+
|
|
49
|
+
**Prefix:** `/fluent-cart/v2/taxes` | **Policy:** `AdminPolicy`
|
|
50
|
+
|
|
51
|
+
### List Tax Records
|
|
52
|
+
|
|
53
|
+
`GET /fluent-cart/v2/taxes`
|
|
54
|
+
|
|
55
|
+
Retrieve a paginated list of order tax rate records.
|
|
56
|
+
|
|
57
|
+
#### Parameters
|
|
58
|
+
|
|
59
|
+
| Parameter | Type | Location | Required | Description |
|
|
60
|
+
|-----------|------|----------|----------|-------------|
|
|
61
|
+
| `page` | integer | query | No | Page number |
|
|
62
|
+
| `per_page` | integer | query | No | Records per page (default: 10, max: 200) |
|
|
63
|
+
| `search` | string | query | No | Search by ID, order_id, country, state, postcode, or name |
|
|
64
|
+
| `sort_by` | string | query | No | Column to sort by (default: `id`) |
|
|
65
|
+
| `sort_type` | string | query | No | `asc` or `desc` (default: `desc`) |
|
|
66
|
+
| `active_view` | string | query | No | Tab filter: `filed` or `not_filed` |
|
|
67
|
+
| `filter_type` | string | query | No | `simple` or `advanced` |
|
|
68
|
+
| `advanced_filters` | string (JSON) | query | No | JSON filter groups by country, region, name, filed status |
|
|
69
|
+
|
|
70
|
+
#### Response
|
|
71
|
+
|
|
72
|
+
```json
|
|
73
|
+
{
|
|
74
|
+
"taxes": {
|
|
75
|
+
"current_page": 1,
|
|
76
|
+
"data": [
|
|
77
|
+
{
|
|
78
|
+
"id": 1,
|
|
79
|
+
"order_id": 42,
|
|
80
|
+
"tax_rate_id": 5,
|
|
81
|
+
"shipping_tax": 150,
|
|
82
|
+
"order_tax": 1000,
|
|
83
|
+
"total_tax": 1150,
|
|
84
|
+
"meta": {
|
|
85
|
+
"rates": [],
|
|
86
|
+
"tax_country": "US",
|
|
87
|
+
"store_vat_number": ""
|
|
88
|
+
},
|
|
89
|
+
"filed_at": null,
|
|
90
|
+
"created_at": "2025-06-01 12:00:00",
|
|
91
|
+
"updated_at": "2025-06-01 12:00:00"
|
|
92
|
+
}
|
|
93
|
+
],
|
|
94
|
+
"per_page": 10,
|
|
95
|
+
"total": 50,
|
|
96
|
+
"last_page": 5
|
|
97
|
+
}
|
|
98
|
+
}
|
|
99
|
+
```
|
|
100
|
+
|
|
101
|
+
#### Example
|
|
102
|
+
|
|
103
|
+
```bash
|
|
104
|
+
curl -X GET "https://example.com/wp-json/fluent-cart/v2/taxes?page=1&per_page=20&active_view=not_filed" \
|
|
105
|
+
-u "username:app_password"
|
|
106
|
+
```
|
|
107
|
+
|
|
108
|
+
---
|
|
109
|
+
|
|
110
|
+
### Mark Taxes as Filed
|
|
111
|
+
|
|
112
|
+
`POST /fluent-cart/v2/taxes`
|
|
113
|
+
|
|
114
|
+
Mark one or more order tax records as filed by setting their `filed_at` timestamp.
|
|
115
|
+
|
|
116
|
+
#### Parameters
|
|
117
|
+
|
|
118
|
+
| Parameter | Type | Location | Required | Description |
|
|
119
|
+
|-----------|------|----------|----------|-------------|
|
|
120
|
+
| `ids` | array | body | Yes | Array of OrderTaxRate record IDs to mark as filed |
|
|
121
|
+
|
|
122
|
+
#### Response
|
|
123
|
+
|
|
124
|
+
```json
|
|
125
|
+
{
|
|
126
|
+
"message": "Taxes marked as filed successfully"
|
|
127
|
+
}
|
|
128
|
+
```
|
|
129
|
+
|
|
130
|
+
#### Example
|
|
131
|
+
|
|
132
|
+
```bash
|
|
133
|
+
curl -X POST "https://example.com/wp-json/fluent-cart/v2/taxes" \
|
|
134
|
+
-u "username:app_password" \
|
|
135
|
+
-H "Content-Type: application/json" \
|
|
136
|
+
-d '{"ids": [1, 2, 3, 5]}'
|
|
137
|
+
```
|
|
138
|
+
|
|
139
|
+
---
|
|
140
|
+
|
|
141
|
+
## Tax Classes
|
|
142
|
+
|
|
143
|
+
Group tax rates by category (e.g., Standard, Reduced, Zero). Maximum 6 classes allowed. Standard cannot be deleted.
|
|
144
|
+
|
|
145
|
+
**Prefix:** `/fluent-cart/v2/tax/classes` | **Policy:** `StoreSettingsPolicy`
|
|
146
|
+
|
|
147
|
+
### List Tax Classes
|
|
148
|
+
|
|
149
|
+
`GET /fluent-cart/v2/tax/classes`
|
|
150
|
+
|
|
151
|
+
#### Response
|
|
152
|
+
|
|
153
|
+
```json
|
|
154
|
+
{
|
|
155
|
+
"classes": [
|
|
156
|
+
{
|
|
157
|
+
"id": 1,
|
|
158
|
+
"title": "Standard",
|
|
159
|
+
"slug": "standard",
|
|
160
|
+
"created_at": "2025-01-01 00:00:00"
|
|
161
|
+
},
|
|
162
|
+
{
|
|
163
|
+
"id": 2,
|
|
164
|
+
"title": "Reduced",
|
|
165
|
+
"slug": "reduced",
|
|
166
|
+
"created_at": "2025-01-01 00:00:00"
|
|
167
|
+
}
|
|
168
|
+
],
|
|
169
|
+
"max_classes": 6,
|
|
170
|
+
"next_builtin": {
|
|
171
|
+
"slug": "zero",
|
|
172
|
+
"title": "Zero"
|
|
173
|
+
}
|
|
174
|
+
}
|
|
175
|
+
```
|
|
176
|
+
|
|
177
|
+
---
|
|
178
|
+
|
|
179
|
+
### Create Tax Class
|
|
180
|
+
|
|
181
|
+
`POST /fluent-cart/v2/tax/classes`
|
|
182
|
+
|
|
183
|
+
#### Parameters
|
|
184
|
+
|
|
185
|
+
| Parameter | Type | Location | Required | Description |
|
|
186
|
+
|-----------|------|----------|----------|-------------|
|
|
187
|
+
| `title` | string | body | Conditional | Tax class title (max 30 chars). Required unless built-in slug passed |
|
|
188
|
+
| `slug` | string | body | No | Pass `reduced` or `zero` to create built-in class |
|
|
189
|
+
|
|
190
|
+
#### Example
|
|
191
|
+
|
|
192
|
+
```bash
|
|
193
|
+
curl -X POST "https://example.com/wp-json/fluent-cart/v2/tax/classes" \
|
|
194
|
+
-u "username:app_password" \
|
|
195
|
+
-H "Content-Type: application/json" \
|
|
196
|
+
-d '{"title": "Digital Goods"}'
|
|
197
|
+
```
|
|
198
|
+
|
|
199
|
+
---
|
|
200
|
+
|
|
201
|
+
### Delete Tax Class
|
|
202
|
+
|
|
203
|
+
`DELETE /fluent-cart/v2/tax/classes/{id}`
|
|
204
|
+
|
|
205
|
+
Products/rates referencing deleted class fall back to Standard. Standard class cannot be deleted.
|
|
206
|
+
|
|
207
|
+
---
|
|
208
|
+
|
|
209
|
+
## Tax Rates
|
|
210
|
+
|
|
211
|
+
**Prefix:** `/fluent-cart/v2/tax` | **Policy:** `StoreSettingsPolicy`
|
|
212
|
+
|
|
213
|
+
### List All Tax Rates
|
|
214
|
+
|
|
215
|
+
`GET /fluent-cart/v2/tax/rates`
|
|
216
|
+
|
|
217
|
+
Retrieve all rates grouped by region/continent and country.
|
|
218
|
+
|
|
219
|
+
### Get Country Tax Rates
|
|
220
|
+
|
|
221
|
+
`GET /fluent-cart/v2/tax/rates/country/rates/{country_code}`
|
|
222
|
+
|
|
223
|
+
### Update Country Tax Status
|
|
224
|
+
|
|
225
|
+
`POST /fluent-cart/v2/tax/country-status/{country_code}`
|
|
226
|
+
|
|
227
|
+
#### Parameters
|
|
228
|
+
|
|
229
|
+
| Parameter | Type | Location | Required | Description |
|
|
230
|
+
|-----------|------|----------|----------|-------------|
|
|
231
|
+
| `country_code` | string | path | Yes | ISO country code or `EU` |
|
|
232
|
+
| `enabled` | integer | body | Yes | `1` to enable, `0` to disable |
|
|
233
|
+
|
|
234
|
+
---
|
|
235
|
+
|
|
236
|
+
### Create Tax Rate
|
|
237
|
+
|
|
238
|
+
`POST /fluent-cart/v2/tax/country/rate`
|
|
239
|
+
|
|
240
|
+
#### Parameters
|
|
241
|
+
|
|
242
|
+
| Parameter | Type | Location | Required | Description |
|
|
243
|
+
|-----------|------|----------|----------|-------------|
|
|
244
|
+
| `class_id` | integer | body | Yes | Tax class ID |
|
|
245
|
+
| `country` | string | body | No | ISO country code (max 45 chars) |
|
|
246
|
+
| `state` | string | body | No | State/province code |
|
|
247
|
+
| `postcode` | string | body | No | Postal code |
|
|
248
|
+
| `city` | string | body | No | City name |
|
|
249
|
+
| `rate` | string | body | No | Rate percentage (e.g. `"19.0000"`) |
|
|
250
|
+
| `name` | string | body | No | Display name |
|
|
251
|
+
| `group` | string | body | No | Geographic group (e.g. `EU`, `NA`) |
|
|
252
|
+
| `priority` | integer | body | No | Application priority (min 1) |
|
|
253
|
+
| `is_compound` | integer | body | No | Compound tax flag (`0` or `1`) |
|
|
254
|
+
| `for_shipping` | integer | body | No | Shipping override rate (null = none) |
|
|
255
|
+
| `for_order` | integer | body | No | Order-level tax flag (`0` or `1`) |
|
|
256
|
+
|
|
257
|
+
---
|
|
258
|
+
|
|
259
|
+
### Update Tax Rate
|
|
260
|
+
|
|
261
|
+
`PUT /fluent-cart/v2/tax/country/rate/{id}`
|
|
262
|
+
|
|
263
|
+
---
|
|
264
|
+
|
|
265
|
+
### Delete Tax Rate
|
|
266
|
+
|
|
267
|
+
`DELETE /fluent-cart/v2/tax/country/rate/{id}`
|
|
268
|
+
|
|
269
|
+
---
|
|
270
|
+
|
|
271
|
+
### Shipping Tax Overrides
|
|
272
|
+
|
|
273
|
+
- `POST /fluent-cart/v2/tax/rates/country/override` — Save shipping tax override on a rate.
|
|
274
|
+
- `DELETE /fluent-cart/v2/tax/rates/country/override/{id}` — Remove shipping tax override.
|
|
275
|
+
|
|
276
|
+
---
|
|
277
|
+
|
|
278
|
+
### Product Category Tax Overrides
|
|
279
|
+
|
|
280
|
+
- `GET /fluent-cart/v2/tax/product-overrides/{country_code}` — Get product category overrides for country.
|
|
281
|
+
- `POST /fluent-cart/v2/tax/product-overrides` — Create or update product category tax override.
|
|
282
|
+
- `DELETE /fluent-cart/v2/tax/product-overrides/{id}` — Delete product category tax override.
|
|
283
|
+
|
|
284
|
+
---
|
|
285
|
+
|
|
286
|
+
### Store Tax ID (VAT/GST/EIN)
|
|
287
|
+
|
|
288
|
+
- `GET /fluent-cart/v2/tax/country-tax-id/{country_code}` — Get store tax ID for country.
|
|
289
|
+
- `POST /fluent-cart/v2/tax/country-tax-id/{country_code}` — Save store tax ID for country.
|
|
290
|
+
|
|
291
|
+
---
|
|
292
|
+
|
|
293
|
+
## Tax Configuration
|
|
294
|
+
|
|
295
|
+
**Prefix:** `/fluent-cart/v2/tax/configuration` | **Policy:** `StoreSettingsPolicy`
|
|
296
|
+
|
|
297
|
+
### Get Preconfigured Tax Rates
|
|
298
|
+
|
|
299
|
+
`GET /fluent-cart/v2/tax/configuration/rates`
|
|
300
|
+
|
|
301
|
+
Returns default tax rates from built-in rates dataset (`tax.php`) grouped by region/country.
|
|
302
|
+
|
|
303
|
+
### Save Configured Countries
|
|
304
|
+
|
|
305
|
+
`POST /fluent-cart/v2/tax/configuration/countries`
|
|
306
|
+
|
|
307
|
+
Imports default tax rates for selected country codes.
|
|
308
|
+
|
|
309
|
+
```bash
|
|
310
|
+
curl -X POST "https://example.com/wp-json/fluent-cart/v2/tax/configuration/countries" \
|
|
311
|
+
-u "username:app_password" \
|
|
312
|
+
-H "Content-Type: application/json" \
|
|
313
|
+
-d '{"countries": ["DE", "FR", "IT", "ES"]}'
|
|
314
|
+
```
|
|
315
|
+
|
|
316
|
+
### Get / Save Tax Settings
|
|
317
|
+
|
|
318
|
+
- `GET /fluent-cart/v2/tax/configuration/settings`
|
|
319
|
+
- `POST /fluent-cart/v2/tax/configuration/settings`
|
|
320
|
+
|
|
321
|
+
#### Settings Object Fields
|
|
322
|
+
|
|
323
|
+
| Field | Values | Description |
|
|
324
|
+
|-------|--------|-------------|
|
|
325
|
+
| `enable_tax` | `"yes"`, `"no"` | Master tax switch |
|
|
326
|
+
| `tax_inclusion` | `"included"`, `"excluded"` | Whether catalog prices include tax |
|
|
327
|
+
| `tax_calculation_basis` | `"shipping"`, `"billing"`, `"store"` | Address basis for calculation |
|
|
328
|
+
| `tax_rounding` | `"item"`, `"total"`, `"subtotal"` | Rounding application point |
|
|
329
|
+
| `checkout_tax_breakdown_display` | `"itemized"`, `"simplified"` | Display format at checkout |
|
|
330
|
+
| `tax_display_label` | string | Label used at checkout (e.g. `"VAT"`) |
|
|
331
|
+
| `price_suffix_included` | string | Suffix for tax-included prices |
|
|
332
|
+
| `price_suffix_excluded` | string | Suffix for tax-excluded prices |
|
|
333
|
+
| `eu_vat_settings` | object | EU VAT compliance configuration |
|
|
334
|
+
|
|
335
|
+
---
|
|
336
|
+
|
|
337
|
+
## EU VAT & OSS Compliance
|
|
338
|
+
|
|
339
|
+
**Prefix:** `/fluent-cart/v2/tax/configuration/settings/eu-vat` | **Policy:** `StoreSettingsPolicy`
|
|
340
|
+
|
|
341
|
+
### Save EU VAT Cross-Border Settings
|
|
342
|
+
|
|
343
|
+
`POST /fluent-cart/v2/tax/configuration/settings/eu-vat`
|
|
344
|
+
|
|
345
|
+
Multi-action endpoint dispatched via `action`:
|
|
346
|
+
|
|
347
|
+
1. `euCrossBorderSettings`: Save method (`oss`, `home`, `specific`), `oss_country`, `oss_vat`, `home_country`, `home_vat`.
|
|
348
|
+
2. `saveCountryRegistration`: Save per-country VAT registration (`country`, `vat`, `rates`).
|
|
349
|
+
3. `deleteCountryRegistration`: Delete per-country VAT registration (`country`).
|
|
350
|
+
|
|
351
|
+
### Other EU VAT Endpoints
|
|
352
|
+
|
|
353
|
+
- `POST /tax/configuration/settings/eu-vat/reset-rates` — Reset EU standard VAT rates to built-in defaults.
|
|
354
|
+
- `GET /tax/configuration/settings/eu-vat/product-overrides` — Retrieve all EU product category overrides & shipping overrides.
|
|
355
|
+
- `GET /tax/configuration/settings/eu-vat/oss-rates` — Get OSS country rates per tax class.
|
|
356
|
+
- `POST /tax/configuration/settings/eu-vat/oss-rates` — Save OSS country rates.
|
|
@@ -0,0 +1,197 @@
|
|
|
1
|
+
# Subscription Customization
|
|
2
|
+
|
|
3
|
+
Customization guides for FluentCart's subscription system — grace periods, custom billing intervals, and gateway compatibility.
|
|
4
|
+
|
|
5
|
+
---
|
|
6
|
+
|
|
7
|
+
## Grace Periods
|
|
8
|
+
|
|
9
|
+
### What is a grace period?
|
|
10
|
+
|
|
11
|
+
When a subscription renewal payment fails or is delayed, FluentCart does not immediately mark the subscription as expired. Instead it waits a configurable number of days — the **grace period** — before changing the status to `expired`.
|
|
12
|
+
|
|
13
|
+
This matters because some payment methods are asynchronous. The payment may have been initiated and will succeed, but confirmation arrives hours or days later. Expiring the subscription the moment a payment is not instantly confirmed would incorrectly cut off access for customers who have already paid.
|
|
14
|
+
|
|
15
|
+
### Default grace periods by billing interval:
|
|
16
|
+
|
|
17
|
+
| Interval | Default grace (days) |
|
|
18
|
+
|----------|---------------------|
|
|
19
|
+
| Daily | 1 |
|
|
20
|
+
| Weekly | 3 |
|
|
21
|
+
| Monthly | 7 |
|
|
22
|
+
| Quarterly | 15 |
|
|
23
|
+
| Half-yearly | 15 |
|
|
24
|
+
| Yearly | 15 |
|
|
25
|
+
|
|
26
|
+
### When should you extend the grace period?
|
|
27
|
+
|
|
28
|
+
The clearest case: **SEPA Direct Debit.**
|
|
29
|
+
|
|
30
|
+
SEPA bank transfers can take 2–3 business days to confirm. For a monthly subscriber paying via SEPA, the default 7-day grace period is sufficient — but only if the payment was initiated on time. If your site processes renewals late (e.g. a missed cron run), or if a weekend is involved, a 7-day window can become tight. Extending it to 10–14 days eliminates false expiries for SEPA customers.
|
|
31
|
+
|
|
32
|
+
**Other cases where you should extend:**
|
|
33
|
+
|
|
34
|
+
- **ACH / bank transfers** — US bank transfers can take 3–5 business days.
|
|
35
|
+
- **Slow-processing gateways** — Some regional gateways in emerging markets batch-process overnight.
|
|
36
|
+
- **High-value subscriptions** — For yearly plans where incorrectly expiring a subscription has a large customer impact, a 21–30 day window is safer.
|
|
37
|
+
|
|
38
|
+
```php
|
|
39
|
+
add_filter('fluent_cart/subscription/grace_period_days', function (array $gracePeriods): array {
|
|
40
|
+
// Extend monthly grace period to 14 days to safely cover SEPA debit delays
|
|
41
|
+
$gracePeriods['monthly'] = 14;
|
|
42
|
+
|
|
43
|
+
// Give yearly subscribers a full month before expiry
|
|
44
|
+
$gracePeriods['yearly'] = 30;
|
|
45
|
+
|
|
46
|
+
return $gracePeriods;
|
|
47
|
+
});
|
|
48
|
+
```
|
|
49
|
+
|
|
50
|
+
### When should you reduce the grace period?
|
|
51
|
+
|
|
52
|
+
If your product delivers time-sensitive value (live access, daily content, seat-based software), you may want stricter expiry — cut off access as soon as a payment has clearly failed, not 7–15 days later.
|
|
53
|
+
|
|
54
|
+
```php
|
|
55
|
+
add_filter('fluent_cart/subscription/grace_period_days', function (array $gracePeriods): array {
|
|
56
|
+
// Tight grace for daily content — expire after 1 missed day regardless of interval
|
|
57
|
+
$gracePeriods['monthly'] = 1;
|
|
58
|
+
$gracePeriods['quarterly'] = 1;
|
|
59
|
+
$gracePeriods['half_yearly'] = 1;
|
|
60
|
+
$gracePeriods['yearly'] = 3;
|
|
61
|
+
|
|
62
|
+
return $gracePeriods;
|
|
63
|
+
});
|
|
64
|
+
```
|
|
65
|
+
|
|
66
|
+
> [!WARNING]
|
|
67
|
+
> Reducing grace periods below 3 days for bank-based payment methods (SEPA, ACH) will cause valid customers to lose access before their payment has had time to settle. Only do this when your payment methods are card-only or instant-confirm.
|
|
68
|
+
|
|
69
|
+
### Targeting grace period by payment method
|
|
70
|
+
|
|
71
|
+
If you accept both instant (card) and delayed (SEPA/ACH) payment methods, you can apply different grace periods per customer:
|
|
72
|
+
|
|
73
|
+
```php
|
|
74
|
+
add_filter('fluent_cart/subscription/grace_period_days', function (array $gracePeriods): array {
|
|
75
|
+
// Default stays for card-based subscriptions.
|
|
76
|
+
// Individual subscriptions using SEPA need more time — handled in grace_period_days_for_subscription.
|
|
77
|
+
return $gracePeriods;
|
|
78
|
+
});
|
|
79
|
+
```
|
|
80
|
+
|
|
81
|
+
> [!TIP]
|
|
82
|
+
> The `fluent_cart/subscription/grace_period_days` filter applies globally across all subscriptions of a given billing interval. If you need per-subscription overrides (e.g. by payment method), use the subscription's `current_payment_method` field to conditionally adjust values in your filter callback, by loading the specific subscription from context.
|
|
83
|
+
|
|
84
|
+
### Reference
|
|
85
|
+
|
|
86
|
+
- **Filter:** `fluent_cart/subscription/grace_period_days`
|
|
87
|
+
- **Source:** `app/Services/Payments/SubscriptionHelper.php`
|
|
88
|
+
- **Full filter reference:** [Customers & Subscriptions filters](filter-hooks-customers-subscriptions.md)
|
|
89
|
+
|
|
90
|
+
---
|
|
91
|
+
|
|
92
|
+
## Custom Subscription Intervals
|
|
93
|
+
|
|
94
|
+
FluentCart ships with `daily`, `weekly`, `monthly`, `quarterly`, `half_yearly`, and `yearly`. You can register additional intervals through filters.
|
|
95
|
+
|
|
96
|
+
The example below adds an **every 10th day** interval. Swap in your own values as needed.
|
|
97
|
+
|
|
98
|
+
### 1. Register the interval option
|
|
99
|
+
|
|
100
|
+
Adds the interval to the product editor dropdown. All three fields are required.
|
|
101
|
+
|
|
102
|
+
```php
|
|
103
|
+
add_filter('fluent_cart/available_subscription_interval_options', function ($options) {
|
|
104
|
+
// Add custom "Every 10th day" interval to the product editor dropdown
|
|
105
|
+
return array_merge($options, [
|
|
106
|
+
[
|
|
107
|
+
'label' => __('Every 10th day', 'fluent-cart'), // shown in dropdown
|
|
108
|
+
'value' => 'every_tenth_day', // stored in database
|
|
109
|
+
'map_value' => '10th Day', // readable format
|
|
110
|
+
],
|
|
111
|
+
]);
|
|
112
|
+
});
|
|
113
|
+
```
|
|
114
|
+
|
|
115
|
+
### 2. Define the interval in days
|
|
116
|
+
|
|
117
|
+
Used internally for trial day calculations and renewal scheduling.
|
|
118
|
+
|
|
119
|
+
```php
|
|
120
|
+
add_filter('fluent_cart/subscription_interval_in_days', function ($days, $args) {
|
|
121
|
+
// Return 10 days for our custom interval
|
|
122
|
+
if ($args['interval'] === 'every_tenth_day') {
|
|
123
|
+
return 10;
|
|
124
|
+
}
|
|
125
|
+
return $days;
|
|
126
|
+
}, 10, 2);
|
|
127
|
+
```
|
|
128
|
+
|
|
129
|
+
### 3. Map to gateway billing period
|
|
130
|
+
|
|
131
|
+
Required for built-in gateways (Stripe, PayPal). If you own the gateway code, handle this directly in your processor instead.
|
|
132
|
+
|
|
133
|
+
```php
|
|
134
|
+
add_filter('fluent_cart/subscription_billing_period', function ($billingPeriod, $args) {
|
|
135
|
+
// Only handle our custom interval
|
|
136
|
+
if ($args['subscription_interval'] !== 'every_tenth_day') {
|
|
137
|
+
return $billingPeriod;
|
|
138
|
+
}
|
|
139
|
+
|
|
140
|
+
// Map to Stripe billing period format (10 days)
|
|
141
|
+
if ($args['payment_method'] === 'stripe') {
|
|
142
|
+
$billingPeriod['interval_unit'] = 'day';
|
|
143
|
+
$billingPeriod['interval_frequency'] = 10;
|
|
144
|
+
}
|
|
145
|
+
|
|
146
|
+
// Map to PayPal billing period format (10 days)
|
|
147
|
+
if ($args['payment_method'] === 'paypal') {
|
|
148
|
+
$billingPeriod['interval_unit'] = 'day';
|
|
149
|
+
$billingPeriod['interval_frequency'] = 10;
|
|
150
|
+
}
|
|
151
|
+
|
|
152
|
+
return $billingPeriod;
|
|
153
|
+
}, 10, 2);
|
|
154
|
+
```
|
|
155
|
+
|
|
156
|
+
### 4. Set max trial days (optional)
|
|
157
|
+
|
|
158
|
+
Caps how many trial days can be assigned to this interval.
|
|
159
|
+
|
|
160
|
+
```php
|
|
161
|
+
add_filter('fluent_cart/max_trial_days_allowed', function ($days, $args) {
|
|
162
|
+
// Cap trial days at the interval length for our custom interval
|
|
163
|
+
if ($args['repeat_interval'] === 'every_tenth_day') {
|
|
164
|
+
return min($args['existing_trial_days'] + $args['interval_in_days'], 10);
|
|
165
|
+
}
|
|
166
|
+
return $days;
|
|
167
|
+
}, 10, 2);
|
|
168
|
+
```
|
|
169
|
+
|
|
170
|
+
### 5. License validity (Pro — licensed products only)
|
|
171
|
+
|
|
172
|
+
If the product uses the licensing module, set the expiry period for the custom interval.
|
|
173
|
+
|
|
174
|
+
```php
|
|
175
|
+
add_filter('fluent_cart/license/default_validity_by_variation', function ($validity, $args) {
|
|
176
|
+
// Set license validity to 10 days for our custom interval
|
|
177
|
+
$interval = Arr::get($args['variation']->other_info, 'repeat_interval');
|
|
178
|
+
if ($interval === 'every_tenth_day') {
|
|
179
|
+
return ['unit' => 'day', 'value' => 10];
|
|
180
|
+
}
|
|
181
|
+
return $validity;
|
|
182
|
+
}, 10, 2);
|
|
183
|
+
```
|
|
184
|
+
|
|
185
|
+
### Gateway compatibility
|
|
186
|
+
|
|
187
|
+
- **Stripe** accepts any positive integer with `day`, `week`, `month`, or `year`.
|
|
188
|
+
- **PayPal** supports the same units but has frequency limits — check PayPal's billing plan docs for your interval.
|
|
189
|
+
|
|
190
|
+
---
|
|
191
|
+
|
|
192
|
+
## Related Documentation
|
|
193
|
+
|
|
194
|
+
- [Subscription Hooks](action-hooks-subscriptions.md) - Subscription lifecycle action hooks
|
|
195
|
+
- [Subscription Filters](filter-hooks-customers-subscriptions.md) - Customer & subscription filter hooks
|
|
196
|
+
- [Payment Gateway Integration](payment-gateway-integration.md) - Custom payment gateway development
|
|
197
|
+
- [Database Models](database-models-reference.md) - Data model documentation
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
// Empty
|
package/skills.sh.json
ADDED
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
{
|
|
2
|
+
"$schema": "https://skills.sh/schemas/skills.sh.schema.json",
|
|
3
|
+
"notGrouped": "bottom",
|
|
4
|
+
"groupings": [
|
|
5
|
+
{
|
|
6
|
+
"title": "WordPress & E-Commerce",
|
|
7
|
+
"description": "Skills for FluentCart theme and plugin development.",
|
|
8
|
+
"skills": [
|
|
9
|
+
"fluentcart-developer"
|
|
10
|
+
]
|
|
11
|
+
}
|
|
12
|
+
]
|
|
13
|
+
}
|