supersub
v0.0.34
Published
Supersub JS Sdk
Downloads
7
Maintainers
Readme
Supersub SDK
Welcome to the Supersub SDK documentation. Supersub is a cross-chain crypto subscription platform powered by Alchemy's account abstraction infrastructure and Chainlink's Cross-Chain Interoperability Protocol. This SDK allows you to seamlessly integrate crypto-based subscriptions into your React applications.
Demo
Installation
Install the Supersub SDK using npm:
npm install supersub
Or using yarn:
yarn add supersub
Setup
To integrate the Supersub SDK into your React application, follow these steps:
1. Wrap your application with SuperSubProvider
In your main entry file (usually index.tsx
), import and set up the SuperSubProvider
around your application component. This enables all child components to access the Supersub functionality via React context.
import React from "react";
import ReactDOM from "react-dom/client";
import App from "./App";
import "./index.css";
import { SuperSubProvider } from "supersub";
const root = ReactDOM.createRoot(document.getElementById("root")!);
root.render(
<React.StrictMode>
<SuperSubProvider>
<App />
</SuperSubProvider>
</React.StrictMode>
);
2. Use the useSuperSub
hook
In your components, utilize the useSuperSub
hook to access the openSubscription
method. This method triggers the subscription process.
import { useSuperMeta } from "supersub";
function App() {
const { openSubscription } = useSuperSub();
return (
<>
<h1>Supersub Subscription Demo</h1>
<div className="card">
<button
onClick={() =>
openSubscription({
productId: 10,
defaultPlanId: 13,
apiKey: "pk_your_api_key_here",
})
}
>
Pay with Supersub
</button>
</div>
</>
);
}
export default App;
Configuration
Replace the apiKey
, productId
, and defaultPlanId
with your actual product and plan identifiers and your Supersub API key to configure the subscription settings.
Contributing
- Fork it!
- Create your feature branch:
git checkout -b feature-name
- Commit your changes:
git commit -am 'Your commit message'
- Push to the branch:
git push origin feature-name
- Submit a pull request
Show Your Support
Love using Supersub? You can show your support by starring the repo.
Don't forget to follow me on twitter.
Thanks! - Kester A.
License
This project is licensed under the MIT License - see the LICENSE.md file for details
Thank you for choosing Supersub ✨