Lipafy
Docs
API ReferenceSDKsGuides
DashboardSign Up

Getting Started

  • Quick Start
  • Authentication
  • Testing & Simulation

Core Products

  • Payments & Checkout
  • Subscriptions

Dev Tools

  • API Reference
  • SDKs

Webhooks & Events

  • Webhook Structure
  • WhatsApp Notifications

Accept Payments in Minutes

The fastest way to integrate mobile money payments. No backend required for the basic widget.

HTML Widget

Copy-paste a script tag. Best for static sites or quick MVPs.

View Widget Docs →

Rest API

Full control from your server. Secure and flexible.

View API Docs →

Authentication

We provide two keys in your dashboard.

Publishable Keypk_live_...

Use this in your frontend code (HTML Widget, React). It is safe to expose.

Secret Keysk_live_...

Use this on your server only. Never share it or commit it to client-side code.

API Reference

Base URL: https://lipafy.xyz/api

POST/mpesa/stk-push

Initiate an STK Push to a phone number.

curl -X POST https://lipafy.xyz/api/mpesa/stk-push \
  -u sk_live_...: \
  -d amount=500 \
  -d phone=254712345678
GET/payments/{id}

Check the status of a payment.

SDKs & Libraries

📜 TypScript / JavaScript (Web & Node)

A fully typed client for managing payments and subscriptions.

npm install lipafy-sdk

Usage

import { Lipafy } from 'lipafy-sdk';

const lipafy = new Lipafy("sk_live_...");

await lipafy.payments.create({
  amount: 500,
  phone: "254712...",
  currency: "KES"
});
Download Client source
🐍 Python

Coming soon. Use REST API for now.

🐘 PHP / Laravel

Coming soon. Use REST API for now.

Integration Methods

Add the snippet to your <head> and use data attributes to trigger payments.

index.html
<script src="https://lipafy.xyz/widget.js" 
        data-publishable-key="pk_test_..."></script>

<!-- The Button -->
<button 
  data-lipafy-amount="1500" 
  data-lipafy-merchant="My Store"
  class="pay-btn"
>
  Pay KES 1,500
</button>

<!-- Subscription Example -->
<button 
  data-lipafy-amount="2000" 
  data-lipafy-merchant="My SaaS"
  data-lipafy-type="monthly"
  data-lipafy-plan="Premium Plan"
  class="pay-btn"
>
  Subscribe KES 2,000/mo
</button>

Subscriptions

Lipafy handles recurring billing automatically. We support Weekly, Monthly, and Yearly cycles. We handle reminders, dunning (grace periods), and auto-cancellation.

Lifecycle
1

Active

Payment successful. Service is live.

2

Reminder (Day -3)

We send a WhatsApp reminder 3 days before renewal.

3

Failure & Dunning

If payment fails, we can optionally enter a Grace Period (configurable in your dashboard). We'll send reminders every few days.

4

Cancellation

If the grace period expires without payment, the subscription is cancelled.

Implementing a Subscription

<button 
  data-lipafy-amount="2500" 
  data-lipafy-type="monthly" 
  data-lipafy-plan="Premium Plan"
>
  Subscribe KES 2,500/mo
</button>

Just add data-lipafy-type="monthly" to your widget button. We handle the rest.

Testing & Simulated Provider

You don't need accurate money to test. Lipafy comes with a built-in Simulator that mimics real network conditions.

How to test:

  • Use any phone number starting with 07... or 254....
  • When you click "Pay", the system will simulate a delay (3-6 seconds) to mimic STK Push latency.
  • Outcome Probability:
    • 80% Success
    • 10% Insufficient Funds
    • 10% User Cancelled
  • Check your Merchant Dashboard to see the result.

Webhooks

Lipafy sends POST requests to your callback URL for real-time payment updates.

POST /your-callback-urlJSON
{
  "event": "payment.succeeded",
  "paymentId": "pay_8a9s8d9a8s...",
  "amount": 1500,
  "currency": "KES",
  "phone": "254712345678",
  "provider": "simulated",
  "timestamp": "2024-02-01T10:00:00Z"
}

WhatsApp Notifications

Lipafy provides automated customer notifications via WhatsApp. You don't need to manage templates; we handle everything.

Payment Receipts

Instant confirmation message with transaction reference sent to the user after success.

Subscription Reminders

Friendly reminders sent 3 days before renewal to ensure users have funds available.