@proxy-checkout/stripe-server-js 0.0.0-pr-76.17.1 → 0.0.0-pr-76.18.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/dist/index.d.ts CHANGED
@@ -1,6 +1,7 @@
1
1
  export { type ProxyStripeCartSyncCode, ProxyStripeCartSyncError, } from "./errors.js";
2
2
  export { assertCheckoutSessionBelongsToProxy, assertPaymentIntentBelongsToProxy, assertSubscriptionBelongsToProxy, PROXY_SESSION_METADATA_KEY, type ProxySessionMetadata, type ProxyStripeRequiredMetadata, requiredMetadata, } from "./metadata.js";
3
3
  export { type OpenCheckoutOptions, type OpenCheckoutResult, openCheckout, } from "./open-checkout.js";
4
+ export { normalizePsp } from "./psp.js";
4
5
  export { type SyncCheckoutCartOptions, type SyncCheckoutCartResult, type SyncedCart, syncCheckoutCart, } from "./sync-checkout-cart.js";
5
6
  export type { StripeCheckoutSessionLike, StripeCheckoutSessionsApiLike, StripeCheckoutSessionUpdateParams, StripeClientLike, StripeMetadata, StripePaymentIntentLike, StripeSubscriptionLike, } from "./types.js";
6
7
  export { proxyCheckoutStripeServerSdkName, proxyCheckoutStripeServerSdkVersion, } from "./version.js";
package/dist/index.js CHANGED
@@ -1,5 +1,6 @@
1
1
  export { ProxyStripeCartSyncError, } from "./errors.js";
2
2
  export { assertCheckoutSessionBelongsToProxy, assertPaymentIntentBelongsToProxy, assertSubscriptionBelongsToProxy, PROXY_SESSION_METADATA_KEY, requiredMetadata, } from "./metadata.js";
3
3
  export { openCheckout, } from "./open-checkout.js";
4
+ export { normalizePsp } from "./psp.js";
4
5
  export { syncCheckoutCart, } from "./sync-checkout-cart.js";
5
6
  export { proxyCheckoutStripeServerSdkName, proxyCheckoutStripeServerSdkVersion, } from "./version.js";
@@ -7,8 +7,12 @@
7
7
  * hard to create a Stripe checkout that is not correctly linked to a session.
8
8
  */
9
9
  import { assertCheckoutSessionBelongsToProxy, requiredMetadata } from "./metadata.js";
10
+ import { normalizePsp } from "./psp.js";
10
11
  export async function openCheckout(options) {
11
- const psp = options.psp ?? "stripe";
12
+ // Normalize the same way the API does on store, so the binding is recorded
13
+ // under the normalized psp and later syncCheckoutCart validations compare
14
+ // normalized-to-normalized.
15
+ const psp = normalizePsp(options.psp ?? "stripe");
12
16
  const proxySession = await options.proxy.sessions.payerOpened(options.proxySessionId, {
13
17
  requestId: options.requestId,
14
18
  });
package/dist/psp.d.ts ADDED
@@ -0,0 +1,12 @@
1
+ /**
2
+ * Provider (psp) identifier normalization, kept in lockstep with the Proxy API.
3
+ *
4
+ * The API normalizes the psp before persisting a provider binding
5
+ * (`psp.trim().toLowerCase()`), then compares stored bindings against that
6
+ * normalized value. The SDK must normalize identically before recording or
7
+ * validating a binding so a caller passing the same psp with different
8
+ * casing/whitespace for `openCheckout` vs `syncCheckoutCart` does not get a
9
+ * false `provider_binding_mismatch`.
10
+ */
11
+ /** Normalize a psp identifier exactly as the Proxy API does before storing/comparing a binding. */
12
+ export declare function normalizePsp(psp: string): string;
package/dist/psp.js ADDED
@@ -0,0 +1,14 @@
1
+ /**
2
+ * Provider (psp) identifier normalization, kept in lockstep with the Proxy API.
3
+ *
4
+ * The API normalizes the psp before persisting a provider binding
5
+ * (`psp.trim().toLowerCase()`), then compares stored bindings against that
6
+ * normalized value. The SDK must normalize identically before recording or
7
+ * validating a binding so a caller passing the same psp with different
8
+ * casing/whitespace for `openCheckout` vs `syncCheckoutCart` does not get a
9
+ * false `provider_binding_mismatch`.
10
+ */
11
+ /** Normalize a psp identifier exactly as the Proxy API does before storing/comparing a binding. */
12
+ export function normalizePsp(psp) {
13
+ return psp.trim().toLowerCase();
14
+ }
@@ -8,8 +8,12 @@
8
8
  import { ProxyCheckoutValidationError, } from "@proxy-checkout/server-js";
9
9
  import { ProxyStripeCartSyncError } from "./errors.js";
10
10
  import { assertCheckoutSessionBelongsToProxy } from "./metadata.js";
11
+ import { normalizePsp } from "./psp.js";
11
12
  export async function syncCheckoutCart(options) {
12
- const psp = options.psp ?? "stripe";
13
+ // Normalize the same way the API does on store, so the binding comparison is
14
+ // normalized-to-normalized and a custom psp with differing casing/whitespace
15
+ // does not produce a false provider_binding_mismatch.
16
+ const psp = normalizePsp(options.psp ?? "stripe");
13
17
  const session = await options.proxy.sessions.retrieve(options.proxySessionId, {
14
18
  requestId: options.requestId,
15
19
  });
package/dist/version.d.ts CHANGED
@@ -1,2 +1,2 @@
1
1
  export declare const proxyCheckoutStripeServerSdkName = "@proxy-checkout/stripe-server-js";
2
- export declare const proxyCheckoutStripeServerSdkVersion = "0.0.0-pr-76.17.1";
2
+ export declare const proxyCheckoutStripeServerSdkVersion = "0.0.0-pr-76.18.1";
package/dist/version.js CHANGED
@@ -1,2 +1,2 @@
1
1
  export const proxyCheckoutStripeServerSdkName = "@proxy-checkout/stripe-server-js";
2
- export const proxyCheckoutStripeServerSdkVersion = "0.0.0-pr-76.17.1";
2
+ export const proxyCheckoutStripeServerSdkVersion = "0.0.0-pr-76.18.1";
package/package.json CHANGED
@@ -7,13 +7,13 @@
7
7
  "sideEffects": false,
8
8
  "type": "module",
9
9
  "types": "./dist/index.d.ts",
10
- "version": "0.0.0-pr-76.17.1",
10
+ "version": "0.0.0-pr-76.18.1",
11
11
  "devDependencies": {
12
12
  "@types/node": "^24.12.4",
13
13
  "@vitest/coverage-v8": "4.1.7",
14
14
  "typescript": "^6.0.3",
15
15
  "vitest": "4.1.7",
16
- "@proxy-checkout/server-js": "0.0.4-pr-76.17.1"
16
+ "@proxy-checkout/server-js": "0.0.4-pr-76.18.1"
17
17
  },
18
18
  "exports": {
19
19
  ".": {
@@ -34,7 +34,7 @@
34
34
  "sdk"
35
35
  ],
36
36
  "peerDependencies": {
37
- "@proxy-checkout/server-js": "0.0.4"
37
+ "@proxy-checkout/server-js": ">=0.0.4-0 <0.1.0"
38
38
  },
39
39
  "publishConfig": {
40
40
  "access": "public"