@fantastic.dev/better-stripe 0.82.0 → 0.83.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/CHANGELOG.md +6 -0
- package/README.md +1 -1
- package/dist/client/billing/renewalAttach/couponJoins.d.ts +23 -0
- package/dist/client/billing/renewalAttach/couponJoins.d.ts.map +1 -0
- package/dist/client/billing/renewalAttach/couponJoins.js +76 -0
- package/dist/client/billing/renewalAttach/couponJoins.js.map +1 -0
- package/dist/client/billing/renewalAttach/index.d.ts +3 -0
- package/dist/client/billing/renewalAttach/index.d.ts.map +1 -0
- package/dist/client/billing/renewalAttach/index.js +3 -0
- package/dist/client/billing/renewalAttach/index.js.map +1 -0
- package/dist/client/billing/renewalAttach/reader.d.ts +141 -0
- package/dist/client/billing/renewalAttach/reader.d.ts.map +1 -0
- package/dist/client/billing/renewalAttach/reader.js +80 -0
- package/dist/client/billing/renewalAttach/reader.js.map +1 -0
- package/dist/client/billing/renewalAttach/request.d.ts +30 -0
- package/dist/client/billing/renewalAttach/request.d.ts.map +1 -0
- package/dist/client/billing/renewalAttach/request.js +39 -0
- package/dist/client/billing/renewalAttach/request.js.map +1 -0
- package/dist/client/connect/payoutExecutionTestHelpers.d.ts +16 -16
- package/dist/client/connect/payoutSyncTestHelpers.d.ts +16 -16
- package/dist/client/index.d.ts +3 -5
- package/dist/client/index.d.ts.map +1 -1
- package/dist/client/index.js +3 -3
- package/dist/client/index.js.map +1 -1
- package/dist/client/renewal.d.ts +8 -0
- package/dist/client/renewal.d.ts.map +1 -0
- package/dist/client/renewal.js +4 -0
- package/dist/client/renewal.js.map +1 -0
- package/dist/client/renewalContextClient.d.ts +130 -0
- package/dist/client/renewalContextClient.d.ts.map +1 -0
- package/dist/client/renewalContextClient.js +10 -0
- package/dist/client/renewalContextClient.js.map +1 -0
- package/dist/client/usage/observationClient.d.ts +2 -2
- package/dist/client/usage/observationClient.d.ts.map +1 -1
- package/dist/component/balanceFunding/internal/actions.d.ts +11 -11
- package/dist/component/balanceFunding/stateHandlers.d.ts +8 -8
- package/dist/component/earnings/triggers.d.ts +16 -16
- package/dist/component/payoutRelease/queries.d.ts +2 -2
- package/dist/component/payoutRelease/queries.d.ts.map +1 -1
- package/dist/component/processingCostReconciliation/rollback.d.ts +1 -1
- package/dist/component/usage/allowance.fixtures.d.ts +16 -16
- package/docs/renewal-context-reads.md +113 -0
- package/docs/renewal-price-replacements.md +55 -16
- package/package.json +1 -1
- package/src/client/billing/renewalAttach/couponEvidence.test.ts +104 -0
- package/src/client/billing/renewalAttach/couponJoins.ts +95 -0
- package/src/client/billing/renewalAttach/index.ts +9 -0
- package/src/client/billing/renewalAttach/reader.test.ts +409 -0
- package/src/client/billing/renewalAttach/reader.ts +131 -0
- package/src/client/billing/renewalAttach/request.ts +49 -0
- package/src/client/index.ts +3 -8
- package/src/client/renewal.ts +13 -0
- package/src/client/renewalContextClient.ts +23 -0
package/CHANGELOG.md
CHANGED
|
@@ -26,6 +26,12 @@
|
|
|
26
26
|
- Remove internal tracker references from public documentation and add a
|
|
27
27
|
regression check that prevents their reintroduction.
|
|
28
28
|
|
|
29
|
+
## [0.83.0](https://github.com/FantasticDevHQ/better-stripe/compare/v0.82.0...v0.83.0) (2026-10-27)
|
|
30
|
+
|
|
31
|
+
### Features
|
|
32
|
+
|
|
33
|
+
- read bound renewal context and prepare attach requests ([#400](https://github.com/FantasticDevHQ/better-stripe/issues/400)) ([d0621ec](https://github.com/FantasticDevHQ/better-stripe/commit/d0621ec0e8118b7ad86097c9425e63313b0a3d80))
|
|
34
|
+
|
|
29
35
|
## [0.82.0](https://github.com/FantasticDevHQ/better-stripe/compare/v0.81.0...v0.82.0) (2026-10-27)
|
|
30
36
|
|
|
31
37
|
### Features
|
package/README.md
CHANGED
|
@@ -5,7 +5,7 @@ billing, and Connect marketplaces. It provides checkout, subscriptions, webhook
|
|
|
5
5
|
syncing, marketplace fees and splits, payouts, refunds, and disputes, with React
|
|
6
6
|
hooks and headless UI components.
|
|
7
7
|
|
|
8
|
-
**Version**: `0.
|
|
8
|
+
**Version**: `0.83.0` <!-- x-release-please-version --> (pre-1.0). API may change between minor versions until 1.0.
|
|
9
9
|
|
|
10
10
|
Connect platforms use the default GA API version. Non-Connect merchants using
|
|
11
11
|
customer-only Accounts v2 need preview access and an explicit preview version.
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
import type Stripe from "stripe";
|
|
2
|
+
/** Explicit bounded joins, never a fallback for failed or over-depth expansion. */
|
|
3
|
+
export declare function joinRenewalCoupons(stripe: Stripe, subscription: Record<string, unknown>, item: Record<string, unknown>, livemode: boolean, options: Stripe.RequestOptions): Promise<{
|
|
4
|
+
subscriptionDiscounts: {
|
|
5
|
+
id: string;
|
|
6
|
+
object: "discount";
|
|
7
|
+
deleted?: false | undefined;
|
|
8
|
+
source: {
|
|
9
|
+
type: "coupon";
|
|
10
|
+
coupon: Record<string, unknown>;
|
|
11
|
+
};
|
|
12
|
+
}[];
|
|
13
|
+
itemDiscounts: {
|
|
14
|
+
id: string;
|
|
15
|
+
object: "discount";
|
|
16
|
+
deleted?: false | undefined;
|
|
17
|
+
source: {
|
|
18
|
+
type: "coupon";
|
|
19
|
+
coupon: Record<string, unknown>;
|
|
20
|
+
};
|
|
21
|
+
}[];
|
|
22
|
+
}>;
|
|
23
|
+
//# sourceMappingURL=couponJoins.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"couponJoins.d.ts","sourceRoot":"","sources":["../../../../src/client/billing/renewalAttach/couponJoins.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,MAAM,MAAM,QAAQ,CAAC;AA2BjC,mFAAmF;AACnF,wBAAsB,kBAAkB,CACtC,MAAM,EAAE,MAAM,EACd,YAAY,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,EACrC,IAAI,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,EAC7B,QAAQ,EAAE,OAAO,EACjB,OAAO,EAAE,MAAM,CAAC,cAAc;;;;;;;;;;;;;;;;;;;GA4D/B"}
|
|
@@ -0,0 +1,76 @@
|
|
|
1
|
+
import { z } from "zod";
|
|
2
|
+
import { equal, object, unsupported } from "../renewalAggregate/shared.js";
|
|
3
|
+
import { renewalSnapshot } from "../renewalReplacementSnapshot.js";
|
|
4
|
+
const id = z.string().min(1).max(255).regex(/\S/);
|
|
5
|
+
const discount = z
|
|
6
|
+
.object({
|
|
7
|
+
id: z.string().regex(/^di_[A-Za-z0-9_]+$/),
|
|
8
|
+
object: z.literal("discount"),
|
|
9
|
+
deleted: z.literal(false).optional(),
|
|
10
|
+
source: z
|
|
11
|
+
.object({
|
|
12
|
+
type: z.literal("coupon"),
|
|
13
|
+
coupon: z.union([
|
|
14
|
+
id,
|
|
15
|
+
z
|
|
16
|
+
.object({
|
|
17
|
+
id,
|
|
18
|
+
object: z.literal("coupon"),
|
|
19
|
+
deleted: z.literal(false).optional(),
|
|
20
|
+
})
|
|
21
|
+
.passthrough(),
|
|
22
|
+
]),
|
|
23
|
+
})
|
|
24
|
+
.passthrough(),
|
|
25
|
+
})
|
|
26
|
+
.passthrough();
|
|
27
|
+
/** Explicit bounded joins, never a fallback for failed or over-depth expansion. */
|
|
28
|
+
export async function joinRenewalCoupons(stripe, subscription, item, livemode, options) {
|
|
29
|
+
const lists = [subscription.discounts, item.discounts].map((value) => {
|
|
30
|
+
const parsed = z.array(discount).max(20).safeParse(value);
|
|
31
|
+
if (!parsed.success)
|
|
32
|
+
unsupported("incomplete_or_unsupported_discount_evidence");
|
|
33
|
+
return parsed.data;
|
|
34
|
+
});
|
|
35
|
+
for (const list of lists)
|
|
36
|
+
for (const redemption of list) {
|
|
37
|
+
const ref = redemption.source.coupon;
|
|
38
|
+
if (typeof ref !== "string" &&
|
|
39
|
+
ref.livemode !== undefined &&
|
|
40
|
+
ref.livemode !== livemode)
|
|
41
|
+
unsupported("expanded_coupon_mode_mismatch");
|
|
42
|
+
}
|
|
43
|
+
const coupons = new Map();
|
|
44
|
+
for (const list of lists)
|
|
45
|
+
for (const redemption of list) {
|
|
46
|
+
const couponId = typeof redemption.source.coupon === "string"
|
|
47
|
+
? redemption.source.coupon
|
|
48
|
+
: redemption.source.coupon.id;
|
|
49
|
+
let coupon = coupons.get(couponId);
|
|
50
|
+
if (!coupon) {
|
|
51
|
+
coupon = object(renewalSnapshot(await stripe.coupons.retrieve(couponId, {}, options)));
|
|
52
|
+
if (coupon.id !== couponId ||
|
|
53
|
+
coupon.object !== "coupon" ||
|
|
54
|
+
coupon.deleted === true ||
|
|
55
|
+
(coupon.livemode !== undefined && coupon.livemode !== livemode))
|
|
56
|
+
unsupported("coupon_join_identity_mismatch");
|
|
57
|
+
coupons.set(couponId, coupon);
|
|
58
|
+
}
|
|
59
|
+
// A join may expand a string reference, but must never replace facts
|
|
60
|
+
// already present in a full read. Shape drift is conservatively rejected.
|
|
61
|
+
if (typeof redemption.source.coupon !== "string" &&
|
|
62
|
+
!equal(redemption.source.coupon, coupon))
|
|
63
|
+
unsupported("expanded_coupon_read_drift");
|
|
64
|
+
}
|
|
65
|
+
const joined = lists.map((list) => list.map((redemption) => {
|
|
66
|
+
const couponId = typeof redemption.source.coupon === "string"
|
|
67
|
+
? redemption.source.coupon
|
|
68
|
+
: redemption.source.coupon.id;
|
|
69
|
+
return {
|
|
70
|
+
...redemption,
|
|
71
|
+
source: { ...redemption.source, coupon: coupons.get(couponId) },
|
|
72
|
+
};
|
|
73
|
+
}));
|
|
74
|
+
return { subscriptionDiscounts: joined[0], itemDiscounts: joined[1] };
|
|
75
|
+
}
|
|
76
|
+
//# sourceMappingURL=couponJoins.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"couponJoins.js","sourceRoot":"","sources":["../../../../src/client/billing/renewalAttach/couponJoins.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAExB,OAAO,EAAE,KAAK,EAAE,MAAM,E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IAAI,MAAM,CAAC,QAAQ,KAAK,QAAQ,CAAC;oBAE/D,WAAW,CAAC,+BAA+B,CAAC,CAAC;gBAC/C,OAAO,CAAC,GAAG,CAAC,QAAQ,EAAE,MAAM,CAAC,CAAC;YAChC,CAAC;YACD,qEAAqE;YACrE,0EAA0E;YAC1E,IACE,OAAO,UAAU,CAAC,MAAM,CAAC,MAAM,KAAK,QAAQ;gBAC5C,CAAC,KAAK,CAAC,UAAU,CAAC,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC;gBAExC,WAAW,CAAC,4BAA4B,CAAC,CAAC;QAC9C,CAAC;IACH,MAAM,MAAM,GAAG,KAAK,CAAC,GAAG,CAAC,CAAC,IAAI,EAAE,EAAE,CAChC,IAAI,CAAC,GAAG,CAAC,CAAC,UAAU,EAAE,EAAE;QACtB,MAAM,QAAQ,GACZ,OAAO,UAAU,CAAC,MAAM,CAAC,MAAM,KAAK,QAAQ;YAC1C,CAAC,CAAC,UAAU,CAAC,MAAM,CAAC,MAAM;YAC1B,CAAC,CAAC,UAAU,CAAC,MAAM,CAAC,MAAM,CAAC,EAAE,CAAC;QAClC,OAAO;YACL,GAAG,UAAU;YACb,MAAM,EAAE,EAAE,GAAG,UAAU,CAAC,MAAM,EAAE,MAAM,EAAE,OAAO,CAAC,GAAG,CAAC,QAAQ,CAAE,EAAE;SACjE,CAAC;IACJ,CAAC,CAAC,CACH,CAAC;IACF,OAAO,EAAE,qBAAqB,EAAE,MAAM,CAAC,CAAC,CAAC,EAAE,aAAa,EAAE,MAAM,CAAC,CAAC,CAAC,EAAE,CAAC;AACxE,CAAC"}
|
|
@@ -0,0 +1,3 @@
|
|
|
1
|
+
export { readRenewalPriceReplacementContext, type ReadRenewalPriceReplacementContextOptions, } from "./reader.js";
|
|
2
|
+
export { prepareRenewalScheduleAttachment, type PrepareRenewalScheduleAttachmentOptions, type PreparedRenewalScheduleAttachment, } from "./request.js";
|
|
3
|
+
//# sourceMappingURL=index.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../src/client/billing/renewalAttach/index.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,kCAAkC,EAClC,KAAK,yCAAyC,GAC/C,MAAM,aAAa,CAAC;AACrB,OAAO,EACL,gCAAgC,EAChC,KAAK,uCAAuC,EAC5C,KAAK,iCAAiC,GACvC,MAAM,cAAc,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../src/client/billing/renewalAttach/index.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,kCAAkC,GAEnC,MAAM,aAAa,CAAC;AACrB,OAAO,EACL,gCAAgC,GAGjC,MAAM,cAAc,CAAC"}
|
|
@@ -0,0 +1,141 @@
|
|
|
1
|
+
import { z } from "zod";
|
|
2
|
+
import type Stripe from "stripe";
|
|
3
|
+
declare const input: z.ZodObject<{
|
|
4
|
+
expected: z.ZodObject<{
|
|
5
|
+
customerAccountId: z.ZodString;
|
|
6
|
+
subscriptionId: z.ZodString;
|
|
7
|
+
itemId: z.ZodString;
|
|
8
|
+
currentPriceId: z.ZodString;
|
|
9
|
+
currentProductId: z.ZodString;
|
|
10
|
+
targetPriceId: z.ZodString;
|
|
11
|
+
targetProductId: z.ZodString;
|
|
12
|
+
periodStart: z.ZodNumber;
|
|
13
|
+
periodEnd: z.ZodNumber;
|
|
14
|
+
livemode: z.ZodBoolean;
|
|
15
|
+
}, z.core.$strict>;
|
|
16
|
+
}, z.core.$strict>;
|
|
17
|
+
export type ReadRenewalPriceReplacementContextOptions = z.infer<typeof input>;
|
|
18
|
+
/** Fixed provider read profile. Evidence acquisition is not write qualification. */
|
|
19
|
+
export declare function readRenewalPriceReplacementContext(stripe: Stripe, options: ReadRenewalPriceReplacementContextOptions, apiVersion: string): Promise<{
|
|
20
|
+
version: 1;
|
|
21
|
+
scope: "platform";
|
|
22
|
+
apiVersion: string;
|
|
23
|
+
readProfile: "renewal-context-v1";
|
|
24
|
+
providerQualification: "required";
|
|
25
|
+
observedAt: number;
|
|
26
|
+
subscription: {
|
|
27
|
+
id: string;
|
|
28
|
+
object: "subscription";
|
|
29
|
+
customer_account: string;
|
|
30
|
+
status: "active";
|
|
31
|
+
currency: string;
|
|
32
|
+
livemode: boolean;
|
|
33
|
+
cancel_at: null;
|
|
34
|
+
cancel_at_period_end: false;
|
|
35
|
+
pause_collection: null;
|
|
36
|
+
pending_update: null;
|
|
37
|
+
default_source: null;
|
|
38
|
+
application_fee_percent: null;
|
|
39
|
+
payment_settings: {
|
|
40
|
+
payment_method_options: null;
|
|
41
|
+
payment_method_types: null;
|
|
42
|
+
save_default_payment_method: "off" | null;
|
|
43
|
+
} | null;
|
|
44
|
+
billing_schedules?: unknown[] | undefined;
|
|
45
|
+
schedule: string | {
|
|
46
|
+
[x: string]: unknown;
|
|
47
|
+
id: string;
|
|
48
|
+
object: "subscription_schedule";
|
|
49
|
+
deleted?: false | undefined;
|
|
50
|
+
} | null;
|
|
51
|
+
discounts: {
|
|
52
|
+
id: string;
|
|
53
|
+
object: "discount";
|
|
54
|
+
deleted?: false | undefined;
|
|
55
|
+
source: {
|
|
56
|
+
type: "coupon";
|
|
57
|
+
coupon: Record<string, unknown>;
|
|
58
|
+
};
|
|
59
|
+
}[];
|
|
60
|
+
items: {
|
|
61
|
+
has_more: false;
|
|
62
|
+
data: {
|
|
63
|
+
id: string;
|
|
64
|
+
object: "subscription_item";
|
|
65
|
+
subscription: string;
|
|
66
|
+
current_period_start: number;
|
|
67
|
+
current_period_end: number;
|
|
68
|
+
quantity: number;
|
|
69
|
+
price: {
|
|
70
|
+
[x: string]: unknown;
|
|
71
|
+
id: string;
|
|
72
|
+
object: "price";
|
|
73
|
+
product: string | {
|
|
74
|
+
[x: string]: unknown;
|
|
75
|
+
id: string;
|
|
76
|
+
object: "product";
|
|
77
|
+
deleted?: false | undefined;
|
|
78
|
+
};
|
|
79
|
+
active: boolean;
|
|
80
|
+
livemode: boolean;
|
|
81
|
+
type: "recurring";
|
|
82
|
+
currency: string;
|
|
83
|
+
billing_scheme: "per_unit";
|
|
84
|
+
recurring: {
|
|
85
|
+
[x: string]: unknown;
|
|
86
|
+
interval: "day" | "month" | "week" | "year";
|
|
87
|
+
interval_count: number;
|
|
88
|
+
usage_type: "licensed";
|
|
89
|
+
};
|
|
90
|
+
};
|
|
91
|
+
discounts: {
|
|
92
|
+
id: string;
|
|
93
|
+
object: "discount";
|
|
94
|
+
deleted?: false | undefined;
|
|
95
|
+
source: {
|
|
96
|
+
type: "coupon";
|
|
97
|
+
coupon: Record<string, unknown>;
|
|
98
|
+
};
|
|
99
|
+
}[];
|
|
100
|
+
}[];
|
|
101
|
+
};
|
|
102
|
+
};
|
|
103
|
+
targetPrice: {
|
|
104
|
+
[x: string]: unknown;
|
|
105
|
+
id: string;
|
|
106
|
+
object: "price";
|
|
107
|
+
product: string | {
|
|
108
|
+
[x: string]: unknown;
|
|
109
|
+
id: string;
|
|
110
|
+
object: "product";
|
|
111
|
+
deleted?: false | undefined;
|
|
112
|
+
};
|
|
113
|
+
active: boolean;
|
|
114
|
+
livemode: boolean;
|
|
115
|
+
type: "recurring";
|
|
116
|
+
currency: string;
|
|
117
|
+
billing_scheme: "per_unit";
|
|
118
|
+
recurring: {
|
|
119
|
+
[x: string]: unknown;
|
|
120
|
+
interval: "day" | "month" | "week" | "year";
|
|
121
|
+
interval_count: number;
|
|
122
|
+
usage_type: "licensed";
|
|
123
|
+
};
|
|
124
|
+
};
|
|
125
|
+
billingCustomer: {
|
|
126
|
+
[x: string]: unknown;
|
|
127
|
+
id: string;
|
|
128
|
+
object: "customer";
|
|
129
|
+
customer_account: string;
|
|
130
|
+
livemode: boolean;
|
|
131
|
+
deleted?: false | undefined;
|
|
132
|
+
discount: {
|
|
133
|
+
[x: string]: unknown;
|
|
134
|
+
id: string;
|
|
135
|
+
object: "discount";
|
|
136
|
+
deleted?: false | undefined;
|
|
137
|
+
} | null;
|
|
138
|
+
};
|
|
139
|
+
}>;
|
|
140
|
+
export {};
|
|
141
|
+
//# sourceMappingURL=reader.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"reader.d.ts","sourceRoot":"","sources":["../../../../src/client/billing/renewalAttach/reader.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AACxB,OAAO,KAAK,MAAM,MAAM,QAAQ,CAAC;AAkBjC,QAAA,MAAM,KAAK;;;;;;;;;;;;;kBAAmD,CAAC;AAC/D,MAAM,MAAM,yCAAyC,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,KAAK,CAAC,CAAC;AAe9E,oFAAoF;AACpF,wBAAsB,kCAAkC,CACtD,MAAM,EAAE,MAAM,EACd,OAAO,EAAE,yCAAyC,EAClD,UAAU,EAAE,MAAM;aAiFP,CAAC;WACH,UAAU;;iBAEJ,oBAAoB;2BACV,UAAU;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAMpC"}
|
|
@@ -0,0 +1,80 @@
|
|
|
1
|
+
import { z } from "zod";
|
|
2
|
+
import { renewalExpected, renewalSubscription, renewalPrice, renewalBillingCustomer, } from "../renewalReplacementSchema.js";
|
|
3
|
+
import { renewalSnapshot } from "../renewalReplacementSnapshot.js";
|
|
4
|
+
import { productId, referenceId, resourceId, supportedVersion, unsupported, timestamp, } from "../renewalAggregate/shared.js";
|
|
5
|
+
import { joinRenewalCoupons } from "./couponJoins.js";
|
|
6
|
+
const input = z.object({ expected: renewalExpected }).strict();
|
|
7
|
+
const observedSchedule = z.union([
|
|
8
|
+
z.null(),
|
|
9
|
+
resourceId("sub_sched"),
|
|
10
|
+
z
|
|
11
|
+
.object({
|
|
12
|
+
id: resourceId("sub_sched"),
|
|
13
|
+
object: z.literal("subscription_schedule"),
|
|
14
|
+
deleted: z.literal(false).optional(),
|
|
15
|
+
})
|
|
16
|
+
.passthrough(),
|
|
17
|
+
]);
|
|
18
|
+
const readSubscription = renewalSubscription.extend({
|
|
19
|
+
schedule: observedSchedule,
|
|
20
|
+
});
|
|
21
|
+
/** Fixed provider read profile. Evidence acquisition is not write qualification. */
|
|
22
|
+
export async function readRenewalPriceReplacementContext(stripe, options, apiVersion) {
|
|
23
|
+
const args = input.parse(renewalSnapshot(options));
|
|
24
|
+
supportedVersion(apiVersion);
|
|
25
|
+
const expected = args.expected;
|
|
26
|
+
const requestOptions = {
|
|
27
|
+
apiVersion: "2026-09-30.endive",
|
|
28
|
+
maxNetworkRetries: 0,
|
|
29
|
+
};
|
|
30
|
+
const subscription = readSubscription.parse(renewalSnapshot(await stripe.subscriptions.retrieve(expected.subscriptionId, { expand: ["discounts", "items.data.discounts", "items.data.price"] }, requestOptions)));
|
|
31
|
+
const item = subscription.items.data[0];
|
|
32
|
+
const context = {
|
|
33
|
+
customerAccountId: expected.customerAccountId,
|
|
34
|
+
livemode: expected.livemode,
|
|
35
|
+
};
|
|
36
|
+
if (subscription.id !== expected.subscriptionId ||
|
|
37
|
+
subscription.customer_account !== expected.customerAccountId ||
|
|
38
|
+
subscription.livemode !== expected.livemode ||
|
|
39
|
+
item.id !== expected.itemId ||
|
|
40
|
+
item.subscription !== expected.subscriptionId ||
|
|
41
|
+
item.price.id !== expected.currentPriceId ||
|
|
42
|
+
item.price.livemode !== expected.livemode ||
|
|
43
|
+
productId(item.price.product, context) !== expected.currentProductId ||
|
|
44
|
+
item.current_period_start !== expected.periodStart ||
|
|
45
|
+
item.current_period_end !== expected.periodEnd)
|
|
46
|
+
unsupported("original_read_identity_mismatch");
|
|
47
|
+
const targetPrice = renewalPrice.parse(renewalSnapshot(await stripe.prices.retrieve(expected.targetPriceId, {}, requestOptions)));
|
|
48
|
+
if (targetPrice.id !== expected.targetPriceId ||
|
|
49
|
+
targetPrice.livemode !== expected.livemode ||
|
|
50
|
+
productId(targetPrice.product, context) !== expected.targetProductId)
|
|
51
|
+
unsupported("target_read_identity_mismatch");
|
|
52
|
+
const customerId = referenceId(subscription.customer, "cus", "customer", context);
|
|
53
|
+
const billingCustomer = renewalBillingCustomer.parse(renewalSnapshot(await stripe.customers.retrieve(customerId, {}, requestOptions)));
|
|
54
|
+
if (billingCustomer.id !== customerId ||
|
|
55
|
+
billingCustomer.customer_account !== expected.customerAccountId ||
|
|
56
|
+
billingCustomer.livemode !== expected.livemode)
|
|
57
|
+
unsupported("billing_customer_identity_mismatch");
|
|
58
|
+
const joined = await joinRenewalCoupons(stripe, subscription, item, expected.livemode, requestOptions);
|
|
59
|
+
const normalizedSubscription = {
|
|
60
|
+
...subscription,
|
|
61
|
+
discounts: joined.subscriptionDiscounts,
|
|
62
|
+
items: {
|
|
63
|
+
...subscription.items,
|
|
64
|
+
data: [{ ...item, discounts: joined.itemDiscounts }],
|
|
65
|
+
},
|
|
66
|
+
};
|
|
67
|
+
const observedAt = timestamp.parse(Math.floor(Date.now() / 1000));
|
|
68
|
+
return renewalSnapshot({
|
|
69
|
+
version: 1,
|
|
70
|
+
scope: "platform",
|
|
71
|
+
apiVersion,
|
|
72
|
+
readProfile: "renewal-context-v1",
|
|
73
|
+
providerQualification: "required",
|
|
74
|
+
observedAt,
|
|
75
|
+
subscription: normalizedSubscription,
|
|
76
|
+
targetPrice,
|
|
77
|
+
billingCustomer,
|
|
78
|
+
});
|
|
79
|
+
}
|
|
80
|
+
//# sourceMappingURL=reader.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"reader.js","sourceRoot":"","sources":["../../../../src/client/billing/renewalAttach/reader.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAExB,OAAO,EACL,eAAe,EACf,mBAAmB,EACnB,YAAY,EACZ,sBAAsB,GACvB,MAAM,gCAAgC,CAAC;AACxC,OAAO,EAAE,eAAe,EAAE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AAC;AACL,CAAC"}
|
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
import { z } from "zod";
|
|
2
|
+
declare const input: z.ZodObject<{
|
|
3
|
+
prepared: z.ZodUnknown;
|
|
4
|
+
apiVersion: z.ZodString;
|
|
5
|
+
attachKey: z.ZodString;
|
|
6
|
+
firstDispatchedAt: z.ZodNumber;
|
|
7
|
+
}, z.core.$strict>;
|
|
8
|
+
export type PrepareRenewalScheduleAttachmentOptions = z.infer<typeof input>;
|
|
9
|
+
/** Pure retained request only. It neither authorizes nor dispatches attachment. */
|
|
10
|
+
export declare function prepareRenewalScheduleAttachment(options: PrepareRenewalScheduleAttachmentOptions): {
|
|
11
|
+
version: 1;
|
|
12
|
+
stage: "attach";
|
|
13
|
+
scope: "platform";
|
|
14
|
+
apiVersion: string;
|
|
15
|
+
logicalBinding: string;
|
|
16
|
+
method: "POST";
|
|
17
|
+
path: "/v1/subscription_schedules";
|
|
18
|
+
payload: {
|
|
19
|
+
from_subscription: string;
|
|
20
|
+
};
|
|
21
|
+
key: string;
|
|
22
|
+
firstDispatchedAt: number;
|
|
23
|
+
requestIdentity: {
|
|
24
|
+
key: string;
|
|
25
|
+
binding: string;
|
|
26
|
+
};
|
|
27
|
+
};
|
|
28
|
+
export type PreparedRenewalScheduleAttachment = ReturnType<typeof prepareRenewalScheduleAttachment>;
|
|
29
|
+
export {};
|
|
30
|
+
//# sourceMappingURL=request.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"request.d.ts","sourceRoot":"","sources":["../../../../src/client/billing/renewalAttach/request.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAWxB,QAAA,MAAM,KAAK;;;;;kBAOA,CAAC;AACZ,MAAM,MAAM,uCAAuC,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,KAAK,CAAC,CAAC;AAC5E,mFAAmF;AACnF,wBAAgB,gCAAgC,CAC9C,OAAO,EAAE,uCAAuC;aAQrC,CAAC;WACH,QAAQ;WACR,UAAU;;;YAGT,MAAM;UACR,4BAA4B;;QACvB,iBAAiB;;;;;;;;EAQ/B;AACD,MAAM,MAAM,iCAAiC,GAAG,UAAU,CACxD,OAAO,gCAAgC,CACxC,CAAC"}
|
|
@@ -0,0 +1,39 @@
|
|
|
1
|
+
import { z } from "zod";
|
|
2
|
+
import { retainedPreparation } from "../renewalAggregate/preflight.js";
|
|
3
|
+
import { binding, supportedVersion, timestamp, unsupported, } from "../renewalAggregate/shared.js";
|
|
4
|
+
import { idempotencyOptions } from "../../core/idempotency.js";
|
|
5
|
+
import { renewalSnapshot } from "../renewalReplacementSnapshot.js";
|
|
6
|
+
const input = z
|
|
7
|
+
.object({
|
|
8
|
+
prepared: z.unknown(),
|
|
9
|
+
apiVersion: z.string(),
|
|
10
|
+
attachKey: z.string(),
|
|
11
|
+
firstDispatchedAt: timestamp,
|
|
12
|
+
})
|
|
13
|
+
.strict();
|
|
14
|
+
/** Pure retained request only. It neither authorizes nor dispatches attachment. */
|
|
15
|
+
export function prepareRenewalScheduleAttachment(options) {
|
|
16
|
+
const args = input.parse(renewalSnapshot(options));
|
|
17
|
+
supportedVersion(args.apiVersion);
|
|
18
|
+
const prepared = retainedPreparation(args.prepared);
|
|
19
|
+
const key = idempotencyOptions(args.attachKey)?.idempotencyKey;
|
|
20
|
+
if (!key)
|
|
21
|
+
unsupported("missing_explicit_attach_key");
|
|
22
|
+
const request = {
|
|
23
|
+
version: 1,
|
|
24
|
+
stage: "attach",
|
|
25
|
+
scope: "platform",
|
|
26
|
+
apiVersion: args.apiVersion,
|
|
27
|
+
logicalBinding: prepared.requestIdentity.binding,
|
|
28
|
+
method: "POST",
|
|
29
|
+
path: "/v1/subscription_schedules",
|
|
30
|
+
payload: { from_subscription: prepared.expected.subscriptionId },
|
|
31
|
+
key,
|
|
32
|
+
firstDispatchedAt: args.firstDispatchedAt,
|
|
33
|
+
};
|
|
34
|
+
return renewalSnapshot({
|
|
35
|
+
...request,
|
|
36
|
+
requestIdentity: { key, binding: binding("renewal-attach", request) },
|
|
37
|
+
});
|
|
38
|
+
}
|
|
39
|
+
//# sourceMappingURL=request.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"request.js","sourceRoot":"","sources":["../../../../src/client/billing/renewalAttach/request.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AACxB,OAAO,EAAE,mBAAmB,EAAE,MAAM,kCAAkC,CAAC;AACvE,OAAO,EACL,OAAO,EACP,gBAAgB,EAChB,SAAS,EACT,WAAW,GACZ,MAAM,+BAA+B,CAAC;AACvC,OAAO,EAAE,kBAAkB,EAAE,MAAM,2BAA2B,CAAC;AAC/D,OAAO,EAAE,eAAe,EAAE,MAAM,kCAAkC,CAAC;AAEnE,MAAM,KAAK,GAAG,CAAC;KACZ,MAAM,CAAC;IACN,QAAQ,EAAE,CAAC,CAAC,OAAO,EAAE;IACrB,UAAU,EAAE,CAAC,CAAC,MAAM,EAAE;IACtB,SAAS,EAAE,CAAC,CAAC,MAAM,EAAE;IACrB,iBAAiB,EAAE,SAAS;CAC7B,CAAC;KACD,MAAM,EAAE,CAAC;AAEZ,mFAAmF;AACnF,MAAM,UAAU,gCAAgC,CAC9C,OAAgD;IAEhD,MAAM,IAAI,GAAG,KAAK,CAAC,KAAK,CAAC,eAAe,CAAC,OAAO,CAAC,CAAC,CAAC;IACnD,gBAAgB,CAAC,IAAI,CAAC,UAAU,CAAC,CAAC;IAClC,MAAM,QAAQ,GAAG,mBAAmB,CAAC,IAAI,CAAC,QAAQ,CAAC,CAAC;IACpD,MAAM,GAAG,GAAG,kBAAkB,CAAC,IAAI,CAAC,SAAS,CAAC,EAAE,cAAc,CAAC;IAC/D,IAAI,CAAC,GAAG;QAAE,WAAW,CAAC,6BAA6B,CAAC,CAAC;IACrD,MAAM,OAAO,GAAG;QACd,OAAO,EAAE,CAAU;QACnB,KAAK,EAAE,QAAiB;QACxB,KAAK,EAAE,UAAmB;QAC1B,UAAU,EAAE,IAAI,CAAC,UAAU;QAC3B,cAAc,EAAE,QAAQ,CAAC,eAAe,CAAC,OAAO;QAChD,MAAM,EAAE,MAAe;QACvB,IAAI,EAAE,4BAAqC;QAC3C,OAAO,EAAE,EAAE,iBAAiB,EAAE,QAAQ,CAAC,QAAQ,CAAC,cAAc,EAAE;QAChE,GAAG;QACH,iBAAiB,EAAE,IAAI,CAAC,iBAAiB;KAC1C,CAAC;IACF,OAAO,eAAe,CAAC;QACrB,GAAG,OAAO;QACV,eAAe,EAAE,EAAE,GAAG,EAAE,OAAO,EAAE,OAAO,CAAC,gBAAgB,EAAE,OAAO,CAAC,EAAE;KACtE,CAAC,CAAC;AACL,CAAC"}
|
|
@@ -2361,14 +2361,6 @@ export declare function setup(amounts?: number[]): Promise<{
|
|
|
2361
2361
|
preparationId: import("convex/values").GenericId<"balanceFundingPreparations">;
|
|
2362
2362
|
requestKey: string;
|
|
2363
2363
|
result?: {
|
|
2364
|
-
reason: "identity_changed" | "revision_changed" | "scope_busy";
|
|
2365
|
-
retryable: false;
|
|
2366
|
-
status: "conflict";
|
|
2367
|
-
} | {
|
|
2368
|
-
reason: "policy_invalid";
|
|
2369
|
-
retryable: false;
|
|
2370
|
-
status: "rejected";
|
|
2371
|
-
} | {
|
|
2372
2364
|
operation: {
|
|
2373
2365
|
accountId: string;
|
|
2374
2366
|
operationId: import("convex/values").GenericId<"balanceFundingOperations">;
|
|
@@ -2379,6 +2371,14 @@ export declare function setup(amounts?: number[]): Promise<{
|
|
|
2379
2371
|
} | {
|
|
2380
2372
|
enabled: boolean;
|
|
2381
2373
|
status: "unchanged";
|
|
2374
|
+
} | {
|
|
2375
|
+
reason: "identity_changed" | "revision_changed" | "scope_busy";
|
|
2376
|
+
retryable: false;
|
|
2377
|
+
status: "conflict";
|
|
2378
|
+
} | {
|
|
2379
|
+
reason: "policy_invalid";
|
|
2380
|
+
retryable: false;
|
|
2381
|
+
status: "rejected";
|
|
2382
2382
|
} | {
|
|
2383
2383
|
reason: "provider_pending";
|
|
2384
2384
|
retryable: true;
|
|
@@ -2389,14 +2389,6 @@ export declare function setup(amounts?: number[]): Promise<{
|
|
|
2389
2389
|
payload: import("convex/values").VString<string, "required">;
|
|
2390
2390
|
preparationId: import("convex/values").VId<import("convex/values").GenericId<"balanceFundingPreparations">, "required">;
|
|
2391
2391
|
result: import("convex/values").VUnion<{
|
|
2392
|
-
reason: "identity_changed" | "revision_changed" | "scope_busy";
|
|
2393
|
-
retryable: false;
|
|
2394
|
-
status: "conflict";
|
|
2395
|
-
} | {
|
|
2396
|
-
reason: "policy_invalid";
|
|
2397
|
-
retryable: false;
|
|
2398
|
-
status: "rejected";
|
|
2399
|
-
} | {
|
|
2400
2392
|
operation: {
|
|
2401
2393
|
accountId: string;
|
|
2402
2394
|
operationId: import("convex/values").GenericId<"balanceFundingOperations">;
|
|
@@ -2407,6 +2399,14 @@ export declare function setup(amounts?: number[]): Promise<{
|
|
|
2407
2399
|
} | {
|
|
2408
2400
|
enabled: boolean;
|
|
2409
2401
|
status: "unchanged";
|
|
2402
|
+
} | {
|
|
2403
|
+
reason: "identity_changed" | "revision_changed" | "scope_busy";
|
|
2404
|
+
retryable: false;
|
|
2405
|
+
status: "conflict";
|
|
2406
|
+
} | {
|
|
2407
|
+
reason: "policy_invalid";
|
|
2408
|
+
retryable: false;
|
|
2409
|
+
status: "rejected";
|
|
2410
2410
|
} | {
|
|
2411
2411
|
reason: "provider_pending";
|
|
2412
2412
|
retryable: true;
|
|
@@ -2365,6 +2365,14 @@ export declare function setup(scope?: Scope): Promise<{
|
|
|
2365
2365
|
preparationId: import("convex/values").GenericId<"balanceFundingPreparations">;
|
|
2366
2366
|
requestKey: string;
|
|
2367
2367
|
result?: {
|
|
2368
|
+
reason: "identity_changed" | "revision_changed" | "scope_busy";
|
|
2369
|
+
retryable: false;
|
|
2370
|
+
status: "conflict";
|
|
2371
|
+
} | {
|
|
2372
|
+
reason: "policy_invalid";
|
|
2373
|
+
retryable: false;
|
|
2374
|
+
status: "rejected";
|
|
2375
|
+
} | {
|
|
2368
2376
|
operation: {
|
|
2369
2377
|
accountId: string;
|
|
2370
2378
|
operationId: import("convex/values").GenericId<"balanceFundingOperations">;
|
|
@@ -2375,14 +2383,6 @@ export declare function setup(scope?: Scope): Promise<{
|
|
|
2375
2383
|
} | {
|
|
2376
2384
|
enabled: boolean;
|
|
2377
2385
|
status: "unchanged";
|
|
2378
|
-
} | {
|
|
2379
|
-
reason: "identity_changed" | "revision_changed" | "scope_busy";
|
|
2380
|
-
retryable: false;
|
|
2381
|
-
status: "conflict";
|
|
2382
|
-
} | {
|
|
2383
|
-
reason: "policy_invalid";
|
|
2384
|
-
retryable: false;
|
|
2385
|
-
status: "rejected";
|
|
2386
2386
|
} | {
|
|
2387
2387
|
reason: "provider_pending";
|
|
2388
2388
|
retryable: true;
|
|
@@ -2393,6 +2393,14 @@ export declare function setup(scope?: Scope): Promise<{
|
|
|
2393
2393
|
payload: import("convex/values").VString<string, "required">;
|
|
2394
2394
|
preparationId: import("convex/values").VId<import("convex/values").GenericId<"balanceFundingPreparations">, "required">;
|
|
2395
2395
|
result: import("convex/values").VUnion<{
|
|
2396
|
+
reason: "identity_changed" | "revision_changed" | "scope_busy";
|
|
2397
|
+
retryable: false;
|
|
2398
|
+
status: "conflict";
|
|
2399
|
+
} | {
|
|
2400
|
+
reason: "policy_invalid";
|
|
2401
|
+
retryable: false;
|
|
2402
|
+
status: "rejected";
|
|
2403
|
+
} | {
|
|
2396
2404
|
operation: {
|
|
2397
2405
|
accountId: string;
|
|
2398
2406
|
operationId: import("convex/values").GenericId<"balanceFundingOperations">;
|
|
@@ -2403,14 +2411,6 @@ export declare function setup(scope?: Scope): Promise<{
|
|
|
2403
2411
|
} | {
|
|
2404
2412
|
enabled: boolean;
|
|
2405
2413
|
status: "unchanged";
|
|
2406
|
-
} | {
|
|
2407
|
-
reason: "identity_changed" | "revision_changed" | "scope_busy";
|
|
2408
|
-
retryable: false;
|
|
2409
|
-
status: "conflict";
|
|
2410
|
-
} | {
|
|
2411
|
-
reason: "policy_invalid";
|
|
2412
|
-
retryable: false;
|
|
2413
|
-
status: "rejected";
|
|
2414
2414
|
} | {
|
|
2415
2415
|
reason: "provider_pending";
|
|
2416
2416
|
retryable: true;
|
package/dist/client/index.d.ts
CHANGED
|
@@ -1,6 +1,4 @@
|
|
|
1
|
-
export
|
|
2
|
-
export type { PrepareRenewalPriceReplacementOptions, PreparedRenewalPriceReplacement, } from "./billing/renewalPriceReplacement.js";
|
|
3
|
-
export type { RenewalPriceReplacementExpected } from "./billing/renewalReplacementSchema.js";
|
|
1
|
+
export * from "./renewal.js";
|
|
4
2
|
export { qualifyCapturedCheckoutPayment } from "./billing/capturedCheckoutPayment.js";
|
|
5
3
|
export type { CapturedCheckoutPaymentExpected, CapturedCheckoutPaymentObservation, } from "./billing/capturedCheckoutPayment.js";
|
|
6
4
|
export type { ProductIdentityResult, PriceIdentityResult, } from "./products/identity.js";
|
|
@@ -38,7 +36,7 @@ import type { CreateCheckoutSessionOptions } from "./billing/checkoutOptions.js"
|
|
|
38
36
|
export type { CreateCheckoutSessionOptions } from "./billing/checkoutOptions.js";
|
|
39
37
|
import * as intentsImpl from "./billing/intents.js";
|
|
40
38
|
export type * from "./billing/intents.js";
|
|
41
|
-
import {
|
|
39
|
+
import { RenewalContextClient } from "./renewalContextClient.js";
|
|
42
40
|
export type { CreateBillingPortalConfigurationOptions, RetrieveBillingPortalConfigurationOptions, UpdateBillingPortalConfigurationOptions, CreateBillingPortalSessionOptions, BillingPortalSubscriptionUpdateFlow, BillingPortalSessionRequestIdentity, } from "./core/accountLinks.js";
|
|
43
41
|
export { prepareBillingPortalSessionRequestIdentity } from "./core/accountLinks.js";
|
|
44
42
|
export type { AdoptProductOptions, EnsurePriceOptions, } from "./products/catalog.js";
|
|
@@ -112,7 +110,7 @@ export { ALL_BETTER_STRIPE_EVENTS, BETTER_STRIPE_V2_WEBHOOK_EVENTS, BETTER_STRIP
|
|
|
112
110
|
export type { BetterStripeV2WebhookEvent, BetterStripeWebhookEvent, } from "./utils/webhookEndpoints.js";
|
|
113
111
|
export type { StripeDashboardResourceType, StripeMode, } from "./utils/stripeDashboardUrl.js";
|
|
114
112
|
export type BetterStripeComponent = ComponentApi;
|
|
115
|
-
export declare class BetterStripe extends
|
|
113
|
+
export declare class BetterStripe extends RenewalContextClient {
|
|
116
114
|
get usage(): UsageLedgerClient;
|
|
117
115
|
readonly stripeApiVersion: SupportedStripeApiVersion;
|
|
118
116
|
private _apiKey?;
|