Quick Start Guide
Get started with Lipachap in under 5 minutes. This guide will walk you through making your first API call.
Prerequisites: You'll need a Lipachap account with API keys. Don't have one? Sign up here.
Step 1: Get Your API Keys
- Create a merchant account on Lipachap
- Navigate to Settings → API Keys in your dashboard
- Copy your TEST API Key and API Secret
- Store them securely in environment variables
Step 2: Set Environment Variables
bash
LIPACHAP_BASE_URL=https://sandbox.api.lipachap.com
LIPACHAP_API_KEY=your_test_api_key_here
LIPACHAP_API_SECRET=your_test_api_secret_hereStep 3: Authenticate Your Request
Lipachap uses GATEWAY authentication. Here's how to sign your requests:
Authentication
const crypto = require("crypto");
// digest = sha256(apiSecret + requestPath + rawRequestBody)
const digest = crypto.createHash("sha256")
.update(apiSecret + "/api/v1/gateway/payments/cashin" + rawBody)
.digest("hex");
// token = base64(apiKey + ":" + digest)
const authorization = "GATEWAY " + Buffer.from(`${apiKey}:${digest}`).toString("base64");Step 4: Make Your First Payment Request
Let's collect 10,000 TZS from a customer:
cURL
curl -X POST https://sandbox.api.lipachap.com/api/v1/gateway/payments/cashin \
-H "Content-Type: application/json" \
-H "Authorization: GATEWAY <base64_token>" \
-d '{
"transid": "ORDER-12345",
"amount": 10000,
"msisdn": "255712345678",
"utilityref": "INVOICE-001"
}'Step 5: Check Transaction Status
bash
const statusPath = '/api/v1/gateway/payments/status';
const statusBody = { transid: 'TEST-1701234567890' };
const statusResponse = await fetch(baseUrl + statusPath, {
method: 'POST',
headers: {
'Content-Type': 'application/json',
'Authorization': createAuthHeader(apiKey, apiSecret, statusPath, statusBody)
},
body: JSON.stringify(statusBody)
});
const status = await statusResponse.json();
console.log(status.status); // PENDING, SUCCESS, or FAILEDStep 6: Set Up Webhooks (Recommended)
Instead of polling for status, receive real-time notifications:
- Go to Settings → Webhooks in your dashboard
- Add your webhook URL (e.g., https://yourapi.com/webhooks/lipachap)
- Save the webhook secret for signature verification
- Implement the webhook handler (see Webhooks documentation)
What's Next?
API Reference
Explore all available endpoints and parameters
Webhooks
Learn how to handle payment notifications
Authentication
Deep dive into authentication and security
Code Samples
Ready-to-use code in multiple languages
Going to Production? Before switching to live mode, make sure to update your LIPACHAP_BASE_URL to https://api.lipachap.com and use your LIVE API keys.