CiftPay Platform API v1.0

Developer API & eTIMS Integration Guide

Seamlessly connect Point of Sale (POS) terminals, e-commerce stores (WooCommerce, Shopify), or ERP platforms (Odoo, SAP) to issue KRA eTIMS fiscal invoices and process M-Pesa payments with zero custody.

Production API Base URL
https://api-ciftpay-071e66a802ff.herokuapp.com

Authentication

All requests to the CiftPay API must include your organization's secret key in the Authorization HTTP header as a Bearer token.

HTTP Header Example
Authorization: Bearer cp_live_2b8d4fd7b6b4e3fdb21507ce5ea72f...
Security Guardrail: API keys start with cp_live_ and possess full administrator privileges scoped to your organization under PostgreSQL Row Level Security (RLS). Never expose this key in public client-side browser JavaScript or mobile source code.

Interactive Code Snippets

SALES · CURL
curl -X POST https://api-ciftpay-071e66a802ff.herokuapp.com/sales \
  -H "Authorization: Bearer cp_live_your_key_here" \
  -H "Content-Type: application/json" \
  -d '{
    "kind": "cash",
    "buyer_name": "Acme Holdings Ltd",
    "buyer_pin": "P051234567Z",
    "buyer_msisdn": "254712345678",
    "lines": [
      {
        "description": "Enterprise Software License",
        "qty": "1",
        "unit_price_cents": 5000000,
        "tax_category": "B",
        "etims_class_code": "50101501"
      }
    ]
  }'

eTIMS Fiscal Lifecycle & Architecture

When your system calls POST /sales with kind: "cash" or settles an open order, CiftPay manages the complete KRA fiscal validation pipeline asynchronously:

01Synchronous

Sale Created

Database commits transaction, generates internal invoice & customer receipt code.

02River Queue

eTIMS Worker Job

Invoice is enqueued for signing with exponential retry protection against network latency.

03OSCU / VSCU

KRA Acknowledgment

KRA fiscal unit signs invoice, emits official Control Number & cryptographic QR payload.

04Real-time

Webhook & Polling

Invoice transitions to ACKED. Receipt modal & your webhook receive verified status.

Live In-Browser API Tester

Test real HTTP requests against the live production server directly in your browser.

Endpoint target: https://api-ciftpay-071e66a802ff.herokuapp.com/items

KRA eTIMS Tax Categories & Codes

When passing items in lines[].tax_category, you must provide one of the standard Kenya Revenue Authority tax categories:

CategoryVAT RateDescription & Eligible Goods
A16.0%Standard VAT Rate on general taxable goods & services
B16.0%General merchandise and retail goods (Default for POS)
C0.0%Zero-rated items (Exports, unpasteurized milk, pharmaceuticals)
DExemptExempt goods & services (Financial services, basic education)
ENon-VATOut of scope / non-taxable transactions

Error Codes & Troubleshooting

HTTP CodeError CodeCause & Remediation
401unauthenticatedAPI key is missing, revoked, or prefixed incorrectly. Ensure Authorization: Bearer cp_live_...
403forbiddenAccountant role restricted or accessing an unauthorized organization tenant.
422validationInvalid KRA PIN structure (must be A or P followed by 9 digits and 1 letter), or invalid tax category.
503service_unavailableKRA OSCU/VSCU hardware or upstream gateway is unreachable. Invoice will automatically queue in River for retry.
API & Developer Documentation · CiftPay · CiftPay