brainerce 1.37.2 → 1.37.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 +9 -4
- package/dist/index.d.mts +40 -2
- package/dist/index.d.ts +40 -2
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -2050,8 +2050,11 @@ const checkout = await client.createCheckout({
|
|
|
2050
2050
|
```
|
|
2051
2051
|
|
|
2052
2052
|
> The region is recorded on the checkout and used for payment-provider scoping.
|
|
2053
|
-
>
|
|
2054
|
-
>
|
|
2053
|
+
> **FX-at-checkout:** when the region currency differs from the store base and its
|
|
2054
|
+
> provider can settle it (presentment-enabled — Stripe today), the buyer is charged
|
|
2055
|
+
> in the region currency and the checkout response carries a `presentment` overlay
|
|
2056
|
+
> (`presentment.total` / `presentment.currency` = what's charged). Otherwise the
|
|
2057
|
+
> checkout is charged in the store base currency.
|
|
2055
2058
|
|
|
2056
2059
|
#### Region display pricing (`getProducts({ regionId })`)
|
|
2057
2060
|
|
|
@@ -3638,8 +3641,10 @@ const { region: resolved } = await store.getAutoRegion('DE'); // server-side, on
|
|
|
3638
3641
|
|
|
3639
3642
|
> **Multi-region checkout:** pass a `regionId` to `createCheckout` to associate the
|
|
3640
3643
|
> checkout with a region (for reporting + payment-provider scoping). The region
|
|
3641
|
-
> must belong to the store.
|
|
3642
|
-
>
|
|
3644
|
+
> must belong to the store. **FX-at-checkout:** presentment-enabled regions
|
|
3645
|
+
> (Stripe today) charge in the region currency and return a `presentment` overlay;
|
|
3646
|
+
> otherwise the checkout is charged in the store base currency. See the Checkout
|
|
3647
|
+
> section.
|
|
3643
3648
|
|
|
3644
3649
|
### Price Lists (per-region pricing)
|
|
3645
3650
|
|
package/dist/index.d.mts
CHANGED
|
@@ -2507,8 +2507,11 @@ interface Checkout {
|
|
|
2507
2507
|
currency: string;
|
|
2508
2508
|
/**
|
|
2509
2509
|
* Region this checkout is associated with (multi-region commerce), or null.
|
|
2510
|
-
* Recorded for reporting + provider scoping
|
|
2511
|
-
*
|
|
2510
|
+
* Recorded for reporting + provider scoping. FX-at-checkout: when the region
|
|
2511
|
+
* currency differs from the store base and its provider can settle it
|
|
2512
|
+
* (presentment-enabled — Stripe today), the buyer is charged in the region
|
|
2513
|
+
* currency and the `presentment` overlay below carries the charged amounts;
|
|
2514
|
+
* otherwise the checkout is charged in the store base currency.
|
|
2512
2515
|
*/
|
|
2513
2516
|
regionId?: string | null;
|
|
2514
2517
|
/** Subtotal as string - use parseFloat() */
|
|
@@ -2560,6 +2563,41 @@ interface Checkout {
|
|
|
2560
2563
|
* @see ReservationInfo
|
|
2561
2564
|
*/
|
|
2562
2565
|
reservation?: ReservationInfo;
|
|
2566
|
+
/**
|
|
2567
|
+
* FX-at-checkout presentment overlay. Present ONLY when the checkout's region
|
|
2568
|
+
* uses a different currency from the store base AND that region charges in its
|
|
2569
|
+
* own currency (presentment). These are the amounts the buyer will actually be
|
|
2570
|
+
* CHARGED, in `presentment.currency` — `presentment.total` equals the payment
|
|
2571
|
+
* intent amount to the cent. Render these (not the base `total`/`currency`
|
|
2572
|
+
* above) when present. Absent = the checkout is charged in the store base
|
|
2573
|
+
* currency (the fields above are authoritative).
|
|
2574
|
+
*
|
|
2575
|
+
* @example
|
|
2576
|
+
* const c = await client.getCheckout(id);
|
|
2577
|
+
* const shown = c.presentment
|
|
2578
|
+
* ? formatPrice(c.presentment.total, { currency: c.presentment.currency })
|
|
2579
|
+
* : formatPrice(c.total, { currency: c.currency });
|
|
2580
|
+
*/
|
|
2581
|
+
presentment?: {
|
|
2582
|
+
/** ISO-4217 currency the buyer is charged in (e.g. "EUR"). */
|
|
2583
|
+
currency: string;
|
|
2584
|
+
/** Subtotal in the presentment currency as string - use parseFloat(). */
|
|
2585
|
+
subtotal: string;
|
|
2586
|
+
/** Discount amount in the presentment currency as string. */
|
|
2587
|
+
discountAmount: string;
|
|
2588
|
+
/** Shipping cost in the presentment currency as string. */
|
|
2589
|
+
shippingAmount: string;
|
|
2590
|
+
/** Tax amount in the presentment currency as string. */
|
|
2591
|
+
taxAmount: string;
|
|
2592
|
+
/** Surcharge amount in the presentment currency as string. */
|
|
2593
|
+
surchargeAmount: string;
|
|
2594
|
+
/** Grand total in the presentment currency — equals the charged amount. */
|
|
2595
|
+
total: string;
|
|
2596
|
+
/** Base→presentment rate applied (buffer included), as string. */
|
|
2597
|
+
fxChargingRate: string;
|
|
2598
|
+
/** FX buffer percent applied to the mid-market rate, as string (or null). */
|
|
2599
|
+
fxBufferPercent: string | null;
|
|
2600
|
+
};
|
|
2563
2601
|
}
|
|
2564
2602
|
/**
|
|
2565
2603
|
* Options for creating a checkout from a cart.
|
package/dist/index.d.ts
CHANGED
|
@@ -2507,8 +2507,11 @@ interface Checkout {
|
|
|
2507
2507
|
currency: string;
|
|
2508
2508
|
/**
|
|
2509
2509
|
* Region this checkout is associated with (multi-region commerce), or null.
|
|
2510
|
-
* Recorded for reporting + provider scoping
|
|
2511
|
-
*
|
|
2510
|
+
* Recorded for reporting + provider scoping. FX-at-checkout: when the region
|
|
2511
|
+
* currency differs from the store base and its provider can settle it
|
|
2512
|
+
* (presentment-enabled — Stripe today), the buyer is charged in the region
|
|
2513
|
+
* currency and the `presentment` overlay below carries the charged amounts;
|
|
2514
|
+
* otherwise the checkout is charged in the store base currency.
|
|
2512
2515
|
*/
|
|
2513
2516
|
regionId?: string | null;
|
|
2514
2517
|
/** Subtotal as string - use parseFloat() */
|
|
@@ -2560,6 +2563,41 @@ interface Checkout {
|
|
|
2560
2563
|
* @see ReservationInfo
|
|
2561
2564
|
*/
|
|
2562
2565
|
reservation?: ReservationInfo;
|
|
2566
|
+
/**
|
|
2567
|
+
* FX-at-checkout presentment overlay. Present ONLY when the checkout's region
|
|
2568
|
+
* uses a different currency from the store base AND that region charges in its
|
|
2569
|
+
* own currency (presentment). These are the amounts the buyer will actually be
|
|
2570
|
+
* CHARGED, in `presentment.currency` — `presentment.total` equals the payment
|
|
2571
|
+
* intent amount to the cent. Render these (not the base `total`/`currency`
|
|
2572
|
+
* above) when present. Absent = the checkout is charged in the store base
|
|
2573
|
+
* currency (the fields above are authoritative).
|
|
2574
|
+
*
|
|
2575
|
+
* @example
|
|
2576
|
+
* const c = await client.getCheckout(id);
|
|
2577
|
+
* const shown = c.presentment
|
|
2578
|
+
* ? formatPrice(c.presentment.total, { currency: c.presentment.currency })
|
|
2579
|
+
* : formatPrice(c.total, { currency: c.currency });
|
|
2580
|
+
*/
|
|
2581
|
+
presentment?: {
|
|
2582
|
+
/** ISO-4217 currency the buyer is charged in (e.g. "EUR"). */
|
|
2583
|
+
currency: string;
|
|
2584
|
+
/** Subtotal in the presentment currency as string - use parseFloat(). */
|
|
2585
|
+
subtotal: string;
|
|
2586
|
+
/** Discount amount in the presentment currency as string. */
|
|
2587
|
+
discountAmount: string;
|
|
2588
|
+
/** Shipping cost in the presentment currency as string. */
|
|
2589
|
+
shippingAmount: string;
|
|
2590
|
+
/** Tax amount in the presentment currency as string. */
|
|
2591
|
+
taxAmount: string;
|
|
2592
|
+
/** Surcharge amount in the presentment currency as string. */
|
|
2593
|
+
surchargeAmount: string;
|
|
2594
|
+
/** Grand total in the presentment currency — equals the charged amount. */
|
|
2595
|
+
total: string;
|
|
2596
|
+
/** Base→presentment rate applied (buffer included), as string. */
|
|
2597
|
+
fxChargingRate: string;
|
|
2598
|
+
/** FX buffer percent applied to the mid-market rate, as string (or null). */
|
|
2599
|
+
fxBufferPercent: string | null;
|
|
2600
|
+
};
|
|
2563
2601
|
}
|
|
2564
2602
|
/**
|
|
2565
2603
|
* Options for creating a checkout from a cart.
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "brainerce",
|
|
3
|
-
"version": "1.37.
|
|
3
|
+
"version": "1.37.3",
|
|
4
4
|
"description": "Official SDK for building e-commerce storefronts with Brainerce Platform. Perfect for vibe-coded sites, AI-built stores (Cursor, Lovable, v0), and custom storefronts.",
|
|
5
5
|
"main": "dist/index.js",
|
|
6
6
|
"module": "dist/index.mjs",
|