Installation
Initialization
Opening Checkout
Overlay Mode
Opens checkout in a full-screen modal overlay:Embed Mode
Renders checkout inside a target DOM element:Checkout Options
| Option | Type | Description |
|---|---|---|
checkoutUrl | string | Required. The checkout URL from your Fungies dashboard |
settings.mode | "overlay" | "embed" | Display mode for the checkout |
settings.frameTarget | string | DOM element ID for embed mode |
customerEmail | string | Customer email (deprecated, use billingData.email) |
billingData | object | Prefilled billing information (see below) |
discountCode | string | Discount code to apply |
quantity | number | Product quantity |
items | array | Items for multi-product checkout |
customFields | object | Custom field values |
Billing Data Object
Prefill customer billing information:| Field | Type | Description |
|---|---|---|
email | string | Customer email address |
firstName | string | Customer first name |
lastName | string | Customer last name |
country | string | Country code (ISO 3166-1 alpha-2, e.g., US, GB, PL) |
state | string | State or province |
city | string | City name |
zipCode | string | Postal/ZIP code |
Multi-Product Checkout
Specify quantities for multiple offers:Custom Fields
Pass custom field values to the checkout:Closing Checkout
Programmatically close the checkout:Listening to checkout events
The SDK listens for messages from the checkout iframe and dispatches DOM events ondocument. This happens automatically when you call Fungies.Initialize() or use the data-auto-init script attribute — no extra setup is required.
Use these events to run your own logic after a purchase (redirect to a thank-you page, refresh entitlements, show a confirmation modal, etc.).
| Event | When it fires |
|---|---|
fungies:checkout:complete | The customer completed checkout successfully |
fungies:checkout:close | The checkout was closed (by the customer or after completion) |
useEffect and remove them on unmount: