API Reference

Complete documentation for PigaPay's REST API

REST API JSON OAuth 2.0 Rate Limiting

Authentication

All API requests require authentication using an API key.

Authorization: Bearer sk_live_xxxxxxxxxxxxxxxxxxxxxxxx

Use sk_test_* for testing and sk_live_* for production.

POST /api/v1/payments

Create Payment

Create a new payment transaction.

Request Body

Parameter Type Description
amount * integer Amount in smallest currency unit (e.g., cents)
currency * string 3-letter currency code (e.g., TZS, KES, USD)
method * string Payment method: mobile_money, bank_transfer, card
customer object Customer details (name, phone, email)
reference string Your internal reference ID

Example Response

{ "id": "pay_123456789", "amount": 10000, "currency": "TZS", "status": "pending", "method": "mobile_money", "customer": { "name": "John Doe", "phone": "+255700000000", "email": "john@example.com" }, "created_at": "2026-07-25T10:30:00Z" }
GET /api/v1/payments/{id}

Get Payment

Retrieve payment details by ID.

Path Parameters

Parameter Type Description
id * string Payment ID

Example Response

{ "id": "pay_123456789", "amount": 10000, "currency": "TZS", "status": "completed", "method": "mobile_money", "customer": { "name": "John Doe", "phone": "+255700000000", "email": "john@example.com" }, "completed_at": "2026-07-25T10:35:00Z", "created_at": "2026-07-25T10:30:00Z" }
GET /api/v1/transactions

List Transactions

List all transactions with optional filters.

Query Parameters

Parameter Type Description
status string Filter by status: pending, completed, failed
from_date string Start date (ISO 8601)
to_date string End date (ISO 8601)
limit integer Number of results (default: 20, max: 100)
offset integer Pagination offset

Example Response

{ "data": [ { "id": "pay_123456789", "amount": 10000, "currency": "TZS", "status": "completed", "method": "mobile_money", "created_at": "2026-07-25T10:30:00Z" } ], "pagination": { "total": 50, "limit": 20, "offset": 0 } }
POST /api/v1/webhooks

Webhook Events

Receive real-time notifications for payment events.

Supported Events

Event Description
payment.created Payment has been created
payment.completed Payment has been completed successfully
payment.failed Payment has failed
payment.refunded Payment has been refunded

Example Webhook Payload

{ "event": "payment.completed", "timestamp": "2026-07-25T10:35:00Z", "data": { "id": "pay_123456789", "amount": 10000, "currency": "TZS", "status": "completed", "method": "mobile_money", "customer": { "name": "John Doe", "phone": "+255700000000", "email": "john@example.com" } } }
Contact us

Contact Us

WhatsApp +255 678 520 538

AI Assistant

👋 Hello! I'm PigaPay's AI assistant. How can I help you today?