Build your first payment integration

This quickstart guide will walk you through setting up FundKit and processing your first payment in just a few minutes.
Prerequisites: Node.js 16+ and npm/yarn/pnpm/bun installed on your machine.

Step 1: Install FundKit

Install the core package and your chosen providers:
npm install @fundkit/core @fundkit/honeycoin @fundkit/easypay

Step 2: Get API Keys

Get API keys from your chosen providers: HoneyCoin: - Sign up at honeycoin.io - Get your API key and public key from the dashboard EasyPay: - Register at easypay.ug - Obtain your client ID and API secret

Step 3: Initialize the Payment Client

Create a new file payment.js (or payment.ts for TypeScript):
import { PaymentClient } from '@fundkit/core';
import { HoneyCoin } from '@fundkit/honeycoin';
import { EasyPay } from '@fundkit/easypay';

// Initialize providers
const honeycoin = new HoneyCoin({
  apiKey: process.env.HONEYCOIN_API_KEY!,
  publicKey: process.env.HONEYCOIN_PUBLIC_KEY!,
});

const easypay = new EasyPay({
  apiKey: process.env.EASYPAY_SECRET!,
  clientId: process.env.EASYPAY_CLIENT_ID!,
});

// Create payment client
const client = new PaymentClient({
  apiKey: process.env.FUNDKIT_API_KEY!,
  providers: [honeycoin, easypay],
  environment: 'sandbox',
});

export default client;

Step 4: Process Your First Payment

import client from './payment';

async function processPayment() {
  try {
    // Create a payment collection
    const result = await client.collection({
      amount: 10000, // Amount in smallest currency unit (10,000 = 100.00 UGX)
      currency: 'UGX',
      operator: 'mtn',
      accountNumber: '+256701234567',
      externalId: 'tx_' + Date.now(),
      reason: 'Test payment from FundKit'
    });

    console.log('Payment initiated:', {
      provider: result.provider,
      transactionId: result.data.transactionId,
      status: result.data.status
    });

    // Check payment status
    const status = await client.getTransaction({
      provider: result.provider,
      txId: result.data.transactionId,
    });

    console.log('Payment status:', status?.data.status);

  } catch (error) {
    console.error('Payment failed:', error.message);
  }
}

processPayment();

Step 5: Run Your Integration

Set up your environment variables in a .env file:
.env
FUNDKIT_API_KEY=fk_test_your_sandbox_key_here
HONEYCOIN_API_KEY=your_honeycoin_api_key
HONEYCOIN_PUBLIC_KEY=your_honeycoin_public_key
EASYPAY_SECRET=your_easypay_secret
EASYPAY_CLIENT_ID=your_easypay_client_id
Then run your code:
node payment.js
# or for TypeScript:
npx tsx payment.ts

Success!

You should see output similar to:
Payment initiated: {
  provider: 'honeycoin',
  transactionId: 'txn_abc123xyz',
  status: 'pending'
}
Payment status: completed

Next Steps

Important: Always use sandbox mode for testing. Switch to production mode only when you’re ready to process real payments.

Need Help?

Join our Discord Community

Get help from other developers and the FundKit team