The Javascript SDK can be used for a simple, lightweight integration, but it also includes an in-context mode which will host the Sezzle checkout in a modal iframe or pop-up window.
Checkouts
Create checkouts and capture payments with Sezzle.
Integrations
Checkout in an iframe, pop-up window, or redirect to Sezzle.
Payments
Handle payment success, failure, or cancel with your Sezzle orders.
If you use iframe mode, add *.sezzle.com to your site’s Content Security Policy (CSP) allowlist so the Sezzle checkout iframe can load.
popup (recommended): works out of the box for most browser-based SDK integrations.
iframe: required when popups are blocked (e.g. inside a webview or embedded browser). Sezzle must enable iframe for your domain(s) first — submit your Merchant UUID and the domains to allow per environment (sandbox and production). For example: please enable uat1.mysite.com, uat2.mysite.com in sandbox and www.mysite.com, mysite.com in production.
redirect: supported but generally less useful with the SDK, since the SDK’s value is the in-context checkout and window messaging.
This section covers how to present Sezzle as a payment method at checkout. Depending on your webpage’s design, you might wish to display Sezzle as an alternative payment method (APM) button, a radio option in a list of payment methods, and/or as an alternative submission button. Below are some examples of how to implement the front-end component.
If you wish to use a different design from the options displayed below, please refer to our Co-Branded Guidelines for Approved Messaging and Sezzle logo acceptable use.
The button option is available as a component of this SDK library. It is comprised of two parts: the configurable element plcaeholder and the render function.
Place the element snippet from the Template tab where you wish the Sezzle Button to be rendered on the page, then update the Options attributes as needed.
Image
Template
Example
Options
Sezzle as a button alongside other APMs
Sezzle as a Submit button as alternative to default button
The theme corresponds to your site’s background color. If theme: dark, the button will be white with dark text. Else, the button will be dark purple with white text.Available options: dark, light
Add the following function to render the button when it is appropriate, such as when payment methods section loads, or when Sezzle is selected as a payment method. The parameter corresponds to the element created in the previous step.
The SDK uses these event handlers to tell your site what’s happening in the checkout. Implement each one to react to shopper actions like completing, cancelling, or running into an error.
Template
Example
Options
checkoutSdk.init({ onClick: function () { event.preventDefault(); checkoutSdk.startCheckout({...}); }, onComplete: function (response) { console.log(response.data); }, onCancel: function () { console.log("Checkout cancelled."); }, onFailure: function () { console.log("Checkout failed."); },});
The startCheckout method should be implemented in the checkout onClick handler. There are two ways to start checkout:
With a checkout payload — pass the full session object inline (shown above). The cancel and complete URLs are optional for iframe and popup mode.
With an existing checkout URL — call startCheckout({ checkout_url }). The SDK mode must match the checkout_mode you used when creating the session. For iframe and popup, include the parent window’s origin in the cancel and complete URLs.
Customer Tokenization: the customer UUID isn’t delivered through onComplete. To receive it, subscribe to the customer.tokenized webhook event.
function onCompleteHandler(event) { var data = event.data || Object.create(null); console.log("session data:", data.session_uuid, data.order_uuid);}checkout.init({ onComplete: onCompleteHandler,});
function onCompleteHandler(event) { var data = event.data || Object.create(null); console.log("checkout data:", data.checkout_uuid);}checkout.init({ onComplete: onCompleteHandler,});
The capture payment method requires two parameters, the order_uuid and the payload as detailed in the Capture Amount By Order Object.
The capturePayment request body mirrors the Capture by Order request body. See that reference document for the full list of fields, types, and constraints.
This function will provide the installment details based on an amount in cents. An existing checkout can be used, or a checkout without any configuration can also be used to quickly get installment details.