Getting Started
This guide will walk you through the steps to set up your Kipay Payment Gateway account and process your first transaction.
Step 1: Create an Account
To get started with Kipay, you need to create an account:
- Visit the login page and click on "Sign Up"
- Fill in your details to create an account
- Verify your email address
- 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:
- Go to Payment Channels in the admin dashboard
- Click on Add New Channel
- Select a payment provider (e.g., Paystack, Flutterwave, Stripe)
- Enter your API keys and other required information
- Save the channel
Step 3: Get Your API Keys
To integrate Kipay with your application, you need your API keys:
- Go to Settings in the admin dashboard
- Navigate to the API Keys tab
- 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:
- Go to Settings in the admin dashboard
- Navigate to the Webhook Settings tab
- Copy the webhook URL for your payment provider
- 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.