Giter Site home page Giter Site logo

codergon / supersub-sdk Goto Github PK

View Code? Open in Web Editor NEW
1.0 1.0 1.0 439 KB

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

Home Page: https://www.npmjs.com/package/supersub

License: MIT License

JavaScript 1.59% TypeScript 88.09% SCSS 10.31%
account-abstraction passkeys privy subscription-payment viem wagmi

supersub-sdk's Introduction

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 โœจ

supersub-sdk's People

Contributors

codergon avatar

Stargazers

 avatar

Watchers

 avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.