Developer workspace

Referral rewards, built into checkout.

Integrate one shared referral identity across your app. The existing ViralKit client handles code resolution and ERC-20 approval plus purchase transactions.

NetworkMonad Testnet · chain 10143Test assets have no real-world value.
ReferralHub0xf8B23407977e7d741dD4cc8ed8De871117eA307aConfigured in this environment
Payment token0xa9012a055bd4e0eDfF8Ce09f960291C09D5322dCAUSD test token
01 · Initialize

Connect the shared client.

Pass the viem public client and connected wallet client from your app.

// Local SDK source; not published to npm yet.
import { createViralKitClient } from "~~/lib/viralkit";

const viralKit = createViralKitClient({ publicClient, walletClient });
Read SDK guide →
02 · Settle

Purchase with attribution.

Referral codes resolve onchain. The contract splits payment only after a successful campaign purchase.

const hash = await viralKit.purchaseWithReferral(campaignId, referralCode);
const receipt = await publicClient.waitForTransactionReceipt({ hash });
if (receipt.status !== "success") throw new Error("Purchase failed");
const hasAccess = await viralKit.hasPurchased(campaignId, buyerAddress);
Campaign setup

Create a live campaign onchain.

Configure price, AUSD token, metadata, and referral share from the campaign workspace.

Open campaign workspace ↗

Referral identity

A registered code can travel across your participating apps. Pass it as a `ref` query parameter in a share link, then submit it with the campaign purchase.

import { zeroAddress } from "viem";

const referrer = await viralKit.resolveReferralCode(referralCode);
if (referrer !== zeroAddress) {
  // Pass referralCode to purchaseWithReferral after user confirmation.
}