Reservine Docs

The membership widget on your website

Add the script and a reservine-memberships element. Your membership plans render directly on your website and the purchase runs in the Reservine checkout with sign-in, Apple Pay and cards.

The membership widget on your website

The <reservine-memberships> element renders your membership plans as cards directly on your page. Clicking Buy opens the Reservine checkout: on a computer as a modal window, on mobile as a slide-up panel. The visitor signs in or registers, fills in billing details and pays by card, Apple Pay or Google Pay. They never leave your site, and after the purchase they see their membership code.

The cards inherit the colours of your Reservine, so with no configuration they look like your booking page. Fine-tune the look with attributes or CSS variables.

Where to find it

Settings → Membership widget (Nastavení → Widget členství, /admin/settings/membership-widget). Pick a branch, optionally one plan and the look, watch the live preview and copy the Header script and the HTML embed code. You can also write the same code by hand from this page.

Before you start: register your website domain

The widget loads plans only for domains registered in Reservine. Without the registration the cards are replaced by a Domain not registered notice.

  1. Open Settings → Public profile (Nastavení → Veřejný profil), section Domains.
  2. Click Add domain and enter the address of the site where you embed the widget, e.g. www.yourcompany.com.

The same registration enables Apple Pay for the reservation button, so if you have already done it there is nothing more to do. When testing locally, also register localhost:3000 or whichever port your site runs on.

The smallest working example

<script defer src="https://cdn.reservine.io/sdk/v1.js"></script>

<reservine-memberships partner="my-company"></reservine-memberships>

Replace a single value: my-company is the name of your Reservine, the part of the address before .reservine.me. The widget shows every active, purchasable plan of your main branch.

Reserve the widget's space

The script loads after the page (defer). Until then <reservine-memberships> is empty, and when the widget appears the content below it jumps down. Reserve its space with one CSS rule. It applies only until the widget loads; after that the widget holds its own height.

reservine-memberships:not(:defined) {
  display: block;
  min-height: 22.54125rem; /* one row of cards */
}

The height matches one row of cards with typical content. If your plans have long names or descriptions, set it to the real card height on your website.

One plan instead of the whole offer

On a landing page that sells a single plan, add the plan attribute with the plan ID. You find the ID in Settings → Membership widget (the Plan picker) or under Memberships → Plans.

<reservine-memberships
  partner="my-company"
  plan="12"
  buy-text="Get the Pro membership"
></reservine-memberships>

With several branches add branch="ID"; the widget shows that branch's plans plus the plans shared across your Reservine.

Look and feel

Without configuration the cards use the colour theme of your Reservine (light and dark, following the visitor's preference). You can override it in two ways.

Attributes for the most common tweaks:

<reservine-memberships
  partner="my-company"
  theme="dark"
  primary="#e11d48"
  radius="16px"
  font="inherit"
></reservine-memberships>

CSS variables for detailed tuning. Set them on the element; they win over the theme and the attributes:

reservine-memberships {
  --reservine-card-bg: #111827;
  --reservine-card-head-bg: #1f2937;
  --reservine-card-border: #374151;
  --reservine-seam-bg: #0b1220;
  --reservine-fg: #f9fafb;
  --reservine-primary: #e11d48;
  --reservine-primary-content: #ffffff;
  --reservine-radius: 12px;
  --reservine-font: inherit;
}

The primary colour (attribute or CSS variable) is forwarded into the checkout, so the cards and the payment window match.

Attributes of the <reservine-memberships> element

AttributeTypeDefaultDescription
partnerstring–The name of your Reservine (the part of the address before .reservine.me). Required.
branchnumber–Branch ID. Without it the main branch is used.
plannumber–Plan ID. With it only this one plan is rendered.
localecs · enpage languageLanguage of the card labels. Without it the page lang is used, then the language of your Reservine.
themelight · dark · autoautoLight or dark colour set; auto follows the visitor's preference.
primaryhex colour–Main colour of the cards and the Buy button. Forwarded into the checkout.
radiusCSS length–Card corner radius, e.g. 12px.
fontCSS font-family–Card font; inherit adopts your website's font.
buy-textstringBuyText of the button on the card.
success-urlURL–After a successful purchase the checkout closes and your page navigates to this address. Without it the checkout stays open with the confirmation and the membership code.
api-urlURLhttps://api.reservine.ioAPI address. Change only when asked by support.

In plain HTML write attributes in lowercase with a hyphen (buy-text, success-url, api-url). The framework adapters use camelCase (buyText, successUrl, apiUrl).

After the purchase

After payment the widget fires the reservine-membership-purchased event. Use it for conversion tracking or your own thank-you message:

const widget = document.querySelector('reservine-memberships');
widget.addEventListener('reservine-membership-purchased', (event) => {
  const { orderId, planId } = event.detail;
  console.log('Membership purchased', planId, 'order', orderId);
});

To send the visitor to your own page after the purchase, add success-url="https://www.yourcompany.com/thank-you". The event fires in that case too, right before the redirect.

Methods and events

APIKindDescription
element.open(planId?)methodOpens the checkout for the given plan (no argument: the plan from the plan attribute).
element.close()methodCloses the checkout.
element.refresh()methodReloads the plans, e.g. after switching the branch.
event reservine-membership-purchasedeventCustomEvent<{ orderId: number; planId: number }> after a successful payment.
event reservine-open-changeeventCustomEvent<{ open: boolean }> when the checkout opens and closes.

Frameworks

The @reservine/sdk package ships adapters for React, Vue, Svelte and Angular. Write the same attributes as camelCase props.

import { ReservineMemberships } from '@reservine/sdk/react';

export function PricingPage() {
  return (
    <ReservineMemberships
      partner="my-company"
      plan={12}
      primary="#e11d48"
      successUrl="https://www.yourcompany.com/thank-you"
      onPurchased={({ orderId, planId }) => console.log(orderId, planId)}
    />
  );
}

Vue: @reservine/sdk/vue, Svelte: @reservine/sdk/svelte, Angular: @reservine/sdk/angular. You do not add the CDN script in that case; the package registers the element itself.

Checks after deployment

  1. The cards load and show the right plans and prices in the currency of your Reservine.
  2. The Buy button opens the checkout; on mobile a slide-up panel that can be closed.
  3. A test purchase completes and shows the membership code, or redirects to success-url.
  4. The script https://cdn.reservine.io/sdk/v1.js appears on the page only once.

Troubleshooting

"Domain not registered" is shown. The domain of the site running the widget is missing in Settings → Public profile → Domains. Add it exactly as you see it in the address bar (including www if you use it).

A plan is missing in the widget. The widget shows only active plans with purchase enabled (subscription or one-time purchase). Check the plan under Memberships → Plans. Changes reach the widget within five minutes.

Prices are in a different currency than expected. Prices are shown in the currency of your Reservine; the locale attribute only changes the label language and the number format.

The checkout is blank or does not load. Make sure your site runs on https:// and the browser does not block third-party cookies for *.reservine.me; signing in inside the checkout depends on them.

On this page