Skip to main content

Custom Checkouts

Pre-release documentation

This functionality is currently not available for general release. While you can reference this guide to begin your integration with early access, please be aware that all endpoints, logic, and component attributes are subject to change. Known pending changes are flagged throughout this document.

The Payments API enables you to build custom checkout experiences using API endpoints combined with the <spektrix-payments> web component. Unlike iframe-based checkout, this approach gives you full control over the checkout UI while Spektrix handles payment processing.

The API and web component are only supported for web flows. A basket will be confirmed on successful payment - the payment must be in full, as partial payments are not supported.

If you are looking for information on setting up a standard iframe checkout with Spektrix Payments, please see Iframes: Spektrix Payments. For further information on Payment Component Styling and setup, please see Payments Component.

Possible checkout flows

FlowSystem Owner mode endpoint - server sideWeb / Public mode endpoint - client sideWhen to use
Direct CheckoutPOST /baskets/{basketId}/initiate-direct-paymentPOST /basket/initiate-direct-paymentCustomer is not logged in. Identified by email only after payment is confirmed.
Customer CheckoutPOST /baskets/{basketId}/initiate-customer-paymentPOST /basket/initiate-customer-paymentCustomer is logged in or added to the basket.
One-Click Checkout (pending)POST /baskets/{basketId}/initiate-one-click-paymentPOST /basket/initiate-one-click-paymentNot yet available.

Reference

Spektrix Payments Component

To use the <spektrix-payments> component, include the necessary styles and script in the <head> section of your page:

<link rel="stylesheet" href="https://webcomponents.spektrix.com/stable/spektrix-payments.css" />
<script src="https://webcomponents.spektrix.com/stable/spektrix-payments.js"></script>

Then insert the component into your checkout page:

<spektrix-payments
id="paymentsComponent"
custom-domain="{tickets.yourdomain.com}"
system-name="{clientName}"
payment-token="{paymentToken}"
></spektrix-payments>

Component attributes

AttributeRequiredDescription
custom-domainYesThe custom domain that points to Spektrix (excluding https://).
system-nameYesThe client's Spektrix system name.
payment-tokenYesThe secure token received from the initiate payment endpoint.
billing-address-idConditionalThe customer's billing address ID. Required for Customer Checkout.
store-cardConditional"true" or "false" — whether to offer saving the card. Required for Customer Checkout.
top-level-domainConditionalRequired only if embedding in an iframe. The top-level domain the iframe is embedded into (excluding https://). Necessary for Apple Pay.
languageNoLanguage code for localisation (e.g. "fr"). Default is English. French is the only other language currently supported.

For component styling and Apple Pay domain setup, see Payments Component.

Event handling

Listen for the following events to manage the customer journey after a payment attempt:

Event NameDescription
onPaymentCompletedTriggered when the payment is successful. Access the order ID via event.detail.orderId.
onPaymentRefusedTriggered if the payment is refused.
onPaymentNotFoundTriggered if the session or token has expired (when a Basket has timed out).
onErrorTriggered if any other unanticpated error occurs. More likely to be a transient system error and less likely to be an integration issue.

Card Management

<spektrix-add-card> component

This component is for a wallet in a My Account type page, allowing a customer to add a card to their wallet. It requires a customer to be authenticated. No payment token or API request is required.

<spektrix-add-card
id="spektrixDropin"
custom-domain="tickets.mytheatre.com"
system-name="clienta"
billing-address-id="12345"
></spektrix-add-card>
Component Attributes
AttributeDescription
languageOptional. Language code for localisation (e.g. "fr"). Default is English.

API Endpoints

The following endpoints can be used to view and manage cards in a customer's wallet.

GET /v3/customer/stored-cards?includePending={includePending}
DELETE /v3/customer/stored-cards/{cardId}