Live Pay

LivePay

Error Handling & Common Error Codes

Comprehensive guide to handling errors for both Collection and Send Money APIs

Error Handling Overview

The LivePay API uses standard HTTP status codes and provides detailed error messages for both Collection and Send Money endpoints.

Common vs Specific Errors

Authentication and validation errors are common to both APIs, while currency activation, PIN validation, and balance checks differ.

Response Format

Success Response (201 Created)

{
    "status": "success",
    "message": "Collection initiated successfully",
    "data": {
        "reference": "52750by31220ffbc7de3b36",
        "transaction_id": "67d4c8f3a1b29",
        "amount": 500,
        "currency": "UGX",
        "network": "AIRTEL"
    }
}

Error Response

{
    "status": "error",
    "message": "Currency not supported"
}

HTTP Status Codes

Code Status Description
201 Created Transaction initiated successfully
400 Bad Request Invalid request parameters, missing fields, unsupported currency, invalid network, insufficient balance
401 Unauthorized Invalid API key, invalid public key, missing auth header, invalid PIN
403 Forbidden KYC incomplete, API access off, IP restricted, currency not activated, PIN not set
404 Not Found User not found
405 Method Not Allowed Invalid HTTP method used (only POST allowed)
409 Conflict Duplicate reference detected
429 Too Many Requests Another transaction is currently processing (Send Money only)
500 Server Error API error or system error

Common Errors (Both APIs)

Authentication Errors

Invalid API key

Secret key not valid

Missing or invalid Authorization header

Bearer token not provided or malformed

Invalid or unauthorized public key

Public API key doesn't match user account

API access is turned off by user

User has disabled API access

Unauthorized. Complete KYC to access this API

User account requires KYC verification

Validation Errors

Missing required fields: amount, phone_number, currency, network

Required fields missing in request

Invalid JSON input

Request body contains malformed JSON

Duplicate reference detected

Reference ID already exists

Method Not Allowed

Only POST method is allowed

API-Specific Errors

Collection API Errors

Currency not supported

Currency code not recognized

Currency not activated

Currency not activated for your account

Invalid network for UGX. Available networks: AIRTEL, MTN

Network not valid for selected currency

User not found

User account not found

Send Money API Errors

Currency not supported

Currency code not recognized

Currency not activated

Currency not activated for your account

Invalid network for UGX. Available networks: AIRTEL, MTN

Network not valid for selected currency

Insufficient balance for UGX

User balance too low for withdrawal

Invalid PIN

Incorrect transaction PIN

Please set your PIN in settings first

PIN not set in user account

Another transaction is currently processing. Please wait and try again.

Concurrent transaction lock active

Server Errors

Payment provider error

Error from payment provider

System error

Error processing transaction

Access denied. IP restriction is enabled

IP not whitelisted for API access

Invalid JSON input

Malformed JSON in request body

Error Handling Guide

1

Check HTTP Status Code

Verify status code before parsing response body

2

Parse Error Message

Read the message field for specific details

3

Implement Retry Logic

Use exponential backoff for server errors (5xx status codes)

4

Validate Input Data

Pre-validate phone, amount, currency, and network

Best Practices

Validate Inputs

Always validate phone numbers, amounts, currency codes, and networks before API calls

Implement Retries

Use exponential backoff for server errors (5xx status codes)

Monitor Webhooks

Set up webhook endpoints to receive real-time transaction status updates for collections