What This Covers
This document details the autonomous crypto payment onboarding system built for ZHC Institute Core memberships. The system handles end-to-end member onboarding — from transaction confirmation to Discord access delivery — without human intervention.
The infrastructure demonstrates a core principle of zero-human companies: revenue-generating workflows that self-execute, self-verify, and self-deliver.
The Problem
Traditional membership onboarding requires human coordination at multiple points:
- Payment confirmation and transaction verification
- Member identity collection (email, preferences)
- Access credential generation (Discord invites, account creation)
- Welcome communication delivery
- Internal team notification
- Exception handling when things go wrong
Each point introduces latency, potential failure, and operational overhead. For a zero-human company targeting $1B impact, this dependency is unacceptable.
The Solution
An autonomous onboarding pipeline that executes the entire workflow — from payment to access delivery — in under 30 seconds with zero human touch.
Architecture Overview
- Payment Layer: Crypto payment via Base Pay (USDC) or JUNO token transfer
- Trigger Layer: onSuccess callback initiates modal display
- Data Collection: Email capture via MemberOnboardingModal
- Orchestration API: /api/membership/onboard processes request
- Access Generation: Discord bot creates single-use invite (24h expiry)
- Delivery: AgentMail sends styled welcome email with invite link
- Notification: Admin receives confirmation with transaction details
Technical Implementation
Payment Components
PayWithBaseButton — Integrates @base-org/account SDK for USDC payments on Base network. Handles wallet connection, chain switching, and payment modal.
PayWithJunoButton — Custom implementation using wagmi/viem for JUNO token transfers. Fetches real-time JUNO price, calculates token amount with 1% buffer, executes ERC-20 transfer.
Success Handling
Both components expose an onSuccess callback prop triggered on transaction confirmation. The callback receives:
txHash— On-chain transaction hash for verificationamount— Payment amount in USD
Onboarding Modal
The MemberOnboardingModal captures member email and displays payment confirmation details. Features include:
- Transaction hash display (truncated for readability)
- Payment method and amount confirmation
- Support email links for troubleshooting (juno@zhcinstitute.com)
- Success state with email confirmation
API Route: /api/membership/onboard
Serverless function that orchestrates the onboarding workflow:
POST /api/membership/onboard
Body: {
email: string,
txHash: string,
paymentMethod: 'base' | 'juno',
amount: string
}Discord Invite Generation
Uses Discord Bot API to create single-use invites with 24-hour expiry:
POST https://discord.com/api/v10/channels/{channel_id}/invites
{
max_uses: 1,
max_age: 86400,
unique: true
}Fallback Handling
If Discord Bot API fails (token expired, permissions issue, rate limit), the system falls back to a configured invite link (DISCORD_FALLBACK_INVITE). The email template adapts:
- Bot invite: "Expires in 24 hours, single-use"
- Fallback: "Reply to this email if the link expires"
Email Delivery
AgentMail API sends styled HTML welcome emails with:
- Payment confirmation details
- Discord invite CTA button
- Membership benefits list
- Reply-to support contact
Admin Notification
Parallel email sent to admin with:
- Member email address
- Transaction hash for verification
- Discord invite link used
- Invite type indicator (bot-generated vs fallback)
Security & Reliability
Transaction Verification
While the flow trusts the onSuccess callback from payment components, the txHash is logged and can be verified on-chain. Admin notifications include the hash for manual audit if needed.
Error Handling
Each external dependency has fallback behavior:
- Discord API failure: Use fallback invite link
- Email send failure: Log error, don't fail request
- Network errors: Show user-friendly error with support email
Human Escalation Points
Support email (juno@zhcinstitute.com) is exposed at multiple points:
- Error state in modal
- Footer of email capture form
- Success state if email not received
- Welcome email reply-to address
Integration with ZHC Operations
This onboarding system exemplifies the zero-human company thesis: revenue generation, access control, and member services operating autonomously.
P&L Autonomy
Revenue settles directly to designated wallets. Expenses (Discord API, AgentMail, infrastructure) are paid programmatically. No human accounts receivable or payable.
Scalability
The system handles one signup or one thousand identically. No operational burden increases with volume — the defining characteristic of zero-human infrastructure.
Observability
Admin notifications provide visibility without requiring action. The founder receives confirmation of each signup but doesn't need to process anything manually.
Future Enhancements
- Auto-role assignment: Discord bot assigns "Core" role on join
- Welcome DM: Automated orientation message from Juno
- CRM integration: Automatic member profile creation
- Analytics: Conversion tracking, cohort analysis
- Multi-tier: Support for Pioneer, Alpha, Core membership levels
Last Updated: 2026-02-17
Status: Production
Payment Methods: Base Pay (USDC), JUNO Token