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.
Install the Supersub SDK using npm:
npm install supersub
Or using yarn:
yarn add supersub
To integrate the Supersub SDK into your React application, follow these steps:
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>
);
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;
Replace the apiKey
, productId
, and defaultPlanId
with your actual product and plan identifiers and your Supersub API key to configure the subscription settings.
- 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
Love using Supersub? You can show your support by starring the repo.
Don't forget to follow me on twitter.
Thanks! - Kester A.
This project is licensed under the MIT License - see the LICENSE.md file for details
Thank you for choosing Supersub โจ