Skip to main content

CoinFlow Setup Guide

Get started with CoinFlow integration in under 10 minutes.

Prerequisites

  • A HedgePayments account
  • Node.js 18+ installed
  • Basic understanding of React/Next.js

Step 1: Create CoinFlow Account

  1. Visit coinflow.cash
  2. Click “Get Started” or “Sign Up”
  3. Complete the registration form
  4. Verify your email address

Step 2: Get Your Credentials

Sandbox Credentials (for testing)

  1. Log into your CoinFlow dashboard
  2. Navigate to Settings → API Keys
  3. Copy your sandbox credentials:
    • Merchant ID
    • API Key
    • Webhook Secret

Production Credentials (for live payments)

  1. Complete merchant verification (KYC)
  2. Navigate to Settings → API Keys → Production
  3. Generate and copy production credentials
Never commit API keys to version control. Always use environment variables.

Step 3: Configure Environment Variables

Create a .env.local file in your project root:

Step 4: Install Dependencies

Install the CoinFlow React SDK:
Or with yarn:

Step 5: Create Payment Component

Create a new component components/CoinflowPayment.tsx:

Step 6: Create API Endpoint

Create an API route app/api/payments/create/route.ts:

Step 7: Set Up Webhooks

Configure Webhook URL

  1. In your CoinFlow dashboard, go to Settings → Webhooks
  2. Add your webhook URL: https://yourdomain.com/api/webhooks/coinflow
  3. Select events to subscribe to:
    • payment.completed
    • payment.failed
    • payment.refunded

Create Webhook Handler

Create app/api/webhooks/coinflow/route.ts:

Step 8: Test Your Integration

Using Sandbox

  1. Start your development server:
  1. Navigate to your payment page
  2. Use test credentials:

Test Payment Flow

  1. Create a test payment
  2. Complete the CoinFlow widget
  3. Verify webhook is received
  4. Check payment status in database

Step 9: Go to Production

Before Launch Checklist

  • Complete CoinFlow merchant verification
  • Switch to production API keys
  • Update environment variables
  • Test production webhook endpoint
  • Set up error monitoring
  • Configure payment success/failure pages
  • Review transaction limits

Production Environment

Update your production environment variables:

Common Issues

Payment Widget Not Loading

Issue: Widget shows loading spinner indefinitely Solution:
  • Verify NEXT_PUBLIC_COINFLOW_MERCHANT_ID is set
  • Check browser console for errors
  • Ensure environment matches (sandbox/production)

Webhook Not Receiving Events

Issue: Payments succeed but webhooks never arrive Solution:
  • Verify webhook URL is publicly accessible
  • Check webhook signature validation logic
  • Review CoinFlow dashboard webhook logs

CORS Errors

Issue: Cross-origin errors in browser Solution:

Next Steps

Need Help?