@shoplygg/js, call it from an effect or an event handler, not while rendering.
With React
The SDK
shoply is null until the SDK has started. Every method is in the SDK reference. options on the provider are shoply.init()’s, such as currency and track.
A site whose router changes the page without loading one counts each page it shows:
The embed
product, variant, quantity, coupon, theme, email, billing) and anything a button takes. useEmbed() answers open and close, to open it from anywhere else.
The Checkout Kit
<CheckoutKit>, one of them checkout or payment. Its options are the Kit’s, and a change to them after it is up (the cart, the look) is passed to the Kit, so the checkout follows your page’s own basket. useCheckoutKit() answers the Kit, for kit.pay() from a button of your own.
onPaid tells the page only: it is no proof of payment. Your server hears of a paid order from webhooks.
Without React
Types
Both packages carry TypeScript types: the store, products, variants, the basket, the embed’s and the Kit’s options and events. A field Shoply adds later is there before the types name it, asunknown.
