Aurax PayAurax Pay Docs
Reference

SDKs & Libraries

Official SDKs are in development. In the meantime, the REST API is straightforward 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 ship, here are production-ready wrappers for common languages:

"token-keyword">const BASE = "token-string">'https://api.auraxpay.net/v1'

"token-keyword">async "token-keyword">function aurax(path: string, options: RequestInit = {}) {
  "token-keyword">const res = "token-keyword">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,
    },
  })
  "token-keyword">const data = "token-keyword">await res.json()
  "token-keyword">if (!res.ok) "token-keyword">throw Object.assign("token-keyword">new Error(data.error), { status: res.status, data })
  "token-keyword">return data
}

// Collect a payment
"token-keyword">const { transaction } = "token-keyword">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',
  }),
})

// Retrieve a transaction
"token-keyword">const { transaction: txn } = "token-keyword">await aurax("token-string">'/payments/AXP-SXSZF5H6')

// List completed payments
"token-keyword">const { transactions } = "token-keyword">await aurax("token-string">'/payments?status=COMPLETED&limit=50')

Environment variables

Store credentials in environment variables โ€” never hardcoded:

.env
"token-comment"># Test environment
"token-key">AURAX_API_KEY=axp_test_xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx
"token-key">AURAX_WEBHOOK_SECRET=whsec_xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx

"token-comment"># Production โ€” use your platform's secret manager
"token-key">AURAX_API_KEY=axp_live_xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx
"token-key">AURAX_WEBHOOK_SECRET=whsec_xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx

Need help?

Email
support@auraxpay.net
WhatsApp
+255 766 151 543