@flopay/react 1.3.2 → 1.3.3
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 +27 -0
- package/package.json +4 -4
package/README.md
CHANGED
|
@@ -329,6 +329,33 @@ Skip the backend API route — create the session directly in the component:
|
|
|
329
329
|
|
|
330
330
|
The component POSTs to the billing API, gets the full session back, and renders the form — zero backend code needed.
|
|
331
331
|
|
|
332
|
+
That create POST sends a stable `Idempotency-Key` header automatically whenever a
|
|
333
|
+
secure RNG is available, so a timeout or lost response never mints a second
|
|
334
|
+
session. `FloPayCheckout` already coalesces concurrent mounts (StrictMode
|
|
335
|
+
double-mount, Suspense remount, navigation flicker) into a single create, and
|
|
336
|
+
rerenders during an in-flight create do **not** replace the key. You normally
|
|
337
|
+
don't need to think about it.
|
|
338
|
+
|
|
339
|
+
To control the key yourself — for example to keep it stable across your own
|
|
340
|
+
server retries — pass `idempotencyKey` on `createSession`:
|
|
341
|
+
|
|
342
|
+
```tsx
|
|
343
|
+
<FloPayCheckout
|
|
344
|
+
createSession={{
|
|
345
|
+
/* … */
|
|
346
|
+
idempotencyKey: `checkout:${orderId}`, // one logical checkout; never reuse for a new purchase
|
|
347
|
+
}}
|
|
348
|
+
/>
|
|
349
|
+
```
|
|
350
|
+
|
|
351
|
+
The key must be non-empty and at most 255 characters; an invalid value throws a
|
|
352
|
+
`FloPayError('validation_error')` before any request. Omit it and the SDK
|
|
353
|
+
generates a fresh cryptographically random key per logical create when a secure
|
|
354
|
+
RNG is available; without one it omits the header, and a merchant-supplied
|
|
355
|
+
`idempotencyKey` stays the way to remain idempotent. See the
|
|
356
|
+
[`@flopay/js` idempotency docs](../js/README.md#idempotent-checkout-creation)
|
|
357
|
+
for the full contract.
|
|
358
|
+
|
|
332
359
|
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`.
|
|
333
360
|
|
|
334
361
|
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.
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@flopay/react",
|
|
3
|
-
"version": "1.3.
|
|
3
|
+
"version": "1.3.3",
|
|
4
4
|
"type": "module",
|
|
5
5
|
"publishConfig": {
|
|
6
6
|
"registry": "https://registry.npmjs.org/",
|
|
@@ -28,8 +28,8 @@
|
|
|
28
28
|
"@paypal/paypal-js": "^10.0.0",
|
|
29
29
|
"@stripe/react-stripe-js": "^6.6.0",
|
|
30
30
|
"@stripe/stripe-js": "^9.8.0",
|
|
31
|
-
"@flopay/
|
|
32
|
-
"@flopay/
|
|
31
|
+
"@flopay/shared": "1.3.3",
|
|
32
|
+
"@flopay/js": "1.3.3"
|
|
33
33
|
},
|
|
34
34
|
"peerDependencies": {
|
|
35
35
|
"react": ">=18.0.0",
|
|
@@ -45,7 +45,7 @@
|
|
|
45
45
|
"react-dom": "^19.2.7",
|
|
46
46
|
"tsup": "^8.3.0",
|
|
47
47
|
"typescript": "^6.0.3",
|
|
48
|
-
"vitest": "^4.1.
|
|
48
|
+
"vitest": "^4.1.10"
|
|
49
49
|
},
|
|
50
50
|
"scripts": {
|
|
51
51
|
"build": "tsup",
|