Capay Global

SDKs

Official client libraries for TypeScript, Python and PHP. Each one wraps the same REST API: the same envelope, the same idempotency rules, the same status vocabulary and the same webhook signature.

TypeScript / Node.js

@capay/sdk

Install

Install
npm install @capay/sdk

Quickstart

Quickstart
import { Capay } from '@capay/sdk';

const client = new Capay({ apiKey: process.env.CAPAY_API_KEY });

const collection = await client.collections.create(
  {
    amount: '5000',
    currency: 'XAF',
    country: 'CM',
    method: 'mobile_money',
    msisdn: '+237650000001',
    merchant_reference: 'order-10482',
  },
  { idempotencyKey: 'col-order-10482-a1b2c3' },
);

console.log(collection.id, collection.status); // col_..., pending

Not published yet

@capay/sdk is not on npm today. The install command shows the name it will ship under. Until the release lands, request early access through Support in your dashboard.

Python

capay

Install

Install
pip install capay

Quickstart

Quickstart
import os
from capay import Capay

client = Capay(api_key=os.environ["CAPAY_API_KEY"])

collection = client.collections.create(
    amount="5000",
    currency="XAF",
    country="CM",
    method="mobile_money",
    msisdn="+237650000001",
    merchant_reference="order-10482",
    idempotency_key="col-order-10482-a1b2c3",
)

print(collection.id, collection.status)  # col_..., pending

Not published yet

capay is not on PyPI today. The install command shows the name it will ship under. Until the release lands, request early access through Support in your dashboard.

PHP

capay/capay-php

Install

Install
composer require capay/capay-php

Quickstart

Quickstart
<?php
require 'vendor/autoload.php';

use Capay\CapayClient;

$client = new CapayClient(getenv('CAPAY_API_KEY'));

$collection = $client->collections->create([
    'amount' => '5000',
    'currency' => 'XAF',
    'country' => 'CM',
    'method' => 'mobile_money',
    'msisdn' => '+237650000001',
    'merchant_reference' => 'order-10482',
], ['idempotency_key' => 'col-order-10482-a1b2c3']);

echo $collection->id, ' ', $collection->status; // col_..., pending

Not published yet

capay/capay-php is not on Packagist today. The install command shows the name it will ship under. Until the release lands, request early access through Support in your dashboard.

Every SDK speaks the same contract

Whichever language you pick, these rules hold. They are properties of the API, not of the library.

  • Every response is an envelope: { status, data, request_id } on success, { status, error } on failure, with X-Request-Id on the response. Quote the request_id when you contact support.
  • Money is a decimal string with an explicit ISO 4217 currency, never a float. Zero-decimal currencies (XAF, XOF, UGX, RWF, TZS, GNF, BIF, DJF, KMF) take no fraction: "5000" means 5000.
  • POST /collections, /payouts and /refunds require an Idempotency-Key. Derive it from your own order id: the same key with the same body replays the stored response instead of creating a second transaction.
  • Authenticated responses carry X-RateLimit-Limit and X-RateLimit-Remaining. A 429 carries Retry-After in seconds; every SDK honours it.
  • One status vocabulary covers collections, payouts and refunds. Handle each status explicitly and treat an unknown or unhandled status as undetermined, never as a failure and never as a success.
  • Each SDK ships a webhook verification helper that computes the HMAC over the raw bytes, enforces the 300 second tolerance and accepts either v1 value during a secret rotation.

Beyond the SDKs there is a command-line tool, an MCP server for coding agents, a browser checkout script and a WooCommerce plugin: CLI, MCP server, Checkout.js, Plugins.

Machine-readable

The whole API is available in machine-readable form. Import the Postman collection to send a first request in a minute, or point your own generator at the OpenAPI document.