@flopay/react 1.8.8 → 1.8.9

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/README.md CHANGED
@@ -466,6 +466,7 @@ Skip the backend API route — create the session directly in the component:
466
466
  account: { userId: 'user_1' }, // email and name are collected in checkout
467
467
  successUrl: '/success',
468
468
  cancelUrl: '/cancel',
469
+ checkoutMetadata: { merchantOrderId: 'order-123', campaign: 'summer' },
469
470
  }}
470
471
  onComplete={(result) => window.location.href = '/success'}
471
472
  />
@@ -475,6 +476,14 @@ The component creates a lightweight shell, attaches the catalog immediately,
475
476
  renders every otherwise-eligible method, and identifies the buyer later from
476
477
  the selected method or its fallback — zero merchant backend code needed.
477
478
 
479
+ `checkoutMetadata?: Record<string, string> | null` is sent unchanged on that
480
+ initial shell request and never repeated in the catalog or late-buyer claim.
481
+ Omission keeps the previous request shape; explicit `null` and `{}` remain
482
+ distinct wire values. Returned metadata is available on the normalized result
483
+ and its `data.session`. Backend validation errors retain their structured
484
+ `FloPayError` code, message, and HTTP status; React does not duplicate backend
485
+ size or length limits.
486
+
478
487
  #### Authorisation-only checkout
479
488
 
480
489
  Set `captureMethod: 'manual'` in the same `createSession` draft for an eligible
@@ -518,8 +527,11 @@ mounts (StrictMode double-mount, Suspense remount, or navigation flicker) share
518
527
  both the session create and the auto-mode payment attempt, so one purchase cannot
519
528
  fan out into multiple creates or charges.
520
529
 
521
- Logical checkout identity is based on the merchant, buyer, cart/pricing, and
522
- coupons. Checkout-mode changes, refreshed payment tokens, and analytics/UTM prop
530
+ Logical checkout identity is based on the merchant, buyer, cart/pricing,
531
+ coupons, and checkout metadata. Metadata keys are canonicalized for identity,
532
+ so key-order-only changes reuse the current session while a material metadata
533
+ change creates a new one. Raw metadata is not stored in the inline-session
534
+ cache. Checkout-mode changes, refreshed payment tokens, and analytics/UTM prop
523
535
  churn do not rotate the key while that purchase is active. A different cart or
524
536
  buyer gets a different key; an email-less buyer is separated by `account.userId`.
525
537
 
@@ -545,7 +557,12 @@ for the full contract.
545
557
 
546
558
  Session-level `currency` is now **required**. The backend (#760) enforces `@IsNotEmpty` on the field; the SDK pre-validates and throws `FloPayError({ type: 'validation_error', code: 'CurrencyRequired' })` before issuing the request when neither the session nor any item/subscription/product carries a currency. Pass `currency` at the top of `createSession` (preferred), or rely on the legacy fallback to the first item/subscription/product `currency`.
547
559
 
548
- When you use `onBeforeButtonClick` with `createSession`, any returned `InlineSessionPatch` is merged into the draft session params before the selected buttons-layout flow continues. That lets you add tracking data or update account fields just in time without pre-creating a separate backend session.
560
+ When you use `onBeforeButtonClick` with `createSession`, any returned
561
+ `InlineSessionPatch` is merged into the draft session params before the selected
562
+ buttons-layout flow continues. That lets you add tracking data or update account
563
+ fields just in time without pre-creating a separate backend session. A returned
564
+ `checkoutMetadata` map replaces the prior map as a whole; return `null` to clear
565
+ it before creation.
549
566
 
550
567
  ### Detached session creation (default)
551
568