Skip to content

Cross-chain crypto subscription platform powered by Alchemy's account abstraction infrastructure and Chainlink's Cross-Chain Interoperability Protocol.

License

Notifications You must be signed in to change notification settings

codergon/supersub-sdk

Repository files navigation

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

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

  1. Fork it!
  2. Create your feature branch: git checkout -b feature-name
  3. Commit your changes: git commit -am 'Your commit message'
  4. Push to the branch: git push origin feature-name
  5. 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 ✨

About

Cross-chain crypto subscription platform powered by Alchemy's account abstraction infrastructure and Chainlink's Cross-Chain Interoperability Protocol.

Topics

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published