Elements
<spiffy-element> is a single embed element for dropping Spiffy surfaces into your page: checkouts, customer and affiliate portals, affiliate registration, and management views for one subscription or payment plan. Set type to pick the surface, then pass that type's attributes.
<spiffy-element type="checkout" url="https://example.spiffy.co/checkout/my-checkout"></spiffy-element>SpiffyJS also turns plain links to your checkouts into popups by default, so you only need an element when you want something embedded in-line on the page.
An element mounts as soon as it's on the page, whether it's in your initial HTML or added later. That means single-page apps work without any extra step: render a <spiffy-element> on a route change and it mounts itself. The one exception is compatibility-mode container <div>s, which SpiffyJS can't detect on their own; call spiffy.rescan() after adding one.
Types
type
Attributes
Renders
checkout
url (required)
An in-line checkout
customer-portal
token (optional)
The customer's full portal: subscriptions, payment plans, and orders
affiliate-portal
token (optional)
The affiliate portal
affiliate-register
none
The affiliate registration form
subscription
ref (required), token (optional)
One subscription's management view
payment-plan
ref (required), token (optional)
One payment plan's management view
token - an SSO magic-link token, for signing the customer or affiliate straight in instead of showing a login form. Requires an API connection with Spiffy to request portal tokens.
ref - the id of the subscription or payment plan the element should manage. Resolve it via the API the same way you resolve the SSO token (see below).
Checkout
<spiffy-element type="checkout" url="https://example.spiffy.co/checkout/my-checkout"></spiffy-element>url also accepts query parameters, so you can pass additional data to your checkout the same way you would with a direct link.
Point url at your own Spiffy checkout — either your custom checkout domain or your *.spiffy.co subdomain. A URL on any other host (a redirector, a proxy, a vanity domain you haven't set up with Spiffy) still loads the checkout, but Spiffy can't tie it back to your account: that embed records no checkout views and fires no conversion events to your ad platforms.
Customer and affiliate portals
Without token, the embed shows a login form. With token, the customer or affiliate lands signed in.
Affiliate registration
Subscription and payment plan elements
By default the customer portal shows everything a customer has: every subscription, payment plan, and order. type="subscription" and type="payment-plan" skip straight to one item's management view instead. That's useful when a customer has other purchases that don't belong in the surface you're embedding in, like a SaaS app that should only expose billing for its own subscription and nothing else the customer bought from you.
To set this up:
Resolve the subscription or payment plan id for the customer you're embedding, server-side, through the Spiffy API (the same place you already resolve the SSO token).
Mint an SSO magic-link
tokenfor that customer, as you do today.Embed with both
refandtokenset.
The customer lands signed in, directly on that item's management page, with no way to reach the rest of their portfolio.
Compatibility mode
data-type maps to type; the other data-* attributes map to their matching element attribute (data-url, data-token, data-ref).
Legacy elements
spiffy-checkout, spiffy-portal, and spiffy-affiliate-register still work and aren't going anywhere. New integrations should use <spiffy-element> instead: it does everything these do, plus single-item management for subscriptions and payment plans, which the legacy elements don't have.
<spiffy-checkout url="...">
<spiffy-element type="checkout" url="...">
<spiffy-portal type="customer">
<spiffy-element type="customer-portal">
<spiffy-portal type="affiliate">
<spiffy-element type="affiliate-portal">
<spiffy-affiliate-register>
<spiffy-element type="affiliate-register">
<spiffy-portal type="customer" subscription="...">
<spiffy-element type="subscription" ref="...">
spiffy-checkout
Properties
url(required) - the URL of the checkout you want to load in-line. Also accepts URL parameters for passing additional data to your checkout
Compatibility Mode
spiffy-portal
Properties
type(defaultcustomer) - toggle the type of portal to embed. Valid values arecustomeroraffiliatetoken(defaultnull) - pass in an authentication token for single sign-on functionality. &#xNAN;This requires an API connection with Spiffy to request customer portal tokens
Compatibility Mode
spiffy-affiliate-register
Compatibility Mode
Last updated