Payment Links
Create shareable URLs for collecting M-Pesa payments without writing server code.
Create a Payment Link from the Merchant Panel
You don't need code to create payment links. Log in to your PayNexus merchant panel and generate checkout links in seconds:
Sign in to your merchant account
Go to /login and sign in to your PayNexus merchant panel.
Create a payment page
In the merchant panel, open Payment Pages and click Create Payment Page.
Configure amount and branding
Set a fixed amount or leave it open for the customer to enter. Add a title, description, and optionally your logo.
Share the link
Copy the generated payment link and share it via WhatsApp, SMS, email, or social media. Customers click the link and pay with M-Pesa instantly.
Use the merchant panel for the fastest way to generate payment links. Use the API only if you need to automate link creation in your own software.
Create a Payment Link (API)
Use the REST API only if you want to create payment links programmatically from your own application:
curl -X POST "https://paynexus.co.ke/api/checkout/sessions" \
-H "X-API-Key: sk_your_secret_key_here" \
-H "Content-Type: application/json" \
-d '{
"amount": 100,
"description": "Consulting services - June 2026",
"reference": "INV-2026-001",
"return_url": "https://yoursite.com/thanks",
"cancel_url": "https://yoursite.com/cancelled"
}'
Response
{
"success": true,
"data": {
"session_id": "cs_live_abc123...",
"checkout_url": "https://paynexus.co.ke/checkout/s/cs_live_abc123...",
"expires_at": "2026-06-21T21:25:00+03:00"
}
}
Hosted Checkout URL Parameters
Generate a direct checkout link without creating a session first:
https://paynexus.co.ke/checkout/pay/ACC_ZVTDYYYL?amount=100&description=Invoice+Payment&return_url=https://yoursite.com/thanks
| Parameter | Required | Description |
|---|---|---|
amount |
Yes | Payment amount in KES |
description |
No | Payment description |
return_url |
No | Redirect after successful payment |
cancel_url |
No | Redirect after cancelled/failed payment |
Payment Page Links
Use pre-configured payment pages created in the dashboard:
https://paynexus.co.ke/pay/your-page-slug
With optional invoice parameter:
https://paynexus.co.ke/pay/your-page-slug?invoice=INV-2026-001
Browser SDK Integration
Add hosted checkout without exposing API keys:
Payment Link Features
Custom Branding
Set logo, colors, and business name for a branded checkout experience.
Fixed or Open Amounts
Pre-set prices or let customers enter their own amount.
Expiration
Set expiry dates for payment pages and links.
Custom Fields
Collect additional customer information during checkout.
Invoice Integration
Link payment pages to specific invoices for automatic reconciliation.
Redirect Parameters
After payment, customers are redirected with these query parameters:
?reference=PNXABC123&status=completed&amount=100&session_id=cs_live_abc123
| Parameter | Description |
|---|---|
reference | Unique PayNexus payment reference |
status | Payment status (completed, failed, cancelled) |
amount | Payment amount in KES |
session_id | Checkout session ID |