Web2 Bridge
Round up fiat and traditional payments into crypto investments via the REST API.
Overview
Not every payment happens on Solana. The Web2 Bridge lets you record round-ups from fiat transactions — credit card purchases, Stripe payments, invoices — and accumulate them in a Buff wallet for auto-investment into crypto.
REST API Approach
Send a POST request to the round-up endpoint with the transaction value. Buff calculates the round-up and records it against the API key's associated wallet.
1curl -X POST https://sow-beryl.vercel.app/api/roundup \2 -H "Content-Type: application/json" \3 -H "x-api-key: your-key" \4 -d '{"txValueUsd": 4.73, "plan": "sprout"}'The response includes the round-up breakdown:
1{2 "roundUpUsd": 0.27,3 "userInvestmentUsd": 0.2679,4 "buffFeeUsd": 0.0021,5 "accumulatedUsd": 3.42,6 "thresholdUsd": 5.00,7 "skipped": false8}API Parameters
| Field | Type | Description |
|---|---|---|
| txValueUsd | number | The fiat transaction amount in USD |
| plan | string | Round-up plan: "sprout", "growth", or "oak" |
| source | string | Optional tag (e.g. "stripe", "shopify") |
| userId | string | Optional user identifier for multi-user platforms |
Stripe Webhook Pattern
The most common Web2 integration is listening for Stripe payment events and recording round-ups for each successful charge.
1import Stripe from "stripe"23// In your webhook handler (e.g. /api/webhooks/stripe)4export async function POST(req: Request) {5 const event = stripe.webhooks.constructEvent(6 await req.text(),7 req.headers.get("stripe-signature")!,8 process.env.STRIPE_WEBHOOK_SECRET!,9 )1011 if (event.type === "charge.succeeded") {12 const charge = event.data.object as Stripe.Charge13 const amountUsd = charge.amount / 1001415 // Record the round-up via Buff REST API16 await fetch("https://sow-beryl.vercel.app/api/roundup", {17 method: "POST",18 headers: {19 "Content-Type": "application/json",20 "x-api-key": process.env.BUFF_API_KEY!,21 },22 body: JSON.stringify({23 txValueUsd: amountUsd,24 plan: "sprout",25 source: "stripe",26 userId: charge.customer as string,27 }),28 })29 }3031 return new Response("ok")32}Use Cases
- –E-commerce: round up every Stripe/Shopify checkout into BTC savings
- –SaaS: round up subscription payments for your users automatically
- –Invoicing: round up freelancer payments when invoices are paid
- –POS systems: round up in-store purchases via your payment processor webhook
Fiat On-Ramp with Changelly
Users can fund their Buff wallet directly with fiat currency using Changelly. No business entity required — just create an account and embed. Users buy SOL with credit card, it deposits directly into their Buff wallet. From there, round-ups auto-invest into chosen assets.
1// Generate a Changelly buy link for a user's Buff wallet2const buyUrl = "https://changelly.com/buy/sol?to=" + buffWalletAddress;34// Open in new tab or embed5window.open(buyUrl, "_blank");Email Signup Flow
For users who don't have a Solana wallet yet, the Buff Dashboard supports an email-based signup flow. Users provide their email address, and a Buff wallet is derived deterministically from their credentials. Once signed up, they can fund via MoonPay and start accumulating round-ups immediately — no browser extension or seed phrase required.
- –User enters their email on the Buff signup page
- –A unique Buff wallet is derived and associated with the account
- –User funds the wallet using the MoonPay on-ramp widget
- –Round-ups accumulate and auto-invest into BTC, ETH, or other assets
- –The wallet private key can be exported at any time to a standard Solana wallet