Collect Payment
Initiate a mobile money collection from a customer. A push prompt is sent to their phone and they approve the payment.
POSThttps://api.auraxpay.net/v1/paymentsRequires payments.create permission
Request body
Example request
cURL
curl -X POST https://api.auraxpay.net/v1/payments \ -H "Content-Type: application/json" \ -H "x-api-key: axp_live_YOUR_KEY" \ -d '{ "amount": 25000, "channel": "MPESA", "buyerPhone": "+255712345678", "buyerName": "Amina Hassan", "buyerEmail": "amina@example.com", "description": "Subscription - Pro Plan", "idempotencyKey": "order_9f2a1b3c", "metadata": { "orderId": "ORD-1042", "userId": "usr_abc123" } }'
Node.js
const res = await fetch("token-string">'https:"token-comment">//api.auraxpay.net/v1/payments', { method: "token-string">'POST', headers: { "token-string">'Content-Type': "token-string">'application/json', "token-string">'x-api-key': process.env.AURAX_API_KEY, }, body: JSON.stringify({ amount: 25000, channel: "token-string">'MPESA', buyerPhone: "token-string">'+255712345678', buyerName: "token-string">'Amina Hassan', description: "token-string">'Subscription - Pro Plan', idempotencyKey: "token-string">'order_9f2a1b3c', metadata: { orderId: "token-string">'ORD-1042' }, }), }) const { transaction } = await res.json()
Response
Returns 201 Created on success with the transaction object at PENDING status.
Response 201
{
"success": true,
"transaction": {
"id": "txn_01j2k3m4n5p6q7r8s9t0",
"reference": "AXP-SXSZF5H6",
"type": "COLLECTION",
"amount": 25000,
"fee": 0,
"netAmount": 25000,
"channel": "MPESA",
"status": "PENDING",
"buyerPhone": "+255712345678",
"buyerName": "Amina Hassan",
"buyerEmail": "amina@example.com",
"description": "Subscription - Pro Plan",
"metadata": {
"orderId": "ORD-1042",
"userId": "usr_abc123"
},
"createdAt": "2025-06-09T14: 30: 00.000Z",
"updatedAt": "2025-06-09T14: 30: 00.000Z"
}
}💡The transaction starts as
PENDING. Listen for the payment.completed webhook to confirm funds received — do not fulfill orders based on PENDING status alone.Idempotency
Pass idempotencyKey with a unique value per payment attempt. If you retry the same request with the same key within 24 hours, Aurax Pay returns the original transaction instead of creating a duplicate charge.
Use your own order ID or a UUID as the idempotency key.
Phone number format
All phone numbers must be in E.164 format with Tanzania country code: