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.
- package/README.md +59 -59
- package/dist/cards/fluentcart/tools.d.ts.map +1 -1
- package/dist/cards/fluentcart/tools.js +2301 -2161
- package/dist/cards/fluentcart/tools.js.map +1 -1
- package/dist/skills/fluentcart-developer/.claude-plugin/plugin.json +12 -12
- package/dist/skills/fluentcart-developer/.mcp.json +11 -11
- package/dist/skills/fluentcart-developer/examples/fluentcart-starter-child-theme/fluent-cart/checkout.php +32 -32
- package/dist/skills/fluentcart-developer/examples/fluentcart-starter-child-theme/functions.php +40 -40
- package/dist/skills/fluentcart-developer/examples/sample-fee-surcharge-plugin/fluentcart-fee-surcharge.php +38 -38
- package/dist/skills/fluentcart-developer/references/action-hooks-cart-checkout.md +1355 -1355
- package/dist/skills/fluentcart-developer/references/action-hooks-customers-users.md +266 -266
- package/dist/skills/fluentcart-developer/references/action-hooks-licenses.md +855 -855
- package/dist/skills/fluentcart-developer/references/action-hooks-orders.md +631 -631
- package/dist/skills/fluentcart-developer/references/action-hooks-payments-integrations.md +963 -963
- package/dist/skills/fluentcart-developer/references/action-hooks-products-coupons.md +585 -585
- package/dist/skills/fluentcart-developer/references/action-hooks-subscriptions.md +661 -661
- package/dist/skills/fluentcart-developer/references/database-models-query-builder.md +194 -194
- package/dist/skills/fluentcart-developer/references/database-models-reference.md +604 -604
- package/dist/skills/fluentcart-developer/references/engineering-notes.md +154 -154
- package/dist/skills/fluentcart-developer/references/fee-system-guide.md +449 -449
- package/dist/skills/fluentcart-developer/references/filter-hooks-cart-checkout.md +1202 -1202
- package/dist/skills/fluentcart-developer/references/filter-hooks-integrations-advanced.md +1598 -1598
- package/dist/skills/fluentcart-developer/references/filter-hooks-products-pricing.md +628 -628
- package/dist/skills/fluentcart-developer/references/filter-hooks-settings-configuration.md +1177 -1177
- package/dist/skills/fluentcart-developer/references/fluentcart-developer-guide.md +154 -154
- package/dist/skills/fluentcart-developer/references/ghost-product-selling.md +458 -458
- package/dist/skills/fluentcart-developer/references/modules-and-extensions-reference.md +224 -224
- package/dist/skills/fluentcart-developer/references/payment-gateway-integration.md +761 -761
- package/dist/skills/fluentcart-developer/references/rest-api-customer-profile.md +190 -190
- package/dist/skills/fluentcart-developer/references/rest-api-customers.md +1121 -1121
- package/dist/skills/fluentcart-developer/references/rest-api-dashboard-utilities.md +219 -219
- package/dist/skills/fluentcart-developer/references/rest-api-email-notifications.md +619 -619
- package/dist/skills/fluentcart-developer/references/rest-api-files.md +290 -290
- package/dist/skills/fluentcart-developer/references/rest-api-integrations.md +324 -324
- package/dist/skills/fluentcart-developer/references/rest-api-labels-attributes.md +321 -321
- package/dist/skills/fluentcart-developer/references/rest-api-order-bumps.md +200 -200
- package/dist/skills/fluentcart-developer/references/rest-api-overview.md +131 -131
- package/dist/skills/fluentcart-developer/references/rest-api-public-shop.md +172 -172
- package/dist/skills/fluentcart-developer/references/rest-api-reference.md +552 -552
- package/dist/skills/fluentcart-developer/references/rest-api-reports.md +377 -377
- package/dist/skills/fluentcart-developer/references/rest-api-roles-permissions.md +147 -147
- package/dist/skills/fluentcart-developer/references/rest-api-settings.md +528 -528
- package/dist/skills/fluentcart-developer/references/rest-api-shipping.md +799 -799
- package/dist/skills/fluentcart-developer/references/rest-api-tax.md +356 -356
- package/dist/skills/fluentcart-developer/references/subscription-customization.md +197 -197
- package/dist/skills/fluentcart-developer/scripts/cli.js +1 -1
- package/dist/version.d.ts +1 -1
- package/dist/version.js +1 -1
- package/package.json +65 -65
|
@@ -1,197 +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
|
|
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
|
|
@@ -1 +1 @@
|
|
|
1
|
-
// Empty
|
|
1
|
+
// Empty
|
package/dist/version.d.ts
CHANGED
package/dist/version.js
CHANGED
package/package.json
CHANGED
|
@@ -1,65 +1,65 @@
|
|
|
1
|
-
{
|
|
2
|
-
"name": "fluentcart-developer",
|
|
3
|
-
"version": "2.3.
|
|
4
|
-
"description": "MCP server for FluentCart developer knowledge: documentation search, database schema lookup, hook discovery, reference reading, and boilerplate generation for gateways, licensing, customers, device licensing, trial guards and client SDKs.",
|
|
5
|
-
"type": "module",
|
|
6
|
-
"main": "dist/index.js",
|
|
7
|
-
"types": "dist/index.d.ts",
|
|
8
|
-
"bin": {
|
|
9
|
-
"fluentcart-developer": "dist/index.js"
|
|
10
|
-
},
|
|
11
|
-
"files": [
|
|
12
|
-
"dist",
|
|
13
|
-
"README.md",
|
|
14
|
-
"LICENSE.md"
|
|
15
|
-
],
|
|
16
|
-
"scripts": {
|
|
17
|
-
"build": "tsc && node scripts/copy-skills.mjs",
|
|
18
|
-
"verify": "node scripts/verify-stdio.mjs",
|
|
19
|
-
"start": "node dist/index.js",
|
|
20
|
-
"start:http": "node dist/http.js",
|
|
21
|
-
"dev": "tsx src/index.ts",
|
|
22
|
-
"dev:http": "tsx src/http.ts",
|
|
23
|
-
"prepublishOnly": "npm run build && npm run verify"
|
|
24
|
-
},
|
|
25
|
-
"keywords": [
|
|
26
|
-
"mcp",
|
|
27
|
-
"model-context-protocol",
|
|
28
|
-
"claude-code",
|
|
29
|
-
"cursor",
|
|
30
|
-
"fluentcart",
|
|
31
|
-
"developer-tools",
|
|
32
|
-
"ai-agent"
|
|
33
|
-
],
|
|
34
|
-
"author": "Atif Jubaer",
|
|
35
|
-
"license": "MIT",
|
|
36
|
-
"homepage": "https://github.com/atifjubaer/skills/tree/main/servers/fluentcart-developer#readme",
|
|
37
|
-
"repository": {
|
|
38
|
-
"type": "git",
|
|
39
|
-
"url": "git+https://github.com/atifjubaer/skills.git",
|
|
40
|
-
"directory": "servers/fluentcart-developer"
|
|
41
|
-
},
|
|
42
|
-
"bugs": {
|
|
43
|
-
"url": "https://github.com/atifjubaer/skills/issues"
|
|
44
|
-
},
|
|
45
|
-
"engines": {
|
|
46
|
-
"node": ">=22"
|
|
47
|
-
},
|
|
48
|
-
"publishConfig": {
|
|
49
|
-
"access": "public"
|
|
50
|
-
},
|
|
51
|
-
"dependencies": {
|
|
52
|
-
"@modelcontextprotocol/express": "^2.0.2",
|
|
53
|
-
"@modelcontextprotocol/node": "^2.1.2",
|
|
54
|
-
"@modelcontextprotocol/server": "^2.4.0",
|
|
55
|
-
"dotenv": "^16.4.7",
|
|
56
|
-
"express": "^4.21.2",
|
|
57
|
-
"zod": "^4.6.7"
|
|
58
|
-
},
|
|
59
|
-
"devDependencies": {
|
|
60
|
-
"@types/express": "^5.0.0",
|
|
61
|
-
"@types/node": "^22.13.0",
|
|
62
|
-
"tsx": "^4.19.2",
|
|
63
|
-
"typescript": "^5.7.3"
|
|
64
|
-
}
|
|
65
|
-
}
|
|
1
|
+
{
|
|
2
|
+
"name": "fluentcart-developer",
|
|
3
|
+
"version": "2.3.1",
|
|
4
|
+
"description": "MCP server for FluentCart developer knowledge: documentation search, database schema lookup, hook discovery, reference reading, and boilerplate generation for gateways, licensing, customers, device licensing, trial guards and client SDKs.",
|
|
5
|
+
"type": "module",
|
|
6
|
+
"main": "dist/index.js",
|
|
7
|
+
"types": "dist/index.d.ts",
|
|
8
|
+
"bin": {
|
|
9
|
+
"fluentcart-developer": "dist/index.js"
|
|
10
|
+
},
|
|
11
|
+
"files": [
|
|
12
|
+
"dist",
|
|
13
|
+
"README.md",
|
|
14
|
+
"LICENSE.md"
|
|
15
|
+
],
|
|
16
|
+
"scripts": {
|
|
17
|
+
"build": "tsc && node scripts/copy-skills.mjs",
|
|
18
|
+
"verify": "node scripts/verify-stdio.mjs",
|
|
19
|
+
"start": "node dist/index.js",
|
|
20
|
+
"start:http": "node dist/http.js",
|
|
21
|
+
"dev": "tsx src/index.ts",
|
|
22
|
+
"dev:http": "tsx src/http.ts",
|
|
23
|
+
"prepublishOnly": "npm run build && npm run verify"
|
|
24
|
+
},
|
|
25
|
+
"keywords": [
|
|
26
|
+
"mcp",
|
|
27
|
+
"model-context-protocol",
|
|
28
|
+
"claude-code",
|
|
29
|
+
"cursor",
|
|
30
|
+
"fluentcart",
|
|
31
|
+
"developer-tools",
|
|
32
|
+
"ai-agent"
|
|
33
|
+
],
|
|
34
|
+
"author": "Atif Jubaer",
|
|
35
|
+
"license": "MIT",
|
|
36
|
+
"homepage": "https://github.com/atifjubaer/skills/tree/main/servers/fluentcart-developer#readme",
|
|
37
|
+
"repository": {
|
|
38
|
+
"type": "git",
|
|
39
|
+
"url": "git+https://github.com/atifjubaer/skills.git",
|
|
40
|
+
"directory": "servers/fluentcart-developer"
|
|
41
|
+
},
|
|
42
|
+
"bugs": {
|
|
43
|
+
"url": "https://github.com/atifjubaer/skills/issues"
|
|
44
|
+
},
|
|
45
|
+
"engines": {
|
|
46
|
+
"node": ">=22"
|
|
47
|
+
},
|
|
48
|
+
"publishConfig": {
|
|
49
|
+
"access": "public"
|
|
50
|
+
},
|
|
51
|
+
"dependencies": {
|
|
52
|
+
"@modelcontextprotocol/express": "^2.0.2",
|
|
53
|
+
"@modelcontextprotocol/node": "^2.1.2",
|
|
54
|
+
"@modelcontextprotocol/server": "^2.4.0",
|
|
55
|
+
"dotenv": "^16.4.7",
|
|
56
|
+
"express": "^4.21.2",
|
|
57
|
+
"zod": "^4.6.7"
|
|
58
|
+
},
|
|
59
|
+
"devDependencies": {
|
|
60
|
+
"@types/express": "^5.0.0",
|
|
61
|
+
"@types/node": "^22.13.0",
|
|
62
|
+
"tsx": "^4.19.2",
|
|
63
|
+
"typescript": "^5.7.3"
|
|
64
|
+
}
|
|
65
|
+
}
|