Getting Started

This guide will walk you through the steps to set up your Kipay Payment Gateway account and process your first transaction.

Quick Start: Follow these steps to start accepting payments in minutes!

Step 1: Create an Account

To get started with Kipay, you need to create an account:

  1. Visit the login page and click on "Sign Up"
  2. Fill in your details to create an account
  3. Verify your email address
  4. Log in to your account

Step 2: Set Up a Payment Channel

Before you can accept payments, you need to set up at least one payment channel:

  1. Go to Payment Channels in the admin dashboard
  2. Click on Add New Channel
  3. Select a payment provider (e.g., Paystack, Flutterwave, Stripe)
  4. Enter your API keys and other required information
  5. Save the channel
Note: You will need to create an account with your chosen payment provider and obtain API keys from them.

Step 3: Get Your API Keys

To integrate Kipay with your application, you need your API keys:

  1. Go to Settings in the admin dashboard
  2. Navigate to the API Keys tab
  3. Copy your API key (keep it secure!)

Step 4: Initialize a Transaction

Now you're ready to initialize your first transaction. You can do this via API or use our checkout page:

Via API:

// Sample PHP code to initialize a transaction
$curl = curl_init();

$data = [
    'amount' => 10000, // Amount in cents/kobo
    'email' => '[email protected]',
    'payment_channel_id' => 1, // Your payment channel ID
    'description' => 'Payment for Order #12345',
    'currency' => 'KSH'
];

curl_setopt_array($curl, [
    CURLOPT_URL => 'https://kipay.benfex.net/api/transactions/initialize',
    CURLOPT_RETURNTRANSFER => true,
    CURLOPT_ENCODING => '',
    CURLOPT_MAXREDIRS => 10,
    CURLOPT_TIMEOUT => 30,
    CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
    CURLOPT_CUSTOMREQUEST => 'POST',
    CURLOPT_POSTFIELDS => json_encode($data),
    CURLOPT_HTTPHEADER => [
        'Content-Type: application/json',
        'X-API-Key: your_api_key_here'
    ],
]);

$response = curl_exec($curl);
$err = curl_error($curl);

curl_close($curl);

if ($err) {
    echo "cURL Error #:" . $err;
} else {
    $result = json_decode($response, true);
    
    // Redirect to payment page
    if ($result['status'] === 'success') {
        header('Location: ' . $result['authorization_url']);
        exit;
    }
}

Via Checkout Page:

Alternatively, you can create a simple HTML form that redirects to our checkout page:

<form action="https://kipay.benfex.net/payment/checkout" method="post">
    <input type="hidden" name="amount" value="10000">
    <input type="hidden" name="email" value="[email protected]">
    <input type="hidden" name="payment_channel_id" value="1">
    <input type="hidden" name="description" value="Payment for Order #12345">
    <input type="hidden" name="currency" value="KSH">
    <input type="hidden" name="api_key" value="your_api_key_here">
    
    <button type="submit">Pay Now</button>
</form>

Step 5: Verify Transaction Status

After a payment is initiated, you'll want to verify its status. This is done using the reference number:

// Sample PHP code to verify a transaction
$curl = curl_init();

$reference = 'KIPAY12345678'; // The transaction reference returned during initialization

curl_setopt_array($curl, [
    CURLOPT_URL => 'https://kipay.benfex.net/api/transactions/verify/' . $reference,
    CURLOPT_RETURNTRANSFER => true,
    CURLOPT_ENCODING => '',
    CURLOPT_MAXREDIRS => 10,
    CURLOPT_TIMEOUT => 30,
    CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
    CURLOPT_CUSTOMREQUEST => 'GET',
    CURLOPT_HTTPHEADER => [
        'X-API-Key: your_api_key_here'
    ],
]);

$response = curl_exec($curl);
$err = curl_error($curl);

curl_close($curl);

if ($err) {
    echo "cURL Error #:" . $err;
} else {
    $result = json_decode($response, true);
    
    if ($result['status'] === 'success' && $result['transaction']['status'] === 'completed') {
        // Payment was successful
        // Update your database or perform other actions
        echo "Payment completed successfully!";
    } else {
        // Payment failed or is still pending
        echo "Payment status: " . $result['transaction']['status'];
    }
}

Step 6: Set Up Webhooks (Optional)

For real-time payment notifications, you should set up webhooks:

  1. Go to Settings in the admin dashboard
  2. Navigate to the Webhook Settings tab
  3. Copy the webhook URL for your payment provider
  4. Set up this URL in your payment provider's dashboard

Once set up, Kipay will receive real-time updates about transaction statuses, even when your customers don't return to your website after payment.

Congratulations! You've now set up Kipay and processed your first transaction. To learn more about advanced features, check out the rest of our documentation.

Next Steps