SellubSDKssellub-react-native

@duabalabs/sellub-react-native

React Native bindings for sellub-client. Mirrors the sellub-react hook surface today; mobile-specific primitives (AsyncStorage caching, deep-link handling for Paystack callbacks) land in v0.2.

npm

Install

pnpm add @duabalabs/sellub-react-native @duabalabs/sellub-client react react-native

useSubscription

import { useSubscription } from "@duabalabs/sellub-react-native";
import { createSellubClient } from "@duabalabs/sellub-client";
 
const sellub = createSellubClient({
  baseUrl: "https://api.sellub.com",
  publishableKey: "pk_live_…",
});
 
export function PremiumScreen({ email }: { email: string }) {
  const sub = useSubscription({
    appId: "duabanti",
    email,
    client: sellub, // or any client with .checkSubscription
  });
 
  if (sub.loading) return <ActivityIndicator />;
  return sub.active ? <PremiumContent /> : <PaywallScreen />;
}

Paystack redirect handling

The callback from Paystack is a plain HTTPS URL. Open it in the system browser via Linking.openURL(start.authorizationUrl), then catch the redirect with React Navigation’s deep-link config and call sellub.externalPayments.verify(reference) on the resulting screen.

// app/payments/[reference].tsx
const { reference } = useLocalSearchParams<{ reference: string }>();
const result = await sellub.externalPayments.verify(reference);

Roadmap (v0.2+)

  • AsyncStorage-backed subscription cache so useSubscription returns the last known state instantly while it re-checks in the background.
  • useSellubCheckout — wraps redirect + verify into one hook.
  • React Native specific examples for Expo Router and bare RN setups.