KeshoPay API Documentation
KeshoPay is not a PSP. We provide a unified integration layer that makes it easy to connect to multiple payment service providers (PSPs) like Paystack, Mpesa, and more. Manage all your payment integrations in one place with a single, developer-friendly API.
1
Create Application/Wallet
Start in the KeshoPay dashboard
2
Add Gateways & Credentials
Connect Paystack, Mpesa, etc.
3
Get Unified Keys
Use in your integration
Quick Start: 3 Steps
Integrate once, connect to many. After setting up your application and gateways, use the unified API below to initiate payments across all your connected PSPs.
1
Create Authorization Key
Generate a secure authorization key using your public/private keys, amount, and wallet ID.
function createAuthorizationKey(publicKey, privateKey, amount, walletId) {
const data = { publicKey, privateKey, amount, walletId, timestamp: Date.now() };
const jsonString = JSON.stringify(data);
return Buffer.from(jsonString, 'utf8').toString('base64');
}2
Make Payment Request
Send a payment request to the API using your authorization key and payment details.
const authorizationKey = createAuthorizationKey(
'pk_test_your_public_key',
'sk_test_your_private_key',
1000,
'your_wallet_app_id'
);
const response = await fetch('/api/v1/payment/initiate', {
method: 'POST',
headers: { 'Content-Type': 'application/json' },
body: JSON.stringify({
authorizationKey,
amount: 1000,
reference: 'ORDER-12345',
redirectUrl: 'https://yoursite.com/success',
currency: 'KES',
phoneNumber: '254712345678'
})
});
const result = await response.json();
if (result.success) {
window.location.href = result.data.checkoutUrl;
}3
Redirect to Checkout
If successful, redirect the user to the checkout URL provided in the API response.
if (result.success) {
window.location.href = result.data.checkoutUrl;
}