Read

Initialize Subs Client

import { SubsSDK, PaymentType, PeriodType, SubsPayment, Keypair } from 'subs-sdk';

// Initialize with wallet private key (keep this secure!)
const subsClient = new SubsSDK("YOUR_WALLET_PRIVATE_KEY", "testnet"); // "testnet" or "mainnet"

Get Payments IDs

await subsClient.get_app_payments(
  appId,        // BigInt
);

It will return the list of Payments ID in side one particular App.

Get User Subscriptions

await subsClient.get_user_subscriptions(
  userAdress,        // String
);

It will return a list of Subscription IDs for one particular User.

Get Subscription

await subsClient.get_subscription(
  subsId,        // String
);

It will give you all the data concerning a particular Subscription.

Get App Subscribers

await subsClient.get_app_subscribers(
  appId,        // BigInt
  paymentId,    // String
);

It will return a list of User subscribed to a particular Payment of an App.

Get App Subscriptions

await subsClient.get_app_subscriptions(
  appId,        // BigInt
);

It will return a list of Subscription IDs for a particular App.

Get Already Subscribed

await subsClient.get_already_subscribed(
  appId,        // BigInt
  user,         // String
);

It will return a boolean if the User is subscribed to an App.

Get Canceled Subscription

await subsClient.get_cancel_subscription(
  subs_id,      // String
);

It will give you a boolean if the User has canceled his Subscription.

Last updated