Merchant Quick Start

Get Started in 5 Minutes

Start accepting crypto payments with automatic KolayMiles rewards. Simple integration, powerful results.

1
Basic Setup
Install dependencies and configure your environment
# Install dependencies
npm install ethers axios

# Copy config template
cp .env.example .env
2
Environment Variables
Configure your BSC Testnet settings and merchant wallet
# BSC Testnet Configuration
FACILITATOR_ADDRESS=0x565a7Af88C3C00757a00098f3fcc6b8fB355c899
PAYMENTS_API_URL=http://localhost:8081
FACILITATOR_API_URL=http://localhost:8082
USDC_ADDRESS=0x64544969ed7EBf5f083679233325356EbE738930

# Your merchant wallet
MERCHANT_ADDRESS=YOUR_MERCHANT_WALLET_ADDRESS
3
Simple Payment Button
Add a payment button to your checkout page
import { ethers } from 'ethers';

export function PayWithKolayButton({ amount }: { amount: string }) {
  const handlePay = async () => {
    // 1. Connect wallet
    const provider = new ethers.BrowserProvider(window.ethereum);
    const signer = await provider.getSigner();
    const payer = await signer.getAddress();

    // 2. Get payment data
    const res = await fetch('http://localhost:8082/api/v1/prepare-payment', {
      method: 'POST',
      headers: { 'Content-Type': 'application/json' },
      body: JSON.stringify({
        payer,
        merchant: process.env.MERCHANT_ADDRESS,
        asset: process.env.USDC_ADDRESS,
        amount: ethers.parseUnits(amount, 18).toString()
      })
    });

    const { payment, oracle } = await res.json();

    // 3. Approve & Pay
    const erc20 = new ethers.Contract(
      process.env.USDC_ADDRESS,
      ['function approve(address,uint256) returns(bool)'],
      signer
    );

    await erc20.approve(process.env.FACILITATOR_ADDRESS, payment.amount);

    const facilitator = new ethers.Contract(
      process.env.FACILITATOR_ADDRESS,
      facilitatorABI,
      signer
    );

    const tx = await facilitator.payWithKolay(
      process.env.USDC_ADDRESS,
      payment.amount,
      process.env.MERCHANT_ADDRESS,
      `ORDER-${Date.now()}`,
      oracle.payload,
      oracle.signature
    );

    alert(`Payment sent! TX: ${tx.hash}`);
  };

  return <button onClick={handlePay}>Pay {amount} USDC</button>;
}
4
Test It
Start your local services and test the payment flow
# Start local services
npm run dev

# In browser console:
payButton.click()
Dashboard

Check Your Dashboard

Visit your merchant dashboard to track transactions and customer miles

Dashboard Access
View your transactions, miles earned by customers, and conversion stats

Visit: http://localhost:3001/merchant

Transactions

Miles Earned

Conversion Stats

Resources

Additional Resources

Need more help? Check out our comprehensive guides

Full Integration Guide
Complete step-by-step guide with API reference, security best practices, and advanced features
API Documentation
Complete API reference with examples and endpoint documentation

Example Use Cases

Perfect for various payment scenarios

E-commerce checkouts
Subscription payments
Digital goods
Services

Ready to Go Live?

Read the full integration guide for production setup, webhooks, and security best practices.

WhatsApp: +905447693163

Cookie Preferences

We use cookies to improve your experience. Strictly necessary cookies are always on. Others require your consent.

See our Cookie Policy for details.