Overview
| Integration | Purpose | Where used |
|---|---|---|
| Solana | SOL payments, Phantom/AppKit, transaction verification | lib/solana.ts, lib/solana-client.ts, PaymentForm, /api/payment, /api/execute |
| Dodo | Card/UPI checkout, webhooks, confirm-payment | /api/dodo/create-checkout, /api/dodo/webhook, /api/dodo/confirm-payment |
| GitHub | OAuth, create repo, push project files | /api/github/authorize, /api/github/callback, /api/github/upload |
| OpenRouter | AI (Idea, Intent, Platform, Execute) | lib/openai.ts |
1. Solana Integration
Flow
- Client: Get agentAddress (Treasury) from
GET /api/payment/config - Client: Call
POST /api/paymentwith sessionId, selectedPlatform, userWalletPubKey → server runs validatePayment; on success, client builds and signs the transaction - Client: createPaymentTransaction(from, to, amount) from lib/solana-client (SPL or SOL fallback), sign via AppKit/Phantom,
connection.confirmTransaction(signature, 'confirmed') - Client: Call
POST /api/executewith{ sessionId, transactionSignature }→ server runs verifyTransaction then executes
Client: build and send payment (React)
Server: validate and verify (lib/solana.ts)
createPaymentTransaction (SPL vs SOL)
- SPL: USE_SPL_TOKEN=true and mint set → createTransferInstruction from user ATA to treasury ATA
- SOL fallback: SystemProgram.transfer with lamports derived from amount
2. Dodo Payments Integration
Flow
- Create checkout:
POST /api/dodo/create-checkout→ get checkout_url - Redirect: user pays on Dodo
- Webhook: Dodo POST to
/api/dodo/webhook; handler verifies signature and updates Workflow - Optional: call
POST /api/dodo/confirm-paymentif webhook is delayed - Execute:
POST /api/executewith{ sessionId }
Client: create checkout and redirect
Server: create checkout
Webhook: signature verification
Confirm-payment (fallback)
POST /api/dodo/confirm-payment- Updates Workflow: paymentMethod, paymentId, currentStage, selectedPlatform
3. GitHub Integration
Flow
- Authorize:
GET /api/github/authorize?sessionId=... - Callback:
GET /api/github/callback?code=...&state=... - Upload:
POST /api/github/upload→ create repo and push files
OAuth: authorize
OAuth: callback
- Verify state
- Exchange code for token
- Fetch user
- Set cookies
- Redirect to Execution
Upload: create repo and push files
Client: start OAuth
4. OpenRouter Integration
Where it’s used
- Idea: processIdea
- Intent: refineIntent
- Platform: selectPlatform
- Execute: executeX402Workflow
callOpenRouter
createChatCompletion (internal)
Model and key mapping
| Model | Env key | Model ID (env override) |
|---|---|---|
| GROK | OPENROUTER_API_KEY_GROK4 | GROK4_MODEL |
| QWEN | OPENROUTER_API_KEY_QWEN3 | QWEN3_MODEL |
| GEMINI | OPENROUTER_API_KEY_GEMINI2_5 | GEMINI2_5_MODEL |