@waffo/pancake-ts 0.18.0 → 0.19.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/CHANGELOG.md +14 -0
- package/README.md +1 -1
- package/dist/index.cjs +17 -3
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +37 -6
- package/dist/index.d.ts +37 -6
- package/dist/index.js +17 -3
- package/dist/index.js.map +1 -1
- package/package.json +1 -1
package/CHANGELOG.md
CHANGED
|
@@ -4,6 +4,19 @@ All notable changes to `@waffo/pancake-ts` will be documented in this file.
|
|
|
4
4
|
|
|
5
5
|
Format follows [Keep a Changelog](https://keepachangelog.com/en/1.1.0/), versioning follows [Semantic Versioning](https://semver.org/spec/v2.0.0.html).
|
|
6
6
|
|
|
7
|
+
## [0.19.0] - 2026-08-18
|
|
8
|
+
|
|
9
|
+
Subscription products can now charge for the trial period.
|
|
10
|
+
|
|
11
|
+
### Added
|
|
12
|
+
|
|
13
|
+
- **`PriceInfo.trialAmount`** — trial period price as a display string, subscription products only. Omit it for a free trial. It requires `metadata.trialDays` on the product and must be lower than `amount`; the API rejects either violation with a 400.
|
|
14
|
+
- **`PriceSnapshot`** — the type `CreateCheckoutSessionParams.priceSnapshot` accepts. Same shape as `PriceInfo` without `trialAmount`.
|
|
15
|
+
|
|
16
|
+
### Changed
|
|
17
|
+
|
|
18
|
+
- **`CreateCheckoutSessionParams.priceSnapshot` is typed `PriceSnapshot` rather than `PriceInfo`.** A session-level override replaces the regular period price; the trial price comes from the product version locked into the session, so a `trialAmount` passed here would be dropped server-side. Existing calls compile unchanged — the fields `PriceSnapshot` declares are exactly the two `PriceInfo` had before `trialAmount` was added.
|
|
19
|
+
|
|
7
20
|
## [0.18.0] - 2026-08-08
|
|
8
21
|
|
|
9
22
|
Customer sessions never reached the API, and webhook retries were rejected as replays.
|
|
@@ -25,6 +38,7 @@ Customer sessions never reached the API, and webhook retries were rejected as re
|
|
|
25
38
|
- `client.buyer(token, options)` (deprecated) accepts and forwards the same options.
|
|
26
39
|
- **`VerifyWebhookOptions.toleranceMs` default raised from `300000` to `2700000`, and the window is now asymmetric** — matching the gateway's API Key check, which pairs a wide past-facing window with a tight future-facing one. `toleranceMs` now means "how far in the past"; the future direction is `futureToleranceMs`. `toleranceMs: 0` still disables the check entirely. A captured request stays replayable for longer under the wider window, so keep your handler idempotent on the event `id` — that, not the window, is the real defense.
|
|
27
40
|
|
|
41
|
+
|
|
28
42
|
## [0.17.0] - 2026-08-03
|
|
29
43
|
|
|
30
44
|
`supportEmail` and `website` were never applied by the update-store endpoint — passing them was silently ignored.
|
package/README.md
CHANGED
|
@@ -74,7 +74,7 @@ Waffo supports two checkout modes based on whether the merchant knows the custom
|
|
|
74
74
|
|
|
75
75
|
Both modes support **dynamic pricing** and **trial control** at checkout time:
|
|
76
76
|
|
|
77
|
-
- `priceSnapshot` — override the product's stored price with a custom amount (e.g., coupon, volume discount)
|
|
77
|
+
- `priceSnapshot` — override the product's stored price with a custom amount (e.g., coupon, volume discount); for subscription products this replaces the regular period price only
|
|
78
78
|
- `withTrial` — explicitly enable or disable the trial period for subscriptions (`true` = force trial, `false` = skip trial, omit = use default rules)
|
|
79
79
|
|
|
80
80
|
### Authenticated Checkout (Recommended)
|
package/dist/index.cjs
CHANGED
|
@@ -588,7 +588,9 @@ var CustomerSession = class {
|
|
|
588
588
|
*
|
|
589
589
|
* @example
|
|
590
590
|
* const { orderId, status } = await customer.cancelSubscription({ orderId: "ORD_xxx" });
|
|
591
|
-
* // status: "canceled" (was pending)
|
|
591
|
+
* // status: "canceled" (was pending)
|
|
592
|
+
* // or "canceling" (was active — stops at the end of the current period)
|
|
593
|
+
* // or "canceling" (was past_due — stops immediately)
|
|
592
594
|
*/
|
|
593
595
|
async cancelSubscription(params) {
|
|
594
596
|
validateShortId("orderId", params.orderId, "ORD");
|
|
@@ -610,6 +612,12 @@ var CustomerSession = class {
|
|
|
610
612
|
/**
|
|
611
613
|
* Reactivate a subscription that is in `canceling` status.
|
|
612
614
|
*
|
|
615
|
+
* A subscription that had an unpaid charge at the moment cancellation was
|
|
616
|
+
* requested is refused with 400 (`Subscription with an unpaid balance cannot
|
|
617
|
+
* be reactivated`), which is worded differently from the 400 returned when
|
|
618
|
+
* the order is not in `canceling` status. Cancelling a `past_due`
|
|
619
|
+
* subscription always falls into the former category.
|
|
620
|
+
*
|
|
613
621
|
* @param params - Order to reactivate
|
|
614
622
|
* @returns Order ID and resulting status
|
|
615
623
|
*
|
|
@@ -808,8 +816,14 @@ var OrdersResource = class {
|
|
|
808
816
|
/**
|
|
809
817
|
* Cancel a subscription order.
|
|
810
818
|
*
|
|
811
|
-
* - pending -> canceled (immediate)
|
|
812
|
-
* - active/trialing -> canceling (PSP cancel
|
|
819
|
+
* - pending -> canceled (immediate, no PSP call)
|
|
820
|
+
* - active/trialing -> canceling (PSP cancel scheduled for the end of the
|
|
821
|
+
* current billing period; the subscription stays usable until then)
|
|
822
|
+
* - past_due -> canceling (PSP cancel dispatched immediately; the billing
|
|
823
|
+
* period has already lapsed, so nothing is left to use)
|
|
824
|
+
*
|
|
825
|
+
* In both canceling cases the terminal `canceled` status is written when the
|
|
826
|
+
* PSP cancellation webhook arrives, not by this call.
|
|
813
827
|
*
|
|
814
828
|
* @param params - Order to cancel
|
|
815
829
|
* @returns Order ID and resulting status
|