API Documentation
Paylor provides a robust, secure, and developer-friendly API for processing M-Pesa payments, B2C payouts, and USDT TRC20 crypto payments. Our platform abstracts payment orchestration so you can go live faster.
Authentication
The Paylor API uses high-security Bearer tokens (API Keys) for authentication. Requests are made using HTTPS to ensure data privacy. Refer to the table below for the required integration credentials found in your dashboard.
Base URLs
Live Environment
Use this URL for production transactions.
https://api.paylorke.com/api/v1Sandbox Environment
Coming soon for testing purposes.
https://api.paylorke.com/api/v1/sandboxInitiate STK Push
The STK Push (Lipa na M-Pesa Online) allows you to trigger a payment request directly to a customer's phone. The customer will be prompted to enter their M-Pesa PIN to authorize the transaction.
Request Body
phoneRequiredCustomer phone number in international format (e.g., 254712345678).
amountRequiredAmount to charge in KES. Minimum is 1.
channelIdRequiredThe unique ID (alias) of your payment channel (Found in your API Settings).
referenceRequiredA unique internal reference used for tracking top-ups or specific orders.
callbackUrlHighly RecommendedA public URL to receive instant payment notifications. Securely signed with your Webhook Secret (Key ID).
Implementation Example
B2C Payout
Send money directly to any M-Pesa registered mobile number from your B2C wallet. Payouts are instant and ideal for salaries, rewards, or supplier payments.
Request Body
phoneRequiredRecipient phone number (e.g., 254712345678).
amountRequiredAmount to send. Min: 10, Max: 150,000 per transaction.
referenceRequiredUnique tracking reference for your system.
USDT Crypto Payment
Create a USDT TRC20 payment intent and return the destination TRON address to your customer. The customer sends the exact USDT amount on the TRON network, and Paylor confirms the transaction automatically through the blockchain monitor.
Before You Start
- Add at least one active TRON settlement wallet in Dashboard > Crypto > Wallets.
- Use an API key with the
payments:createscope. Default merchant API keys include this scope. - Only USDT on TRON/TRC20 is supported. Do not send ERC20, BEP20, BTC, or other assets to the returned address.
Request Body
amountRequiredExact amount in USDT. Minimum is 0.01.
currencyRequiredMust be
USDT.referenceRequiredYour order, invoice, or customer reference.
cryptoIdOptionalSpecific crypto wallet/channel ID. If omitted, Paylor selects an active crypto wallet for the merchant or project.
callbackUrlRecommendedYour HTTPS endpoint for the final confirmation webhook.
address and exact amount. Confirmation is automatic once a matching confirmed TRC20 transfer is detected. If no matching transfer is found before expires_at, the payment becomes EXPIRED.Implementation Example
Project-scoped URL
Use this form when your API key is scoped to a project.
Payment Links
Hosted payment links can also initiate crypto payments when the merchant has an active crypto wallet.
Check Wallet Balance
Monitor your service credits and B2C float balance programmatically to avoid transaction failures.
B2C Performance Metrics
Retrieve aggregated data about your payout history, including total volume and transaction counts.
Query Transaction
Check the status of a transaction at any time using our query endpoint. This is particularly useful for verifying payments if you miss a webhook callback.
Error Codes
Webhooks Overview
Webhooks allow your application to receive real-time notifications when a transaction status changes. Instead of polling the status API, Paylor will push data to your server as soon as the event occurs.
Steps to Integrate
- Create an HTTP POST endpoint on your server (e.g.,
/api/paylor-webhook). - Go to your Dashboard > Developers > API Keys.
- Copy the Key ID (this is your Webhook Secret).
- Provide a
callbackUrlin your STK Push request body. - Secure your endpoint by verifying the
X-Webhook-Signatureheader using your Secret.