@usethrottle/checkout-react 2.1.0 → 2.2.0

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
@@ -132,9 +132,12 @@ export function MyEmbed({ sessionId }: { sessionId: string }) {
132
132
  Own a Throttle cart directly from the browser — no backend, no secret key. The
133
133
  hook wraps `@usethrottle/cart`'s `CartSessionClient`: it creates the cart lazily
134
134
  on the first `addItem`, persists the session id to `localStorage`, resumes it on
135
- the next visit, and exposes reactive `cart` state. Authorize with a publishable
136
- `pk_` quote token + your application's origin allowlist (set origins via
137
- `PUT /api/v1/embed-config`).
135
+ the next visit, and exposes reactive `cart` state. Authorize with a storefront quote
136
+ token (`qt_…`, from the dashboard Shipping & Tax page or
137
+ `POST /api/v1/shipping-tax/quote-tokens`) + your application's origin allowlist
138
+ (set origins via `PUT /api/v1/embed-config`). Quote tokens minted before `qt_`
139
+ start with `pk_` and keep working. A `pk_` publishable API key is a different
140
+ credential and is refused with `401 invalid_quote_token`.
138
141
 
139
142
  ```tsx
140
143
  import { useCartSession } from '@usethrottle/checkout-react';
@@ -143,7 +146,7 @@ function Cart() {
143
146
  const cart = useCartSession({
144
147
  applicationId: '7f9d4c8a-5b2e-4f16-9a73-2d1e5c8b6f40',
145
148
  environmentId: 'a1b2c3d4-...',
146
- quoteToken: 'pk_live_...',
149
+ quoteToken: 'qt_...',
147
150
  });
148
151
 
149
152
  return (
@@ -203,6 +206,13 @@ The callback shape changed in v0.2: `onCompleted(orderId, paymentId)`
203
206
  is now `onSucceeded({orderId, paymentId})` and `onError(code, message)`
204
207
  is now `onFailed({code, message})`. Update call sites accordingly.
205
208
 
209
+ ## Money
210
+
211
+ Amounts are integers in the record's minor unit. Show them with
212
+ `formatMoney(amount, currency)`: this package re-exports `@usethrottle/money`
213
+ as `money` and `formatMoney` by name, plus the `CurrencyCode` and `MoneyValue`
214
+ types. For analytics, use `toDecimalString(amount, currency)`, never `/ 100`.
215
+
206
216
  ## See also
207
217
 
208
218
  - [CLI: `throttle embed-config`](https://www.npmjs.com/package/@usethrottle/cli)