Integration Overview
The Checkout Embed opens SellAuth Checkout in a modal on top of your site. The buyer reviews their cart, adjusts quantities, and pays without ever leaving your page. The script is a thin wrapper: it builds a URL and opens an iframe. It pulls in no third party dependencies and makes no network request before the modal opens, so the button responds instantly.Already using the older
sellauth-embed-2.js? It keeps working. See
Migrating from v2 when you are ready to switch.Quick Start
Add the script to your page:data-sellauth-shop opens the checkout when
clicked, including elements added to the page later by a framework.
That button is the real embed, running on this page against our demo store. Nothing is charged
until you reach the payment step.
Required Values
integer
required
Your shop ID, from the API access page.
string
required
Your store URL, for example
https://yourstore.com or https://yourshop.mysellauth.com.
Checkout is served from your own domain, so the embed needs to know it.array
required
One or more items. Only
productId and quantity are required:{ productId, quantity }lets the buyer pick the variant in the modal{ productId, variantId, quantity }goes straight to that exact variant
JavaScript API
For anything beyond a static button, callsellAuth.open() directly:
React and Next.js need no special hook or component. The cart and payment handling all live
inside the iframe, so
sellAuth.open() is the entire integration.Letting Buyers Choose
Pinning avariantId means your page has to ask which size, tier or duration the buyer wants
before the modal opens, so you end up building a variant selector, keeping its prices in step with
your dashboard, and hiding options that sell out.
Omit variantId and none of that is your problem. The modal shows the picker itself, always in
sync with your product:
variantId, so the modal asks which one you want.
One button now covers a product with any number of variants, and adding a variant in your dashboard
needs no change to your site.
The picker lists each variant with its price, any sale price, its description and its stock. Sold
out variants cannot be selected. Once every open product has a variant, the buyer moves straight to
the cart and can still switch variant there.
A product with only one variant in stock is selected automatically, so the buyer never sees a
picker with a single choice.
You can mix both styles in one cart. Pin the variants you know and leave the rest open:
skipCart is ignored while any product is still missing a variant, since there is nothing to
submit until the buyer has chosen.Campaign Attribution
The embed also records where a buyer came from. When your page is opened withutm_* parameters, or
from another site, the script keeps the UTM values (or the referrer’s host, for example reddit.com)
for the current visit and stamps them on the invoice. The dashboard shows them on the invoice, lets
you filter the invoice list by them, and includes them in exports.
Attribution is visit scoped, not a long lived cookie: it lives in localStorage on your domain
and slides forward for 30 minutes of browsing. A tagged landing overwrites what was stored, an
external referrer only fills an empty slot, and a plain visit a day later is not attributed to the
old campaign.
To set it yourself, pass the attribution option. To turn the automatic capture off, declare it
before the script loads:
Affiliate Tracking
The embed captures referrals for you. When someone lands on your page through an affiliate link, the script reads?ref, ?aff or ?affiliate from the URL, remembers it, and attaches it to whatever
that visitor buys later.
?ref at all.
Where the code comes from
Three sources, in order. The first one that has a value wins.1
The affiliate option
Set it yourself when you already know the referrer, for example from your own analytics or a
logged in session.
2
The page URL
?ref, ?aff or ?affiliate on the current page.3
The stored cookie
A code captured on an earlier visit.
The cookie
Capturing a code writessa_aff on your own domain: 30 days, SameSite=Lax, readable only by your
site. It is a first party cookie that you set, so if you run a cookie banner, it belongs in your
marketing or analytics category alongside your other attribution tags. The embedded checkout runs
in an iframe on your site and cannot see the storefront’s own consent banner
choice, so your page’s banner is the one that governs it.
To turn capture off entirely, declare it before the script loads:
affiliate option still works. Only the URL reading and the cookie stop.
Before it works
- Your affiliate program has to be enabled in your dashboard. Until it is, every code is ignored. See Affiliates.
- Codes are at most 16 characters, letters, numbers, underscores and hyphens. Anything longer or with other characters never leaves the browser.
- Buyers cannot refer themselves. A code is dropped when it belongs to the account buying with it, matched on email address. This one catches people out while testing, since your own code plus your own email looks exactly like a broken integration.
Options
string
default:"auto"
auto, light, or dark. auto follows the visitor’s system preference. A shop that locks its
checkout colour scheme overrides this.boolean
default:"true"
false opens checkout in a new tab instead of a modal.boolean
default:"false"
Skips the cart review screen and goes straight to payment. Use this when your own site already
shows a cart. Quantities are no longer adjusted to available stock, so an item that is short is
rejected rather than reduced.
boolean
default:"true"
false hides the close button. Clicking the backdrop still closes the modal.boolean
default:"false"
Shows your shop logo and name at the top of the modal. Off by default, since your own site
already establishes who the buyer is dealing with.
boolean
default:"false"
Shows the support ticket panel after purchase. Off by default, because it links to your SellAuth
storefront. Turn it on if you handle support through SellAuth tickets.
string
Three letter currency code, for example
EUR.string
Prefills the buyer’s email address.
string
An affiliate code, at most 16 characters. Left unset, the embed picks up
?ref, ?aff or
?affiliate from your page URL and remembers it for 30 days. See
Affiliate Tracking.string
Two letter language code. Defaults to your page’s
<html lang>.object
Up to 10 custom key and value pairs stored on the invoice.
object
Campaign attribution stored on the invoice:
utm_source, utm_medium, utm_campaign, utm_term,
utm_content and referrer_host, each at most 100 characters. Left unset, the embed uses what it
captured from your page URL and referrer. See Campaign Attribution.string
Where to send the buyer after a completed purchase.
boolean
default:"true"
Scrolls your page to the top when the modal opens.
boolean
default:"true"
With
modal: false, opens a new tab rather than navigating the current one.theme becomes data-sellauth-theme, shopCard
becomes data-sellauth-shop-card, and so on.
Checkout Settings
The modal runs your shop’s checkout, so what appears inside it also comes from Settings → Checkout:- Show Coupon Code Textbox
- Show Terms Checkbox
- Pre-check Terms Checkbox
- Show Newsletter Checkbox
- Show Immediate Delivery Checkbox
- Show Withdrawal Form
Events
The embed reports what happens inside the modal, which is how you track conversions from a checkout that lives in an iframe.
Callbacks work too, if you prefer them per call:
Methods
Pinning a Version
The URL above tracks the latest v3 release and picks up fixes automatically. To pin an exact build, including for a Subresource Integrity hash, use the full version:v3.min.js alias is updated in place with backward
compatible releases, so it cannot be used with an integrity hash.
Content Security Policy
If your site sends a CSP, allow the script and the frame:frame-src must list your own store domain, since that is where checkout is served from. Without
it the modal stays blank, and the embed falls back to opening checkout in a new tab.
Pass a nonce if your policy requires one:
Migrating from v2
sellauth-embed-2.js keeps working and will not be removed. When you switch:
1
Change the script URL
Replace
https://sellauth.com/assets/js/sellauth-embed-2.js with
https://static.sellauth.com/embed/v3.min.js.2
Add your store URL
v3 needs
shopUrl alongside shopId. This is the one required change to your calls.3
Switch to sellAuth.open()
Replace
window.sellAuthEmbed.checkout(this, {...}) with sellAuth.open({...}). Option names
are otherwise unchanged.- Nothing extra loaded into your page, so no CSP conflicts and nothing for ad blockers to break.
- Conversion events, which v2 had no way to report.
- A cart review step where buyers can adjust quantities before paying.
- No copy and paste React hook.
sellAuth.open()is the whole integration. - On iOS,
modal: falseopens a new tab instead of navigating away from your page.