Skip to content

Getting Started for Developers

Subscrypts offers three integration paths, from drop-in React components to raw ABI calls. Choose the one that fits your stack.


Network & Contract Details

Parameter Value
Network Arbitrum One (Chain ID 42161)
RPC https://arb1.arbitrum.io/rpc
Block Explorer arbiscan.io
Subscrypts Proxy 0xE2E5409C4B4Be5b67C69Cc2C6507B0598D069Eac
SUBS Token 0xE2E5409C4B4Be5b67C69Cc2C6507B0598D069Eac (same as proxy)
USDC 0xaf88d065e77c8cC2239327C5EDb3A432268e5831
ABI Download subscryptsABI-v1.json

Full address registry

See Deployment & Network Information for the complete contract address registry including all facets, vesting, and DEX addresses.


The fastest way to add subscriptions to a React app. The SDK provides hooks, components, and wallet connectors out of the box.

Install

npm install @subscrypts/subscrypts-sdk-react ethers

Wrap Your App

App.tsx
import { SubscryptsProvider } from '@subscrypts/subscrypts-sdk-react';

function App() {
  return (
    <SubscryptsProvider>
      <YourApp />
    </SubscryptsProvider>
  );
}

Check Subscription Status

PremiumContent.tsx
import { useSubscriptionStatus } from '@subscrypts/subscrypts-sdk-react';

function PremiumContent({ planId }: { planId: string }) {
  const { isActive, isLoading } = useSubscriptionStatus(planId);

  if (isLoading) return <p>Checking subscription...</p>;
  if (!isActive) return <p>Subscribe to access this content.</p>;

  return <div>Welcome, premium member!</div>;
}

Gate Content with a Component

Paywall.tsx
import { SubscriptionGuard } from '@subscrypts/subscrypts-sdk-react';

function App() {
  return (
    <SubscriptionGuard planId="42" fallbackUrl="/subscribe">
      <PremiumDashboard />
    </SubscriptionGuard>
  );
}

For the complete SDK reference, see the SDK Documentation.


Path B: Direct ABI + ethers.js

For non-React apps or when you need full control.

Setup

setup.js
import { ethers } from 'ethers';
import subscryptsAbi from './subscryptsABI-v1.json';

const provider = new ethers.JsonRpcProvider('https://arb1.arbitrum.io/rpc');
const contractAddress = '0xE2E5409C4B4Be5b67C69Cc2C6507B0598D069Eac';
const subscrypts = new ethers.Contract(contractAddress, subscryptsAbi, provider);

Read Plans

read-plans.js
const plans = await subscrypts.getPlans(0n, 10n);

for (const plan of plans) {
  console.log(`Plan ${plan.id}: ${plan.subscriptionAmount} per ${plan.paymentFrequency}s`);
}

Check a Subscription

check-subscription.js
const sub = await subscrypts.getPlanSubscription(planId, subscriberAddress);

const isActive = sub.nextPaymentDate > BigInt(Math.floor(Date.now() / 1000));
console.log(`Subscription active: ${isActive}`);

Create a Subscription (with signer)

subscribe.js
const signer = new ethers.Wallet(privateKey, provider);
const contract = subscrypts.connect(signer);

const tx = await contract.subscriptionCreate(planId);
const receipt = await tx.wait();

console.log(`Subscribed! TX: ${receipt.hash}`);

For the full ABI reference, see ABI & Developer Reference.


Path C: Event Listening (Backend Integration)

Listen for on-chain events to automate access control, notifications, or fulfillment in your backend.

Key Events

Event When It Fires
_subscriptionCreate New subscription created
_subscriptionPay Payment processed (initial or renewal)
_subscriptionStop Subscription expired or failed renewal
_subscriptionRecurring Auto-renewal toggled on/off
_planCreate New plan created

Listen for Payments

event-listener.js
subscrypts.on('_subscriptionPay', (subscriptionId, planId, subscriber, amount) => {
  console.log(`Payment: sub=${subscriptionId}, plan=${planId}, from=${subscriber}, amount=${amount}`);

  // Grant access, send notification, update database, etc.
});

Listen for Expirations

expiry-listener.js
subscrypts.on('_subscriptionStop', (subscriptionId, merchant, planId, subscriber) => {
  console.log(`Expired: sub=${subscriptionId}, subscriber=${subscriber}`);

  // Revoke access, send reminder, etc.
});

Quick Reference: Key Functions

Read-Only (no gas, no signer)

Function Returns
getPlans(start, end) Array of Plan structs
getPlan(planId) Single Plan struct
getSubscription(subId) Single Subscription struct
getPlanSubscription(planId, subscriber) Subscription for a specific user on a plan
getSubscriptionsByAddress(address, start, end) All subscriptions for a wallet
getSubscriptionsByPlan(planId, start, end) All subscriptions for a plan

Write Operations (requires signer)

Function Purpose
planCreate(currency, amount, frequency, description, attributes, referralBonus) Create a new subscription plan (costs ETH)
subscriptionCreate(planId, ...) Subscribe to a plan (burns SUBS)
subscriptionRecurringCHG(subId, enabled, cycles) Toggle auto-renewal
subscriptionGift(planId, subscriber, ...) Gift a subscription
paySubscriptionWithUsdc(planId, ...) Pay with USDC (Permit2 + Uniswap swap)

For full function signatures and parameters, see the ABI Reference.


What's Next?