Ruka uende kwenye yaliyomoSkip to Content
HatiAnza haraka

Anza Haraka

Anza na API ya Biashara ya Wakapay kwa dakika chache. Mwongozo huu utakupitisha katika kupiga simu yako ya kwanza ya API.

Mahitaji ya Kwanza

Kabla hujaanza, utahitaji:

  1. Zana ya kupiga maombi ya HTTP (curl, Postman, au lugha yako pendwa ya programu)
  2. Vitambulisho vyako vya API (vilivyotumwa kwa barua pepe yako)

Hatua ya 1: Thibitisha Utambulisho

Kwanza, hebu tuthibitishe kuwa funguo yako ya API inafanya kazi kwa kuthibitisha utambulisho:

curl -X POST https://api.test.wakapay.io/business/auth \ -H "Content-Type: application/json" \ -d '{ "apiKey": "YOUR_API_KEY", "apiSecret": "YOUR_API_SECRET" }'

Unapaswa kupokea jibu lenye tokeni ya upatikanaji:

{ "success": true, "data": { "accessToken": "eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9...", "expiresIn": 3600, "tokenType": "Bearer" } }

Hifadhi tokeni hii kwa usalama — utaitumia kwa maombi yote yajayo.

Hatua ya 2: Angalia Salio Lako

Hebu tuangalie salio la akaunti yako:

curl https://api.test.wakapay.io/business/balance \ -H "Authorization: Bearer YOUR_ACCESS_TOKEN"

Jibu:

{ "success": true, "data": { "balances": [ { "currency": "UGX", "available": 1000000, "pending": 50000 }, { "currency": "KES", "available": 250000, "pending": 0 } ] } }

Hatua ya 3: Pata Viwango vya FX vya Sasa

Kabla ya kufanya malipo ya kuvuka mipaka, angalia viwango vya ubadilishaji:

curl "https://api.test.wakapay.io/business/rate?from=UGX&to=KES&amount=100000" \ -H "Authorization: Bearer YOUR_ACCESS_TOKEN"

Jibu:

{ "success": true, "data": { "from": "UGX", "to": "KES", "rate": 0.0295, "amount": 100000, "convertedAmount": 2950, "fee": 500, "timestamp": "2024-01-15T10:30:00Z" } }

Hatua ya 4: Thibitisha Mpokeaji

Kabla ya kutuma pesa, thibitisha taarifa za mpokeaji:

curl -X POST https://api.test.wakapay.io/business/verify-transfer \ -H "Authorization: Bearer YOUR_ACCESS_TOKEN" \ -H "Content-Type: application/json" \ -d '{ "type": "mobile_money", "phone": "+256700000000", "network": "MTN", "country": "UG" }'

Jibu:

{ "success": true, "data": { "verified": true, "recipientName": "John Doe", "phone": "+256700000000", "network": "MTN", "country": "UG" } }

Hatua ya 5: Tuma Malipo

Sasa uko tayari kutuma malipo yako ya kwanza:

curl -X POST https://api.test.wakapay.io/business/payout/transfer \ -H "Authorization: Bearer YOUR_ACCESS_TOKEN" \ -H "Content-Type: application/json" \ -d '{ "amount": 50000, "currency": "UGX", "recipient": { "type": "mobile_money", "phone": "+256700000000", "name": "John Doe", "network": "MTN" }, "reference": "INV-2024-001", "description": "Payment for services rendered", "callbackUrl": "https://yourdomain.com/webhook" }'

Jibu:

{ "success": true, "data": { "transactionId": "txn_abc123def456", "businessReference": "INV-2024-001", "status": "processing", "amount": 50000, "currency": "UGX", "recipient": { "phone": "+256700000000", "name": "John Doe" }, "createdAt": "2024-01-15T10:35:00Z" } }

Hatua ya 6: Angalia Hali ya Muamala

Fuatilia malipo yako kwa kutumia rejea ya biashara:

curl https://api.test.wakapay.io/business/transactions/INV-2024-001 \ -H "Authorization: Bearer YOUR_ACCESS_TOKEN"

Jibu:

{ "success": true, "data": { "transactionId": "txn_abc123def456", "businessReference": "INV-2024-001", "status": "completed", "amount": 50000, "currency": "UGX", "recipient": { "phone": "+256700000000", "name": "John Doe" }, "createdAt": "2024-01-15T10:35:00Z", "completedAt": "2024-01-15T10:35:45Z" } }

Kinachofuata?

Hongera! Umefanikiwa kupiga simu zako za kwanza za Wakapay API. Hivi ndivyo vya kuchunguza vifuatavyo:

Mifano ya Msimbo

Node.js

const axios = require("axios"); const wakapay = axios.create({ baseURL: "https://api.test.wakapay.io", headers: { Authorization: `Bearer ${process.env.WAKAPAY_TOKEN}`, "Content-Type": "application/json", }, }); // Send a payment async function sendPayment() { try { const response = await wakapay.post("/business/payout/transfer", { amount: 50000, currency: "UGX", recipient: { type: "mobile_money", phone: "+256700000000", name: "John Doe", network: "MTN", }, reference: "INV-2024-001", description: "Payment for services", }); console.log("Payment sent:", response.data); } catch (error) { console.error("Error:", error.response.data); } }

Python

import requests WAKAPAY_API_URL = 'https://api.test.wakapay.io' WAKAPAY_TOKEN = 'your_access_token' headers = { 'Authorization': f'Bearer {WAKAPAY_TOKEN}', 'Content-Type': 'application/json' } def send_payment(): payload = { 'amount': 50000, 'currency': 'UGX', 'recipient': { 'type': 'mobile_money', 'phone': '+256700000000', 'name': 'John Doe', 'network': 'MTN' }, 'reference': 'INV-2024-001', 'description': 'Payment for services' } response = requests.post( f'{WAKAPAY_API_URL}/business/payout/transfer', json=payload, headers=headers ) if response.status_code == 200: print('Payment sent:', response.json()) else: print('Error:', response.json()) send_payment()

Majaribio

Tumia vitambulisho hivi vya majaribio kwa uunganishaji:

  • Nambari za simu: Tumia nambari yoyote kuanzia +256700000000 hadi +256700000099
  • Kiasi cha majaribio: Kiasi chochote kati ya 1,000 na 10,000,000
  • Mitandao ya majaribio: MTN, Airtel, Africell

Miamala yote ya majaribio itafanikiwa mara moja bila kushughulikia pesa halisi.

Unahitaji Msaada?

Imesasishwa mwisho tarehe