๐Embeds
The most simple and intuitive way to integrate SellSN with your existing website
What are embeds?
Embeds are a essentially a system that allows you to embed the SellSN payment system right into your website with minimal code or effort. You can make a button that opens a modal that automatically allows your customers to sign-in and purchase a product - all in one window.
The embed system does not work with the button HTML tag automatically on most JavaScript frameworks like Next.js, React, Svelte, Angular, etc. Follow the 'Advanced integration' section to find out how to work with the embed system.
Integrating the system
Integrating the embeds system is as simple as 1, 2, 3 (and four). Follow the below steps to get started.
First, we need to get the code snippet from the product you wish to embed. The embed system works for any product on your store, but you need a button that can trigger it to open. Head over to the 'Edit product' page on the SellSN dashboard.
Then, head over to the 'Embeds' section on the bottom of the page, you can then find the code snippet to embed that specific product on your website.
The following attributes can be applied to any button on the same page, you do not need to import the script multiple times.
Attribute | Type | Description |
---|---|---|
| UUID (required) | The ID of the store that the given product ID belongs to |
| UUID (required) | The ID of the product that should be embedded |
| Email (optional) | The email address to autofill on the embed, this is useful when using the system beside an existing login system |
You can use classes, styles and any usual system except Javascript click handlers as they may override the click handler registered for qualifying buttons on the page load.
Advanced integration
This section details how to integrate the embeds system without the button binding system (the attributes system detailed above), this is best suited for advanced applications that don't use typical HTML/CSS/JS stacks and rather use JS frameworks like Next.js, React, Svelte or Angular.
Here is a list of JavaScript APIs that you can use to still leverage the same beautiful and simple embed modal system:
Function | Arguments | Description |
---|---|---|
| None | Initializes the SellSN modal system, must be called first before any other function is called. By default this is ran on load, but with some JavaScript frameworks it may need to be manually called. |
|
| Opens the SellSN embed modal, when this function is used instead of the data attributes the arguments are required. The email is optional and either the productId or groupId must be specified. |
| None | Closes the open SellSN modal. |
Example
Here is a simple example with some common JavaScript frameworks of all theses functions.
Content Security Policy (CSP)
The SellSN embedding system is fully usable with a CSP setup. You can use the following directives to configure your CSP to work with the system.
Last updated