Superfluid Checkout Widget
Using the Superfluid Checkout Widget for Web3-Native Subscriptions
NOTE: the checkout widget is in open alpha and is subject to change. We are iterating quickly and are open to feedback!
What is the Superfluid Checkout Widget?
The Superfluid Checkout Widget demonstrates a clean pattern for subscription UX in web3 using Superfluid, including all the core web3 interactions needed. Here are some highlights:
It is minimally-opinionated and uses the most up to date web3 front end tooling
It supports all Superfluid tokens and networks by default
It automatically becomes a 1-click checkout if a payer already holds Super Tokens
It can be styled as a widget, a full page view, or a modal itself
Fonts, shapes, colors are all customizable
The widget is meant to be imported into existing Wagmi front ends using a React or Vue component. You can import the widget library, include JSON that defines your widget’s behavior in the props of the subscription checkout component, and your widget will behave as expected. You can create your own custom JSON with our no code widget builder:
Building Your Own Custom Checkout Widget
Note: if you're looking to get started quickly, check out the examples below which will work with Web3Modal or RainbowKit.
To implement your checkout widget, you'll need to install the widget library, wagmi, and the Superfluid token list from your favorite package manager:
You can then import the widget into the component you'd like to render it in
Before you include the widget in your file, you'll need to generate a Widget JSON that you'll pass as a prop to the widget component. This Widget JSON specifies most of your widget's properties, and you can use our hosted, no code widget builder to visually see what your widget will look like. You can find the widget builder here.
Once you have your JSON, you add the file to your project, import it, and use the javascript spread operator to pass it as props to your widget component. See {...data}
here:
You'll also need a few more props:tokenList
, type
, and walletManager.
The tokenList
allows the widget to support all listed Super Tokens. You should have the Superfluid token list already installed it if you used the above npm or yarn commands! You'll just need to include it as a prop like this:
tokenList={superTokenList}
The type
prop allows us to specify what kind of widget we want to create. We have a few supported types:
drawer
dialog
full-screen
Finally, the walletManager
prop is necessary to ensure that the widget works properly with wallet connection libraries such as RainbowKit, Web3Modal, & more. It is recommended that you use the useMemo
hook from react to set the walletManager
variable & associated prop:
Checkout Widget Examples
All examples can be found in this repo.
RainbowKit Example:
Web3Modal Example:
IPFS Hosted + Full Page Example:
Reference Documentation
Last updated
Was this helpful?