@flopay/shared 1.2.0 → 1.2.4

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.cts CHANGED
@@ -480,12 +480,17 @@ interface PaymentProviderAdapter {
480
480
  /**
481
481
  * Create a PayPal payment: create PM → create intent → confirm with redirect.
482
482
  * Returns the confirmed PaymentIntent ID if completed inline, or redirects to PayPal.
483
+ *
484
+ * `nonce` is the session-bound checkout token from session creation. Post-#640
485
+ * backends reject `POST /v1/checkouts/payments/intents` with 401 when the
486
+ * `x-checkout-session-token` header is missing — pass `nonce` to forward it.
483
487
  */
484
488
  confirmPayPalPayment(params: {
485
489
  billingApiUrl: string;
486
490
  sessionId: string;
487
491
  email: string;
488
492
  returnUrl: string;
493
+ nonce?: string;
489
494
  }): Promise<ConfirmCardPaymentResult>;
490
495
  /**
491
496
  * Resume a PayPal payment after redirect return.
@@ -871,6 +876,15 @@ interface DeclineEvent {
871
876
  type CheckoutSessionResult = {
872
877
  status: 201;
873
878
  redirectUrl: string;
879
+ /**
880
+ * Session-bound checkout token returned by the billing API alongside the
881
+ * session UUID. Must be echoed back on every continuation request via the
882
+ * `x-checkout-session-token` header — backend `TeamFloPay/backend#640`
883
+ * matches this value against `checkout_session.nonce` to authorize the
884
+ * call. Surfaced here so the redirect-style flow's caller can forward it
885
+ * (e.g. into a hosted checkout page that hits continuation routes).
886
+ */
887
+ nonce: string;
874
888
  } | {
875
889
  status: 204;
876
890
  } | {
@@ -882,6 +896,17 @@ type CheckoutSessionResult = {
882
896
  */
883
897
  interface ProcessPaymentParams {
884
898
  sessionId: string;
899
+ /**
900
+ * Session-bound checkout token returned from session creation. Forwarded as
901
+ * the `x-checkout-session-token` header on every call to
902
+ * `POST /v1/checkouts/sessions/:id/process`. Required by post-#640 backends —
903
+ * `PaymentAPI.processPayment` throws `MissingCheckoutSessionToken` when this
904
+ * is missing or empty so the 401 fails fast on the client instead of after
905
+ * the network round trip. Typed as optional so callers do not need to coerce
906
+ * `undefined` to `''` to satisfy the type — pass the value through verbatim
907
+ * and let `processPayment` surface the missing-token error.
908
+ */
909
+ nonce?: string;
885
910
  tokenizedData?: TokenizedBody;
886
911
  accountData: {
887
912
  userId: string;
@@ -973,7 +998,7 @@ declare function getConfiguredBillingApiUrl(): string;
973
998
  declare function getFloPayEnvironment(): FloPayEnvironment;
974
999
 
975
1000
  /** Current SDK version. */
976
- declare const SDK_VERSION = "1.2.0";
1001
+ declare const SDK_VERSION = "1.2.4";
977
1002
  /** Billing API URL for staging environment. */
978
1003
  declare const BILLING_API_URL_STAGING = "https://api.stage.flopay.com";
979
1004
  /** Billing API URL for production environment. */
package/dist/index.d.ts CHANGED
@@ -480,12 +480,17 @@ interface PaymentProviderAdapter {
480
480
  /**
481
481
  * Create a PayPal payment: create PM → create intent → confirm with redirect.
482
482
  * Returns the confirmed PaymentIntent ID if completed inline, or redirects to PayPal.
483
+ *
484
+ * `nonce` is the session-bound checkout token from session creation. Post-#640
485
+ * backends reject `POST /v1/checkouts/payments/intents` with 401 when the
486
+ * `x-checkout-session-token` header is missing — pass `nonce` to forward it.
483
487
  */
484
488
  confirmPayPalPayment(params: {
485
489
  billingApiUrl: string;
486
490
  sessionId: string;
487
491
  email: string;
488
492
  returnUrl: string;
493
+ nonce?: string;
489
494
  }): Promise<ConfirmCardPaymentResult>;
490
495
  /**
491
496
  * Resume a PayPal payment after redirect return.
@@ -871,6 +876,15 @@ interface DeclineEvent {
871
876
  type CheckoutSessionResult = {
872
877
  status: 201;
873
878
  redirectUrl: string;
879
+ /**
880
+ * Session-bound checkout token returned by the billing API alongside the
881
+ * session UUID. Must be echoed back on every continuation request via the
882
+ * `x-checkout-session-token` header — backend `TeamFloPay/backend#640`
883
+ * matches this value against `checkout_session.nonce` to authorize the
884
+ * call. Surfaced here so the redirect-style flow's caller can forward it
885
+ * (e.g. into a hosted checkout page that hits continuation routes).
886
+ */
887
+ nonce: string;
874
888
  } | {
875
889
  status: 204;
876
890
  } | {
@@ -882,6 +896,17 @@ type CheckoutSessionResult = {
882
896
  */
883
897
  interface ProcessPaymentParams {
884
898
  sessionId: string;
899
+ /**
900
+ * Session-bound checkout token returned from session creation. Forwarded as
901
+ * the `x-checkout-session-token` header on every call to
902
+ * `POST /v1/checkouts/sessions/:id/process`. Required by post-#640 backends —
903
+ * `PaymentAPI.processPayment` throws `MissingCheckoutSessionToken` when this
904
+ * is missing or empty so the 401 fails fast on the client instead of after
905
+ * the network round trip. Typed as optional so callers do not need to coerce
906
+ * `undefined` to `''` to satisfy the type — pass the value through verbatim
907
+ * and let `processPayment` surface the missing-token error.
908
+ */
909
+ nonce?: string;
885
910
  tokenizedData?: TokenizedBody;
886
911
  accountData: {
887
912
  userId: string;
@@ -973,7 +998,7 @@ declare function getConfiguredBillingApiUrl(): string;
973
998
  declare function getFloPayEnvironment(): FloPayEnvironment;
974
999
 
975
1000
  /** Current SDK version. */
976
- declare const SDK_VERSION = "1.2.0";
1001
+ declare const SDK_VERSION = "1.2.4";
977
1002
  /** Billing API URL for staging environment. */
978
1003
  declare const BILLING_API_URL_STAGING = "https://api.stage.flopay.com";
979
1004
  /** Billing API URL for production environment. */
package/dist/index.mjs CHANGED
@@ -79,7 +79,7 @@ var PAYMENT_METHOD_LOGOS = {
79
79
  };
80
80
 
81
81
  // src/constants.ts
82
- var SDK_VERSION = "1.2.0";
82
+ var SDK_VERSION = "1.2.4";
83
83
  var BILLING_API_URL_STAGING = "https://api.stage.flopay.com";
84
84
  var BILLING_API_URL_PRODUCTION = "https://api.flopay.com";
85
85
  var DEFAULT_API_BASE_URL = BILLING_API_URL_STAGING;