@proxy-checkout/stripe-server-js 0.1.0-prx-146.162.1 → 0.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.
Files changed (65) hide show
  1. package/README.md +15 -113
  2. package/dist/cjs/errors.d.cts +1 -68
  3. package/dist/cjs/errors.d.ts +1 -68
  4. package/dist/cjs/errors.js +1 -86
  5. package/dist/cjs/index.d.cts +4 -10
  6. package/dist/cjs/index.d.ts +4 -10
  7. package/dist/cjs/index.js +1 -24
  8. package/dist/cjs/metadata.d.cts +2 -26
  9. package/dist/cjs/metadata.d.ts +2 -26
  10. package/dist/cjs/metadata.js +3 -73
  11. package/dist/cjs/open-checkout.d.cts +0 -21
  12. package/dist/cjs/open-checkout.d.ts +0 -21
  13. package/dist/cjs/open-checkout.js +38 -310
  14. package/dist/cjs/sync-checkout-cart.d.cts +3 -3
  15. package/dist/cjs/sync-checkout-cart.d.ts +3 -3
  16. package/dist/cjs/sync-checkout-cart.js +22 -92
  17. package/dist/cjs/types.d.cts +0 -199
  18. package/dist/cjs/types.d.ts +0 -199
  19. package/dist/cjs/version.d.cts +1 -1
  20. package/dist/cjs/version.d.ts +1 -1
  21. package/dist/cjs/version.js +1 -1
  22. package/dist/esm/errors.d.ts +1 -68
  23. package/dist/esm/errors.js +0 -80
  24. package/dist/esm/index.d.ts +4 -10
  25. package/dist/esm/index.js +2 -7
  26. package/dist/esm/metadata.d.ts +2 -26
  27. package/dist/esm/metadata.js +2 -69
  28. package/dist/esm/open-checkout.d.ts +0 -21
  29. package/dist/esm/open-checkout.js +40 -312
  30. package/dist/esm/sync-checkout-cart.d.ts +3 -3
  31. package/dist/esm/sync-checkout-cart.js +23 -93
  32. package/dist/esm/types.d.ts +0 -199
  33. package/dist/esm/version.d.ts +1 -1
  34. package/dist/esm/version.js +1 -1
  35. package/package.json +3 -3
  36. package/dist/cjs/acquisition.d.cts +0 -189
  37. package/dist/cjs/acquisition.d.ts +0 -189
  38. package/dist/cjs/acquisition.js +0 -789
  39. package/dist/cjs/compatibility.d.cts +0 -66
  40. package/dist/cjs/compatibility.d.ts +0 -66
  41. package/dist/cjs/compatibility.js +0 -174
  42. package/dist/cjs/open-payment-intent.d.cts +0 -35
  43. package/dist/cjs/open-payment-intent.d.ts +0 -35
  44. package/dist/cjs/open-payment-intent.js +0 -157
  45. package/dist/cjs/open-setup-intent.d.cts +0 -49
  46. package/dist/cjs/open-setup-intent.d.ts +0 -49
  47. package/dist/cjs/open-setup-intent.js +0 -157
  48. package/dist/cjs/open-subscription.d.cts +0 -75
  49. package/dist/cjs/open-subscription.d.ts +0 -75
  50. package/dist/cjs/open-subscription.js +0 -307
  51. package/dist/cjs/subscription-params.d.cts +0 -33
  52. package/dist/cjs/subscription-params.d.ts +0 -33
  53. package/dist/cjs/subscription-params.js +0 -237
  54. package/dist/esm/acquisition.d.ts +0 -189
  55. package/dist/esm/acquisition.js +0 -763
  56. package/dist/esm/compatibility.d.ts +0 -66
  57. package/dist/esm/compatibility.js +0 -168
  58. package/dist/esm/open-payment-intent.d.ts +0 -35
  59. package/dist/esm/open-payment-intent.js +0 -154
  60. package/dist/esm/open-setup-intent.d.ts +0 -49
  61. package/dist/esm/open-setup-intent.js +0 -153
  62. package/dist/esm/open-subscription.d.ts +0 -75
  63. package/dist/esm/open-subscription.js +0 -304
  64. package/dist/esm/subscription-params.d.ts +0 -33
  65. package/dist/esm/subscription-params.js +0 -232
package/README.md CHANGED
@@ -5,21 +5,10 @@ Server-side Stripe adapter for Proxy Checkout. It owns the Stripe-specific integ
5
5
  - **`requiredMetadata(proxySession)`** — the `proxy_session_id` metadata Proxy needs on the Checkout Session, Subscription, and PaymentIntent.
6
6
  - **`assertCheckoutSessionBelongsToProxy` / `assertSubscriptionBelongsToProxy` / `assertPaymentIntentBelongsToProxy`** — provider-object ownership checks.
7
7
  - **`openCheckout(...)`** — records payer-opened, validates/reconciles the typed shared cart, injects required metadata, creates or joins the Stripe Checkout Session with deterministic idempotency, and records the Proxy provider binding. Once reconciliation succeeds, the shared cart is retained across later Stripe failures so every viewer can retry the same deterministic create safely. It returns provider-create material only for a `ready` outcome; terminal outcomes retain the shared cart without starting Stripe.
8
- - **`openSetupIntent(...)`** — reserves or joins one direct-Subscription acquisition, injects the complete acquisition metadata contract, and creates/retrieves one shared SetupIntent using Proxy's server-generated role key. SetupIntent status is presentation progress only: this helper never grants access or claims payment.
9
- - **`openSubscription(...)`** — creates or joins one direct Stripe Subscription through either an attached succeeded SetupIntent or an explicitly authorized saved PaymentMethod. It verifies Customer/PaymentMethod coherence in the merchant process, validates fixed recurring Prices, rejects unsupported collection/pricing/Connect options, sets only the Subscription default PaymentMethod, and returns old/current initial-Invoice authentication material without claiming payment.
10
- - **`syncCheckoutCart(...)`** — preserves the deployed mutable/custom-Checkout compatibility contract. It fails before Stripe or Proxy mutation for hosted acquisitions because Stripe does not support hosted Session line-item updates.
8
+ - **`syncCheckoutCart(...)`** — validates the stored Proxy provider binding, then updates the Proxy cart and the Stripe Checkout `line_items` in the safest order with deterministic rollback/reconciliation (`ProxyStripeCartSyncError`).
11
9
 
12
10
  PSP-agnostic primitives (sessions, subscriptions, webhooks, lifecycle) live in [`@proxy-checkout/server-js`](https://www.npmjs.com/package/@proxy-checkout/server-js). This package is an additive adapter on top and is dependency-free: you inject your own `Stripe` instance and your `@proxy-checkout/server-js` client.
13
11
 
14
- For the explicit one-time Checkout acquisition contract, select semantic
15
- `uiMode: "hosted"`, `"embedded"`, or `"custom"`. Hosted omits provider `ui_mode`,
16
- uses `success_url`, and returns `{ kind: "redirect", url }`. Embedded/custom send
17
- their generation-specific provider UI mode, use `return_url`, and return
18
- `{ kind: "client_secret", clientSecret, uiMode }`. The helper normalizes current
19
- `hosted_page`, `embedded_page`, and `elements` aliases only to their matching
20
- semantic path. URL/client-secret/UI mismatches fail before payer rendering and
21
- never fall back to hosted.
22
-
23
12
  ## Install
24
13
 
25
14
  ```bash
@@ -31,129 +20,42 @@ npm install --save-exact @proxy-checkout/stripe-server-js @proxy-checkout/server
31
20
  ```ts
32
21
  import Stripe from "stripe";
33
22
  import { createProxyCheckoutServerClient } from "@proxy-checkout/server-js";
34
- import {
35
- openCheckout,
36
- openSetupIntent,
37
- openSubscription,
38
- syncCheckoutCart,
39
- } from "@proxy-checkout/stripe-server-js";
23
+ import { openCheckout, syncCheckoutCart } from "@proxy-checkout/stripe-server-js";
40
24
 
41
25
  const proxy = createProxyCheckoutServerClient({ apiKey: process.env.PROXY_SECRET_KEY! });
42
- const stripe = new Stripe(process.env.STRIPE_SECRET_KEY!, { apiVersion: "2022-11-15" });
26
+ const stripe = new Stripe(process.env.STRIPE_SECRET_KEY!, { apiVersion: "2025-12-15.clover" });
43
27
 
44
28
  // Create the merchant-owned Stripe checkout, correctly linked to the Proxy session.
45
29
  const checkout = await openCheckout({
46
- commercialMode: "one_time",
47
- compatibility: { apiVersion: "2022-11-15", serverSdkVersion: "12.18.0" },
48
- pricingMode: "fixed",
49
30
  proxy,
50
31
  stripe,
51
32
  proxySessionId,
52
- uiMode: "hosted",
53
33
  cartSchema, // a zod-style schema, or any (value) => Cart validator
54
34
  validateCart: ({ cart }) => buildMerchantOffer(cart),
55
35
  buildCheckoutSessionParams: ({ cart, offer }) => ({
56
- line_items: buildMerchantStripeLineItems(cart, offer),
57
- mode: "payment",
58
- success_url: `${appOrigin}/pay/complete?proxy_session_id=${encodeURIComponent(proxySessionId)}`,
59
- cancel_url: `${appOrigin}/pay?proxy_session_id=${encodeURIComponent(proxySessionId)}`,
36
+ ...buildMerchantStripeParams(cart, offer),
37
+ mode: "subscription",
38
+ ui_mode: "custom",
60
39
  }),
61
40
  });
62
41
  if (checkout.outcome === "ready") {
63
- if (checkout.presentation?.kind !== "redirect") throw new Error("Expected hosted redirect");
64
- // Redirect the browser to checkout.presentation.url.
65
-
66
- } else {
67
- // Render checkout.cart plus checkout.outcome/sessionStatus. Render already_paid
68
- // as an explicit completed state and do not start Stripe.
69
- }
70
- ```
71
-
72
- Hosted cart edits replace rather than mutate the Session: expire the merchant-owned
73
- Stripe Session, wait until Proxy observes provider-confirmed `expired`, write the
74
- next Proxy cart with its expected cart version, supersede that terminal acquisition,
75
- and call `openCheckout(...)` again. Use
76
- `fingerprintHostedCheckoutProviderOptions(nextParams)` for the supersession's
77
- `providerOptionsFingerprint`; `openCheckout` uses the same canonical function.
78
- `syncCheckoutCart` raises `hosted_replacement_required` before any provider read or
79
- write when it resolves an explicit hosted acquisition.
42
+ // checkout.clientSecret -> render Stripe Elements
80
43
 
81
- The merchant Stripe create/edit credential in this example stays in the
82
- merchant backend and is never sent to or stored by Proxy. Proxy stores only a
83
- separate read-only restricted key for provider reconciliation. Browser callers
84
- send only the Proxy session id; they never send either Stripe credential or a
85
- server-only merchandise subtotal.
86
-
87
- ## Direct SetupIntent subscription
88
-
89
- Build the SetupIntent and eventual Subscription params from the same immutable
90
- Proxy cart. The shared acquisition fingerprint covers both builders, so every
91
- authorized viewer joins the same SetupIntent and Subscription role keys.
92
-
93
- ```ts
94
- const buildSetupIntentParams = () => ({
95
- payment_method_types: ["card"],
96
- usage: "off_session",
97
- });
98
- const buildSubscriptionParams = ({ cart }: { cart: Cart }) => ({
99
- items: cart.items.map((item) => ({ price: item.stripePriceId, quantity: item.quantity })),
100
- });
101
-
102
- const setup = await openSetupIntent({
103
- proxy,
104
- stripe,
105
- proxySessionId,
106
- cartSchema,
107
- customerId: sharedBillingCustomerId,
108
- initialInvoiceActionShape: "legacy_payment_intent", // Fiveable / API 2022-11-15
109
- buildSetupIntentParams,
110
- buildSubscriptionParams,
111
- });
112
-
113
- if (setup.outcome === "ready") {
114
- // Send only setup.clientSecret to the authorized browser and confirm there.
115
- // After Stripe reports the SetupIntent succeeded, call from the merchant server:
116
- const subscription = await openSubscription({
44
+ // Cart edits go through the binding-validated sync helper.
45
+ await syncCheckoutCart({
117
46
  proxy,
118
47
  stripe,
119
48
  proxySessionId,
49
+ checkoutSessionId: checkout.checkoutSession.id,
120
50
  cartSchema,
121
- initialInvoiceActionShape: "legacy_payment_intent",
122
- buildSubscriptionParams,
123
- fromSetupIntent: {
124
- acquisitionAttemptId: setup.acquisitionAttemptId,
125
- setupIntentId: setup.setupIntentId,
126
- buildSetupIntentParams,
127
- },
51
+ input: { interval: "year" },
52
+ buildNextCart: ({ currentCart, input }) => buildMerchantCart(currentCart, input),
53
+ buildStripeLineItems: (cart) => cart.lineItems,
128
54
  });
129
-
130
- if (
131
- subscription.outcome === "ready" &&
132
- subscription.initialInvoiceAction.kind === "client_secret"
133
- ) {
134
- // Confirm the returned initial-Invoice secret in the browser when required.
135
- }
136
- // Do not fulfill from this response. Handle Proxy's signed wakeup, resolve
137
- // current state, and apply fulfillment idempotently in the merchant system.
55
+ } else {
56
+ // Render checkout.cart plus checkout.outcome/sessionStatus. Do not start Stripe.
138
57
  }
139
58
  ```
140
59
 
141
- For Basil/current Invoice shapes, select
142
- `initialInvoiceActionShape: "confirmation_secret"`. The helper does not silently fall back across API
143
- generations.
144
-
145
- The `fromSavedPaymentMethod` branch requires explicit `customerId` and
146
- `paymentMethodId`. Use it only when that method belongs to an authorized shared
147
- billing account and is legitimately available to every payer for this purchase;
148
- never select one invited viewer's private saved method based on who opens first.
149
-
150
60
  Use the delegated-checkout guide from your Proxy onboarding materials for the
151
61
  full four-route integration recipe.
152
-
153
- Embedded's candidate floor is stripe-node `14.0.0` / API `2023-10-16` / Stripe.js
154
- `2.1.8` / React Stripe.js `2.3.2`. Custom's candidate floor is stripe-node
155
- `18.0.0` / API `2025-03-31.basil` / Stripe.js `7.0.0` / React Stripe.js `3.6.0`.
156
- Treat both as candidates until exact webhook, two-browser, preview, and
157
- production-deployed test-mode evidence passes. Fiveable's classic versions keep
158
- direct/hosted support and receive precise failing-boundary upgrade guidance for
159
- embedded/custom.
@@ -3,75 +3,8 @@
3
3
  * complete cleanly. The `reconciled` flag is true only when the SDK verified the
4
4
  * Proxy and Stripe carts are back in a consistent state.
5
5
  */
6
- export type ProxyStripeCartSyncCode = "hosted_replacement_required" | "reconciliation_failed" | "stripe_update_failed";
6
+ export type ProxyStripeCartSyncCode = "reconciliation_failed" | "stripe_update_failed";
7
7
  export type ProxyStripeOpenCheckoutCode = "provider_binding_failed";
8
- export type ProxyStripeAcquisitionCode = "acquisition_mismatch" | "customer_payment_method_mismatch" | "fixed_price_mismatch" | "provider_attachment_failed" | "provider_cart_confirmation_failed" | "provider_create_ambiguous" | "provider_response_invalid" | "provider_retrieve_failed" | "setup_intent_not_succeeded" | "unsupported_provider_option";
9
- /**
10
- * A provider root may already exist when this error is raised. The bounded
11
- * identifiers are intentionally retained so a merchant can retrieve the same
12
- * object or let Proxy's known-object recovery inspect it; no Stripe secret or
13
- * response body is captured.
14
- */
15
- export declare class ProxyStripeAcquisitionError extends Error {
16
- readonly name: string;
17
- readonly acquisitionAttemptId: string | null;
18
- readonly code: ProxyStripeAcquisitionCode;
19
- readonly cause: unknown;
20
- readonly field: string | undefined;
21
- readonly providerObjectId: string | null;
22
- readonly reconciled = false;
23
- constructor(message: string, details: {
24
- acquisitionAttemptId?: string;
25
- cause?: unknown;
26
- code: ProxyStripeAcquisitionCode;
27
- field?: string;
28
- providerObjectId?: string | null;
29
- });
30
- }
31
- export declare class ProxyMetadataConflictError extends ProxyStripeAcquisitionError {
32
- readonly name = "ProxyMetadataConflictError";
33
- constructor(field: string);
34
- }
35
- export type StripeCompatibilityPath = "one_time.checkout.custom" | "one_time.checkout.embedded" | "one_time.checkout.hosted" | "one_time.direct_payment_intent" | "subscription.direct_saved_payment_method" | "subscription.direct_setup_intent";
36
- export declare class StripeCompatibilityError extends Error {
37
- readonly name = "StripeCompatibilityError";
38
- readonly code = "stripe_version_not_supported";
39
- readonly detectedApiVersion: string | null;
40
- readonly detectedBrowserSdkVersion: string | null;
41
- readonly detectedReactSdkVersion: string | null;
42
- readonly detectedServerSdkVersion: string | null;
43
- readonly docsUrl: string;
44
- readonly minimumApiVersion: string;
45
- readonly minimumBrowserSdkVersion: string | null;
46
- readonly minimumReactSdkVersion: string | null;
47
- readonly minimumServerSdkVersion: string;
48
- readonly path: StripeCompatibilityPath;
49
- constructor(input: {
50
- detectedApiVersion?: string;
51
- detectedBrowserSdkVersion?: string;
52
- detectedReactSdkVersion?: string;
53
- detectedServerSdkVersion?: string;
54
- docsUrl: string;
55
- message: string;
56
- minimumApiVersion: string;
57
- minimumBrowserSdkVersion?: string;
58
- minimumReactSdkVersion?: string;
59
- minimumServerSdkVersion: string;
60
- path: StripeCompatibilityPath;
61
- });
62
- }
63
- export declare class StripeResponseShapeError extends Error {
64
- readonly name = "StripeResponseShapeError";
65
- readonly code = "stripe_response_shape_invalid";
66
- readonly field: string;
67
- constructor(message: string, field: string);
68
- }
69
- export declare class UnsupportedStripeOptionError extends Error {
70
- readonly name = "UnsupportedStripeOptionError";
71
- readonly code = "unsupported_stripe_option";
72
- readonly field: string;
73
- constructor(messageOrField: string, field?: string);
74
- }
75
8
  /**
76
9
  * Raised after Stripe Checkout creation succeeds but the Proxy binding cannot
77
10
  * be recorded or reconciled. The provider id is exposed so operators can find
@@ -3,75 +3,8 @@
3
3
  * complete cleanly. The `reconciled` flag is true only when the SDK verified the
4
4
  * Proxy and Stripe carts are back in a consistent state.
5
5
  */
6
- export type ProxyStripeCartSyncCode = "hosted_replacement_required" | "reconciliation_failed" | "stripe_update_failed";
6
+ export type ProxyStripeCartSyncCode = "reconciliation_failed" | "stripe_update_failed";
7
7
  export type ProxyStripeOpenCheckoutCode = "provider_binding_failed";
8
- export type ProxyStripeAcquisitionCode = "acquisition_mismatch" | "customer_payment_method_mismatch" | "fixed_price_mismatch" | "provider_attachment_failed" | "provider_cart_confirmation_failed" | "provider_create_ambiguous" | "provider_response_invalid" | "provider_retrieve_failed" | "setup_intent_not_succeeded" | "unsupported_provider_option";
9
- /**
10
- * A provider root may already exist when this error is raised. The bounded
11
- * identifiers are intentionally retained so a merchant can retrieve the same
12
- * object or let Proxy's known-object recovery inspect it; no Stripe secret or
13
- * response body is captured.
14
- */
15
- export declare class ProxyStripeAcquisitionError extends Error {
16
- readonly name: string;
17
- readonly acquisitionAttemptId: string | null;
18
- readonly code: ProxyStripeAcquisitionCode;
19
- readonly cause: unknown;
20
- readonly field: string | undefined;
21
- readonly providerObjectId: string | null;
22
- readonly reconciled = false;
23
- constructor(message: string, details: {
24
- acquisitionAttemptId?: string;
25
- cause?: unknown;
26
- code: ProxyStripeAcquisitionCode;
27
- field?: string;
28
- providerObjectId?: string | null;
29
- });
30
- }
31
- export declare class ProxyMetadataConflictError extends ProxyStripeAcquisitionError {
32
- readonly name = "ProxyMetadataConflictError";
33
- constructor(field: string);
34
- }
35
- export type StripeCompatibilityPath = "one_time.checkout.custom" | "one_time.checkout.embedded" | "one_time.checkout.hosted" | "one_time.direct_payment_intent" | "subscription.direct_saved_payment_method" | "subscription.direct_setup_intent";
36
- export declare class StripeCompatibilityError extends Error {
37
- readonly name = "StripeCompatibilityError";
38
- readonly code = "stripe_version_not_supported";
39
- readonly detectedApiVersion: string | null;
40
- readonly detectedBrowserSdkVersion: string | null;
41
- readonly detectedReactSdkVersion: string | null;
42
- readonly detectedServerSdkVersion: string | null;
43
- readonly docsUrl: string;
44
- readonly minimumApiVersion: string;
45
- readonly minimumBrowserSdkVersion: string | null;
46
- readonly minimumReactSdkVersion: string | null;
47
- readonly minimumServerSdkVersion: string;
48
- readonly path: StripeCompatibilityPath;
49
- constructor(input: {
50
- detectedApiVersion?: string;
51
- detectedBrowserSdkVersion?: string;
52
- detectedReactSdkVersion?: string;
53
- detectedServerSdkVersion?: string;
54
- docsUrl: string;
55
- message: string;
56
- minimumApiVersion: string;
57
- minimumBrowserSdkVersion?: string;
58
- minimumReactSdkVersion?: string;
59
- minimumServerSdkVersion: string;
60
- path: StripeCompatibilityPath;
61
- });
62
- }
63
- export declare class StripeResponseShapeError extends Error {
64
- readonly name = "StripeResponseShapeError";
65
- readonly code = "stripe_response_shape_invalid";
66
- readonly field: string;
67
- constructor(message: string, field: string);
68
- }
69
- export declare class UnsupportedStripeOptionError extends Error {
70
- readonly name = "UnsupportedStripeOptionError";
71
- readonly code = "unsupported_stripe_option";
72
- readonly field: string;
73
- constructor(messageOrField: string, field?: string);
74
- }
75
8
  /**
76
9
  * Raised after Stripe Checkout creation succeeds but the Proxy binding cannot
77
10
  * be recorded or reconciled. The provider id is exposed so operators can find
@@ -1,91 +1,6 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.ProxyStripeCartSyncError = exports.ProxyStripeOpenCheckoutError = exports.UnsupportedStripeOptionError = exports.StripeResponseShapeError = exports.StripeCompatibilityError = exports.ProxyMetadataConflictError = exports.ProxyStripeAcquisitionError = void 0;
4
- /**
5
- * A provider root may already exist when this error is raised. The bounded
6
- * identifiers are intentionally retained so a merchant can retrieve the same
7
- * object or let Proxy's known-object recovery inspect it; no Stripe secret or
8
- * response body is captured.
9
- */
10
- class ProxyStripeAcquisitionError extends Error {
11
- name = "ProxyStripeAcquisitionError";
12
- acquisitionAttemptId;
13
- code;
14
- cause;
15
- field;
16
- providerObjectId;
17
- reconciled = false;
18
- constructor(message, details) {
19
- super(message);
20
- this.acquisitionAttemptId = details.acquisitionAttemptId ?? null;
21
- this.cause = details.cause;
22
- this.code = details.code;
23
- this.field = details.field;
24
- this.providerObjectId = details.providerObjectId ?? null;
25
- }
26
- }
27
- exports.ProxyStripeAcquisitionError = ProxyStripeAcquisitionError;
28
- class ProxyMetadataConflictError extends ProxyStripeAcquisitionError {
29
- name = "ProxyMetadataConflictError";
30
- constructor(field) {
31
- super(`Stripe ${field} conflicts with Proxy-required acquisition metadata.`, {
32
- code: "acquisition_mismatch",
33
- field,
34
- });
35
- }
36
- }
37
- exports.ProxyMetadataConflictError = ProxyMetadataConflictError;
38
- class StripeCompatibilityError extends Error {
39
- name = "StripeCompatibilityError";
40
- code = "stripe_version_not_supported";
41
- detectedApiVersion;
42
- detectedBrowserSdkVersion;
43
- detectedReactSdkVersion;
44
- detectedServerSdkVersion;
45
- docsUrl;
46
- minimumApiVersion;
47
- minimumBrowserSdkVersion;
48
- minimumReactSdkVersion;
49
- minimumServerSdkVersion;
50
- path;
51
- constructor(input) {
52
- super(input.message);
53
- this.detectedApiVersion = input.detectedApiVersion ?? null;
54
- this.detectedBrowserSdkVersion = input.detectedBrowserSdkVersion ?? null;
55
- this.detectedReactSdkVersion = input.detectedReactSdkVersion ?? null;
56
- this.detectedServerSdkVersion = input.detectedServerSdkVersion ?? null;
57
- this.docsUrl = input.docsUrl;
58
- this.minimumApiVersion = input.minimumApiVersion;
59
- this.minimumBrowserSdkVersion = input.minimumBrowserSdkVersion ?? null;
60
- this.minimumReactSdkVersion = input.minimumReactSdkVersion ?? null;
61
- this.minimumServerSdkVersion = input.minimumServerSdkVersion;
62
- this.path = input.path;
63
- }
64
- }
65
- exports.StripeCompatibilityError = StripeCompatibilityError;
66
- class StripeResponseShapeError extends Error {
67
- name = "StripeResponseShapeError";
68
- code = "stripe_response_shape_invalid";
69
- field;
70
- constructor(message, field) {
71
- super(message);
72
- this.field = field;
73
- }
74
- }
75
- exports.StripeResponseShapeError = StripeResponseShapeError;
76
- class UnsupportedStripeOptionError extends Error {
77
- name = "UnsupportedStripeOptionError";
78
- code = "unsupported_stripe_option";
79
- field;
80
- constructor(messageOrField, field) {
81
- const resolvedField = field ?? messageOrField;
82
- super(field === undefined
83
- ? `Stripe option ${resolvedField} is not supported for direct subscriptions.`
84
- : messageOrField);
85
- this.field = resolvedField;
86
- }
87
- }
88
- exports.UnsupportedStripeOptionError = UnsupportedStripeOptionError;
3
+ exports.ProxyStripeCartSyncError = exports.ProxyStripeOpenCheckoutError = void 0;
89
4
  /**
90
5
  * Raised after Stripe Checkout creation succeeds but the Proxy binding cannot
91
6
  * be recorded or reconciled. The provider id is exposed so operators can find
@@ -1,13 +1,7 @@
1
- export { fingerprintHostedCheckoutProviderOptions } from "./acquisition.js";
2
- export { assertHostedNoCostCompatibility, assertStripePathCompatibility, compareStripeApiVersions, type StripeCompatibilityDescriptor, type StripeCompatibilityLane, stripeCompatibilityLanes, } from "./compatibility.js";
3
- export { ProxyMetadataConflictError, type ProxyStripeAcquisitionCode, ProxyStripeAcquisitionError, type ProxyStripeCartSyncCode, ProxyStripeCartSyncError, type ProxyStripeOpenCheckoutCode, ProxyStripeOpenCheckoutError, StripeCompatibilityError, type StripeCompatibilityPath, StripeResponseShapeError, UnsupportedStripeOptionError, } from "./errors.js";
4
- export { assertCheckoutSessionBelongsToProxy, assertCheckoutSessionMetadataPreflight, assertPaymentIntentBelongsToProxy, assertProviderObjectBelongsToAcquisition, assertSubscriptionBelongsToProxy, injectRequiredCheckoutSessionMetadata, injectRequiredPaymentIntentMetadata, PROXY_ACQUISITION_ATTEMPT_METADATA_KEY, PROXY_CONTRACT_VERSION_METADATA_KEY, PROXY_INTEGRATION_PATH_METADATA_KEY, PROXY_SESSION_METADATA_KEY, type ProxySessionMetadata, type ProxyStripeRequiredMetadata, requiredMetadata, } from "./metadata.js";
5
- export { type OpenCheckoutOptions, type OpenCheckoutPresentation, type OpenCheckoutReconciledCart, type OpenCheckoutResponse, type OpenCheckoutResult, type OpenCheckoutTerminalResult, openCheckout, } from "./open-checkout.js";
6
- export { type OpenPaymentIntentOptions, type OpenPaymentIntentResponse, openPaymentIntent, type ReadyPaymentIntentResult, type SafePaymentIntentStatus, } from "./open-payment-intent.js";
7
- export { type OpenSetupIntentBuilderInput, type OpenSetupIntentOptions, type OpenSetupIntentReadyResult, type OpenSetupIntentResponse, openSetupIntent, } from "./open-setup-intent.js";
8
- export { type InitialInvoiceAction, type LegacyInitialInvoiceLike, type OpenSubscriptionBuilderInput, type OpenSubscriptionOptions, type OpenSubscriptionReadyResult, type OpenSubscriptionResponse, openSubscription, } from "./open-subscription.js";
1
+ export { type ProxyStripeCartSyncCode, ProxyStripeCartSyncError, type ProxyStripeOpenCheckoutCode, ProxyStripeOpenCheckoutError, } from "./errors.js";
2
+ export { assertCheckoutSessionBelongsToProxy, assertPaymentIntentBelongsToProxy, assertSubscriptionBelongsToProxy, injectRequiredCheckoutSessionMetadata, PROXY_INTEGRATION_PATH_METADATA_KEY, PROXY_SESSION_METADATA_KEY, type ProxySessionMetadata, type ProxyStripeRequiredMetadata, requiredMetadata, } from "./metadata.js";
3
+ export { type OpenCheckoutOptions, type OpenCheckoutReconciledCart, type OpenCheckoutResponse, type OpenCheckoutResult, type OpenCheckoutTerminalResult, openCheckout, } from "./open-checkout.js";
9
4
  export { normalizePsp } from "./psp.js";
10
- export type { ValidatedSubscriptionItem, ValidateFixedSubscriptionPrice, ValidateFixedSubscriptionPriceInput, VerifiedSubscriptionPriceItem, } from "./subscription-params.js";
11
5
  export { type SyncCheckoutCartOptions, type SyncCheckoutCartResult, type SyncedCart, syncCheckoutCart, } from "./sync-checkout-cart.js";
12
- export type { StripeCheckoutSessionCreateParams, StripeCheckoutSessionLike, StripeCheckoutSessionsApiLike, StripeCheckoutSessionUpdateParams, StripeClientLike, StripeDirectSubscriptionClientLike, StripeInvoiceLike, StripeMetadata, StripeMutableCheckoutClientLike, StripeMutableCheckoutSessionsApiLike, StripeObjectReferenceLike, StripePaymentIntentClientLike, StripePaymentIntentCreateParams, StripePaymentIntentLike, StripePaymentIntentsApiLike, StripePaymentMethodLike, StripePriceLike, StripeRequestOptionsLike, StripeSetupIntentClientLike, StripeSetupIntentCreateParams, StripeSetupIntentLike, StripeSetupSubscriptionClientLike, StripeSubscriptionCreateParams, StripeSubscriptionItemCreateParamsLike, StripeSubscriptionLike, } from "./types.js";
6
+ export type { StripeCheckoutSessionCreateParams, StripeCheckoutSessionLike, StripeCheckoutSessionsApiLike, StripeCheckoutSessionUpdateParams, StripeClientLike, StripeMetadata, StripePaymentIntentLike, StripeRequestOptionsLike, StripeSubscriptionLike, } from "./types.js";
13
7
  export { proxyCheckoutStripeServerSdkName, proxyCheckoutStripeServerSdkVersion, } from "./version.js";
@@ -1,13 +1,7 @@
1
- export { fingerprintHostedCheckoutProviderOptions } from "./acquisition.js";
2
- export { assertHostedNoCostCompatibility, assertStripePathCompatibility, compareStripeApiVersions, type StripeCompatibilityDescriptor, type StripeCompatibilityLane, stripeCompatibilityLanes, } from "./compatibility.js";
3
- export { ProxyMetadataConflictError, type ProxyStripeAcquisitionCode, ProxyStripeAcquisitionError, type ProxyStripeCartSyncCode, ProxyStripeCartSyncError, type ProxyStripeOpenCheckoutCode, ProxyStripeOpenCheckoutError, StripeCompatibilityError, type StripeCompatibilityPath, StripeResponseShapeError, UnsupportedStripeOptionError, } from "./errors.js";
4
- export { assertCheckoutSessionBelongsToProxy, assertCheckoutSessionMetadataPreflight, assertPaymentIntentBelongsToProxy, assertProviderObjectBelongsToAcquisition, assertSubscriptionBelongsToProxy, injectRequiredCheckoutSessionMetadata, injectRequiredPaymentIntentMetadata, PROXY_ACQUISITION_ATTEMPT_METADATA_KEY, PROXY_CONTRACT_VERSION_METADATA_KEY, PROXY_INTEGRATION_PATH_METADATA_KEY, PROXY_SESSION_METADATA_KEY, type ProxySessionMetadata, type ProxyStripeRequiredMetadata, requiredMetadata, } from "./metadata.js";
5
- export { type OpenCheckoutOptions, type OpenCheckoutPresentation, type OpenCheckoutReconciledCart, type OpenCheckoutResponse, type OpenCheckoutResult, type OpenCheckoutTerminalResult, openCheckout, } from "./open-checkout.js";
6
- export { type OpenPaymentIntentOptions, type OpenPaymentIntentResponse, openPaymentIntent, type ReadyPaymentIntentResult, type SafePaymentIntentStatus, } from "./open-payment-intent.js";
7
- export { type OpenSetupIntentBuilderInput, type OpenSetupIntentOptions, type OpenSetupIntentReadyResult, type OpenSetupIntentResponse, openSetupIntent, } from "./open-setup-intent.js";
8
- export { type InitialInvoiceAction, type LegacyInitialInvoiceLike, type OpenSubscriptionBuilderInput, type OpenSubscriptionOptions, type OpenSubscriptionReadyResult, type OpenSubscriptionResponse, openSubscription, } from "./open-subscription.js";
1
+ export { type ProxyStripeCartSyncCode, ProxyStripeCartSyncError, type ProxyStripeOpenCheckoutCode, ProxyStripeOpenCheckoutError, } from "./errors.js";
2
+ export { assertCheckoutSessionBelongsToProxy, assertPaymentIntentBelongsToProxy, assertSubscriptionBelongsToProxy, injectRequiredCheckoutSessionMetadata, PROXY_INTEGRATION_PATH_METADATA_KEY, PROXY_SESSION_METADATA_KEY, type ProxySessionMetadata, type ProxyStripeRequiredMetadata, requiredMetadata, } from "./metadata.js";
3
+ export { type OpenCheckoutOptions, type OpenCheckoutReconciledCart, type OpenCheckoutResponse, type OpenCheckoutResult, type OpenCheckoutTerminalResult, openCheckout, } from "./open-checkout.js";
9
4
  export { normalizePsp } from "./psp.js";
10
- export type { ValidatedSubscriptionItem, ValidateFixedSubscriptionPrice, ValidateFixedSubscriptionPriceInput, VerifiedSubscriptionPriceItem, } from "./subscription-params.js";
11
5
  export { type SyncCheckoutCartOptions, type SyncCheckoutCartResult, type SyncedCart, syncCheckoutCart, } from "./sync-checkout-cart.js";
12
- export type { StripeCheckoutSessionCreateParams, StripeCheckoutSessionLike, StripeCheckoutSessionsApiLike, StripeCheckoutSessionUpdateParams, StripeClientLike, StripeDirectSubscriptionClientLike, StripeInvoiceLike, StripeMetadata, StripeMutableCheckoutClientLike, StripeMutableCheckoutSessionsApiLike, StripeObjectReferenceLike, StripePaymentIntentClientLike, StripePaymentIntentCreateParams, StripePaymentIntentLike, StripePaymentIntentsApiLike, StripePaymentMethodLike, StripePriceLike, StripeRequestOptionsLike, StripeSetupIntentClientLike, StripeSetupIntentCreateParams, StripeSetupIntentLike, StripeSetupSubscriptionClientLike, StripeSubscriptionCreateParams, StripeSubscriptionItemCreateParamsLike, StripeSubscriptionLike, } from "./types.js";
6
+ export type { StripeCheckoutSessionCreateParams, StripeCheckoutSessionLike, StripeCheckoutSessionsApiLike, StripeCheckoutSessionUpdateParams, StripeClientLike, StripeMetadata, StripePaymentIntentLike, StripeRequestOptionsLike, StripeSubscriptionLike, } from "./types.js";
13
7
  export { proxyCheckoutStripeServerSdkName, proxyCheckoutStripeServerSdkVersion, } from "./version.js";
package/dist/cjs/index.js CHANGED
@@ -1,42 +1,19 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.proxyCheckoutStripeServerSdkVersion = exports.proxyCheckoutStripeServerSdkName = exports.syncCheckoutCart = exports.normalizePsp = exports.openSubscription = exports.openSetupIntent = exports.openPaymentIntent = exports.openCheckout = exports.requiredMetadata = exports.PROXY_SESSION_METADATA_KEY = exports.PROXY_INTEGRATION_PATH_METADATA_KEY = exports.PROXY_CONTRACT_VERSION_METADATA_KEY = exports.PROXY_ACQUISITION_ATTEMPT_METADATA_KEY = exports.injectRequiredPaymentIntentMetadata = exports.injectRequiredCheckoutSessionMetadata = exports.assertSubscriptionBelongsToProxy = exports.assertProviderObjectBelongsToAcquisition = exports.assertPaymentIntentBelongsToProxy = exports.assertCheckoutSessionMetadataPreflight = exports.assertCheckoutSessionBelongsToProxy = exports.UnsupportedStripeOptionError = exports.StripeResponseShapeError = exports.StripeCompatibilityError = exports.ProxyStripeOpenCheckoutError = exports.ProxyStripeCartSyncError = exports.ProxyStripeAcquisitionError = exports.ProxyMetadataConflictError = exports.stripeCompatibilityLanes = exports.compareStripeApiVersions = exports.assertStripePathCompatibility = exports.assertHostedNoCostCompatibility = exports.fingerprintHostedCheckoutProviderOptions = void 0;
4
- var acquisition_js_1 = require("./acquisition.js");
5
- Object.defineProperty(exports, "fingerprintHostedCheckoutProviderOptions", { enumerable: true, get: function () { return acquisition_js_1.fingerprintHostedCheckoutProviderOptions; } });
6
- var compatibility_js_1 = require("./compatibility.js");
7
- Object.defineProperty(exports, "assertHostedNoCostCompatibility", { enumerable: true, get: function () { return compatibility_js_1.assertHostedNoCostCompatibility; } });
8
- Object.defineProperty(exports, "assertStripePathCompatibility", { enumerable: true, get: function () { return compatibility_js_1.assertStripePathCompatibility; } });
9
- Object.defineProperty(exports, "compareStripeApiVersions", { enumerable: true, get: function () { return compatibility_js_1.compareStripeApiVersions; } });
10
- Object.defineProperty(exports, "stripeCompatibilityLanes", { enumerable: true, get: function () { return compatibility_js_1.stripeCompatibilityLanes; } });
3
+ exports.proxyCheckoutStripeServerSdkVersion = exports.proxyCheckoutStripeServerSdkName = exports.syncCheckoutCart = exports.normalizePsp = exports.openCheckout = exports.requiredMetadata = exports.PROXY_SESSION_METADATA_KEY = exports.PROXY_INTEGRATION_PATH_METADATA_KEY = exports.injectRequiredCheckoutSessionMetadata = exports.assertSubscriptionBelongsToProxy = exports.assertPaymentIntentBelongsToProxy = exports.assertCheckoutSessionBelongsToProxy = exports.ProxyStripeOpenCheckoutError = exports.ProxyStripeCartSyncError = void 0;
11
4
  var errors_js_1 = require("./errors.js");
12
- Object.defineProperty(exports, "ProxyMetadataConflictError", { enumerable: true, get: function () { return errors_js_1.ProxyMetadataConflictError; } });
13
- Object.defineProperty(exports, "ProxyStripeAcquisitionError", { enumerable: true, get: function () { return errors_js_1.ProxyStripeAcquisitionError; } });
14
5
  Object.defineProperty(exports, "ProxyStripeCartSyncError", { enumerable: true, get: function () { return errors_js_1.ProxyStripeCartSyncError; } });
15
6
  Object.defineProperty(exports, "ProxyStripeOpenCheckoutError", { enumerable: true, get: function () { return errors_js_1.ProxyStripeOpenCheckoutError; } });
16
- Object.defineProperty(exports, "StripeCompatibilityError", { enumerable: true, get: function () { return errors_js_1.StripeCompatibilityError; } });
17
- Object.defineProperty(exports, "StripeResponseShapeError", { enumerable: true, get: function () { return errors_js_1.StripeResponseShapeError; } });
18
- Object.defineProperty(exports, "UnsupportedStripeOptionError", { enumerable: true, get: function () { return errors_js_1.UnsupportedStripeOptionError; } });
19
7
  var metadata_js_1 = require("./metadata.js");
20
8
  Object.defineProperty(exports, "assertCheckoutSessionBelongsToProxy", { enumerable: true, get: function () { return metadata_js_1.assertCheckoutSessionBelongsToProxy; } });
21
- Object.defineProperty(exports, "assertCheckoutSessionMetadataPreflight", { enumerable: true, get: function () { return metadata_js_1.assertCheckoutSessionMetadataPreflight; } });
22
9
  Object.defineProperty(exports, "assertPaymentIntentBelongsToProxy", { enumerable: true, get: function () { return metadata_js_1.assertPaymentIntentBelongsToProxy; } });
23
- Object.defineProperty(exports, "assertProviderObjectBelongsToAcquisition", { enumerable: true, get: function () { return metadata_js_1.assertProviderObjectBelongsToAcquisition; } });
24
10
  Object.defineProperty(exports, "assertSubscriptionBelongsToProxy", { enumerable: true, get: function () { return metadata_js_1.assertSubscriptionBelongsToProxy; } });
25
11
  Object.defineProperty(exports, "injectRequiredCheckoutSessionMetadata", { enumerable: true, get: function () { return metadata_js_1.injectRequiredCheckoutSessionMetadata; } });
26
- Object.defineProperty(exports, "injectRequiredPaymentIntentMetadata", { enumerable: true, get: function () { return metadata_js_1.injectRequiredPaymentIntentMetadata; } });
27
- Object.defineProperty(exports, "PROXY_ACQUISITION_ATTEMPT_METADATA_KEY", { enumerable: true, get: function () { return metadata_js_1.PROXY_ACQUISITION_ATTEMPT_METADATA_KEY; } });
28
- Object.defineProperty(exports, "PROXY_CONTRACT_VERSION_METADATA_KEY", { enumerable: true, get: function () { return metadata_js_1.PROXY_CONTRACT_VERSION_METADATA_KEY; } });
29
12
  Object.defineProperty(exports, "PROXY_INTEGRATION_PATH_METADATA_KEY", { enumerable: true, get: function () { return metadata_js_1.PROXY_INTEGRATION_PATH_METADATA_KEY; } });
30
13
  Object.defineProperty(exports, "PROXY_SESSION_METADATA_KEY", { enumerable: true, get: function () { return metadata_js_1.PROXY_SESSION_METADATA_KEY; } });
31
14
  Object.defineProperty(exports, "requiredMetadata", { enumerable: true, get: function () { return metadata_js_1.requiredMetadata; } });
32
15
  var open_checkout_js_1 = require("./open-checkout.js");
33
16
  Object.defineProperty(exports, "openCheckout", { enumerable: true, get: function () { return open_checkout_js_1.openCheckout; } });
34
- var open_payment_intent_js_1 = require("./open-payment-intent.js");
35
- Object.defineProperty(exports, "openPaymentIntent", { enumerable: true, get: function () { return open_payment_intent_js_1.openPaymentIntent; } });
36
- var open_setup_intent_js_1 = require("./open-setup-intent.js");
37
- Object.defineProperty(exports, "openSetupIntent", { enumerable: true, get: function () { return open_setup_intent_js_1.openSetupIntent; } });
38
- var open_subscription_js_1 = require("./open-subscription.js");
39
- Object.defineProperty(exports, "openSubscription", { enumerable: true, get: function () { return open_subscription_js_1.openSubscription; } });
40
17
  var psp_js_1 = require("./psp.js");
41
18
  Object.defineProperty(exports, "normalizePsp", { enumerable: true, get: function () { return psp_js_1.normalizePsp; } });
42
19
  var sync_checkout_cart_js_1 = require("./sync-checkout-cart.js");
@@ -6,13 +6,11 @@
6
6
  * customers never have to remember which Stripe objects need the key, and
7
7
  * provides assertions that a Stripe object actually belongs to a Proxy session.
8
8
  */
9
- import type { StripeCheckoutSessionCreateParams, StripeCheckoutSessionLike, StripeMetadata, StripePaymentIntentCreateParams, StripePaymentIntentLike, StripeSubscriptionLike } from "./types.js";
9
+ import type { StripeCheckoutSessionCreateParams, StripeCheckoutSessionLike, StripePaymentIntentLike, StripeSubscriptionLike } from "./types.js";
10
10
  /** The single metadata key Proxy reads to correlate a Stripe object to a session. */
11
11
  export declare const PROXY_SESSION_METADATA_KEY = "proxy_session_id";
12
12
  /** Server-owned marker that distinguishes Checkout-created child objects from direct objects. */
13
13
  export declare const PROXY_INTEGRATION_PATH_METADATA_KEY = "proxy_integration_path";
14
- export declare const PROXY_ACQUISITION_ATTEMPT_METADATA_KEY = "proxy_acquisition_attempt_id";
15
- export declare const PROXY_CONTRACT_VERSION_METADATA_KEY = "proxy_contract_version";
16
14
  export type ProxySessionMetadata = Readonly<Record<"proxy_session_id", string>>;
17
15
  /**
18
16
  * The metadata each Stripe object must carry, ready to spread into Stripe params.
@@ -41,32 +39,10 @@ export declare function requiredMetadata(proxySession: {
41
39
  * every object Proxy may later need to correlate. Conflicting merchant-provided
42
40
  * proxy metadata fails before any Stripe side effect.
43
41
  */
44
- export declare function injectRequiredCheckoutSessionMetadata(params: StripeCheckoutSessionCreateParams, proxySessionId: string, acquisition?: {
45
- id: string;
46
- contractVersion: "2";
47
- }): StripeCheckoutSessionCreateParams;
48
- /**
49
- * Validate merchant-authored Checkout metadata before reserving an acquisition.
50
- * The acquisition ID does not exist yet, so those reservation-owned keys must
51
- * be absent until the shared create owner injects their exact values.
52
- */
53
- export declare function assertCheckoutSessionMetadataPreflight(params: StripeCheckoutSessionCreateParams, proxySessionId: string): void;
54
- /** Inject the server-owned acquisition identity into a direct PaymentIntent. */
55
- export declare function injectRequiredPaymentIntentMetadata(params: StripePaymentIntentCreateParams, input: {
56
- acquisitionAttemptId: string;
57
- proxySessionId: string;
58
- }): StripePaymentIntentCreateParams;
42
+ export declare function injectRequiredCheckoutSessionMetadata(params: StripeCheckoutSessionCreateParams, proxySessionId: string): StripeCheckoutSessionCreateParams;
59
43
  /** Assert a Stripe Checkout Session carries the expected `proxy_session_id` metadata. */
60
44
  export declare function assertCheckoutSessionBelongsToProxy(checkoutSession: Pick<StripeCheckoutSessionLike, "metadata">, proxySessionId: string): void;
61
45
  /** Assert a Stripe Subscription carries the expected `proxy_session_id` metadata. */
62
46
  export declare function assertSubscriptionBelongsToProxy(subscription: Pick<StripeSubscriptionLike, "metadata">, proxySessionId: string): void;
63
47
  /** Assert a Stripe PaymentIntent carries the expected `proxy_session_id` metadata. */
64
48
  export declare function assertPaymentIntentBelongsToProxy(paymentIntent: Pick<StripePaymentIntentLike, "metadata">, proxySessionId: string): void;
65
- /** Assert the provider root carries the exact reserved acquisition identity. */
66
- export declare function assertProviderObjectBelongsToAcquisition(object: {
67
- readonly metadata?: StripeMetadata;
68
- }, input: {
69
- acquisitionAttemptId: string;
70
- integrationPath: string;
71
- proxySessionId: string;
72
- }): void;
@@ -6,13 +6,11 @@
6
6
  * customers never have to remember which Stripe objects need the key, and
7
7
  * provides assertions that a Stripe object actually belongs to a Proxy session.
8
8
  */
9
- import type { StripeCheckoutSessionCreateParams, StripeCheckoutSessionLike, StripeMetadata, StripePaymentIntentCreateParams, StripePaymentIntentLike, StripeSubscriptionLike } from "./types.js";
9
+ import type { StripeCheckoutSessionCreateParams, StripeCheckoutSessionLike, StripePaymentIntentLike, StripeSubscriptionLike } from "./types.js";
10
10
  /** The single metadata key Proxy reads to correlate a Stripe object to a session. */
11
11
  export declare const PROXY_SESSION_METADATA_KEY = "proxy_session_id";
12
12
  /** Server-owned marker that distinguishes Checkout-created child objects from direct objects. */
13
13
  export declare const PROXY_INTEGRATION_PATH_METADATA_KEY = "proxy_integration_path";
14
- export declare const PROXY_ACQUISITION_ATTEMPT_METADATA_KEY = "proxy_acquisition_attempt_id";
15
- export declare const PROXY_CONTRACT_VERSION_METADATA_KEY = "proxy_contract_version";
16
14
  export type ProxySessionMetadata = Readonly<Record<"proxy_session_id", string>>;
17
15
  /**
18
16
  * The metadata each Stripe object must carry, ready to spread into Stripe params.
@@ -41,32 +39,10 @@ export declare function requiredMetadata(proxySession: {
41
39
  * every object Proxy may later need to correlate. Conflicting merchant-provided
42
40
  * proxy metadata fails before any Stripe side effect.
43
41
  */
44
- export declare function injectRequiredCheckoutSessionMetadata(params: StripeCheckoutSessionCreateParams, proxySessionId: string, acquisition?: {
45
- id: string;
46
- contractVersion: "2";
47
- }): StripeCheckoutSessionCreateParams;
48
- /**
49
- * Validate merchant-authored Checkout metadata before reserving an acquisition.
50
- * The acquisition ID does not exist yet, so those reservation-owned keys must
51
- * be absent until the shared create owner injects their exact values.
52
- */
53
- export declare function assertCheckoutSessionMetadataPreflight(params: StripeCheckoutSessionCreateParams, proxySessionId: string): void;
54
- /** Inject the server-owned acquisition identity into a direct PaymentIntent. */
55
- export declare function injectRequiredPaymentIntentMetadata(params: StripePaymentIntentCreateParams, input: {
56
- acquisitionAttemptId: string;
57
- proxySessionId: string;
58
- }): StripePaymentIntentCreateParams;
42
+ export declare function injectRequiredCheckoutSessionMetadata(params: StripeCheckoutSessionCreateParams, proxySessionId: string): StripeCheckoutSessionCreateParams;
59
43
  /** Assert a Stripe Checkout Session carries the expected `proxy_session_id` metadata. */
60
44
  export declare function assertCheckoutSessionBelongsToProxy(checkoutSession: Pick<StripeCheckoutSessionLike, "metadata">, proxySessionId: string): void;
61
45
  /** Assert a Stripe Subscription carries the expected `proxy_session_id` metadata. */
62
46
  export declare function assertSubscriptionBelongsToProxy(subscription: Pick<StripeSubscriptionLike, "metadata">, proxySessionId: string): void;
63
47
  /** Assert a Stripe PaymentIntent carries the expected `proxy_session_id` metadata. */
64
48
  export declare function assertPaymentIntentBelongsToProxy(paymentIntent: Pick<StripePaymentIntentLike, "metadata">, proxySessionId: string): void;
65
- /** Assert the provider root carries the exact reserved acquisition identity. */
66
- export declare function assertProviderObjectBelongsToAcquisition(object: {
67
- readonly metadata?: StripeMetadata;
68
- }, input: {
69
- acquisitionAttemptId: string;
70
- integrationPath: string;
71
- proxySessionId: string;
72
- }): void;