SDKs & Libraries
Official SDKs are in development. In the meantime, the REST API is simple enough that most integrations use fetch or axios directly.
💡SDKs for Node.js, Python, and PHP are coming soon. Contact us if you'd like early access.
Minimal wrappers
Until official SDKs are available, here are copy-paste wrappers for common languages:
Node.js / TypeScript
auraxpay.ts
const BASE = "token-string">'https:"token-comment">//api.auraxpay.net/v1' async function aurax(path: string, options: RequestInit = {}) { const res = await fetch(BASE + path, { ...options, headers: { "token-string">'Content-Type': "token-string">'application/json', "token-string">'x-api-key': process.env.AURAX_API_KEY!, ...options.headers, }, }) const data = await res.json() if (!res.ok) throw Object.assign(new Error(data.error), { status: res.status, data }) return data } "token-comment">// Usage const { transaction } = await aurax("token-string">'/payments', { method: "token-string">'POST', body: JSON.stringify({ amount: 10000, channel: "token-string">'MPESA', buyerPhone: "token-string">'+255712345678', buyerName: "token-string">'Amina Hassan', }), }) "token-comment">// Get transaction const { transaction: txn } = await aurax("token-string">'/payments/AXP-SXSZF5H6') "token-comment">// List const { transactions } = await aurax("token-string">'/payments?status=COMPLETED&limit=50')
Python
auraxpay.py
import os, requests BASE = "token-string">'https:"token-comment">//api.auraxpay.net/v1' def aurax(method, path, **kwargs): res = requests.request( method, BASE + path, headers={"token-string">'x-api-key': os.environ["token-string">'AURAX_API_KEY']}, **kwargs ) data = res.json() if not res.ok: raise Exception(f"Aurax {res.status_code}: {data.get(">'error')}") return data # Collect payment result = aurax("token-string">'POST', "token-string">'/payments', json={ "token-string">'amount': 10000, "token-string">'channel': "token-string">'MPESA', "token-string">'buyerPhone': "token-string">'+255712345678', "token-string">'buyerName': "token-string">'Amina Hassan', }) txn = result["token-string">'transaction'] # Retrieve result = aurax("token-string">'GET', "token-string">'/payments/AXP-SXSZF5H6') # List completed result = aurax("token-string">'GET', "token-string">'/payments', params={"token-string">'status': "token-string">'COMPLETED', "token-string">'limit': 50})
PHP
auraxpay.php
function aurax(string $method, string $path, array $data = []): array { $ch = curl_init("token-string">'https:"token-comment">//api.auraxpay.net/v1' . $path); $headers = [ "token-string">'Content-Type: application/json', "token-string">'x-api-key: ' . getenv("token-string">'AURAX_API_KEY'), ]; curl_setopt_array($ch, [ CURLOPT_RETURNTRANSFER => true, CURLOPT_CUSTOMREQUEST => $method, CURLOPT_HTTPHEADER => $headers, CURLOPT_POSTFIELDS => $data ? json_encode($data) : null, ]); $body = curl_exec($ch); $status = curl_getinfo($ch, CURLINFO_HTTP_CODE); curl_close($ch); $result = json_decode($body, true); if ($status >= 400) throw new Exception("token-string">'Aurax ' . $status . "token-string">': ' . $result["token-string">'error']); return $result; } "token-comment">// Collect payment $result = aurax("token-string">'POST', "token-string">'/payments', [ "token-string">'amount' => 10000, "token-string">'channel' => "token-string">'MPESA', "token-string">'buyerPhone' => "token-string">'+255712345678', "token-string">'buyerName' => "token-string">'Amina Hassan', ]);
Environment variables
Store your key in an environment variable, never hardcoded:
.env
# Test environment AURAX_API_KEY=axp_test_xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx AURAX_WEBHOOK_SECRET=whsec_xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx # Production (use your platform's secret manager) AURAX_API_KEY=axp_live_xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx AURAX_WEBHOOK_SECRET=whsec_xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx