Payments API
Integrate mobile money payments and payment tracking seamlessly with AnyPay Tanzania's Payments API.
Base URL
https://anypaytanzania.com/api/payments/
1. Wallet Pull Payment
Initiate a mobile money payment request to a customer.
Endpoint
POST /wallet/pull/
Request
{
"order_id": "ORD-8442355",
"phone": "0798100380",
"amount": 1000
}
Response
{
"status": "success",
"resultcode": "000",
"message": "Request in progress. You will receive a callback shortly",
"order_id": "ORD-8442355",
"transid": "ORD-8442355",
"msisdn": "255798100380",
"payment_reference": "WQ20260428BBD25BEA4407322A",
"order_response": {
"result": "SUCCESS",
"reference": "S20523452275"
},
"wallet_response": {
"result": "SUCCESS",
"reference": "S20523452284",
"message": "Wallet push successful"
}
}
Notes: Accepts local numbers (07XXXXXXXX), automatically converts to international format (255XXXXXXXXX). Payment is asynchronous.
2. Create Order (Minimal)
Generate a payment link for customer checkout.
Endpoint
POST /create-order-minimal/
Request
{
"buyer_phone": "0798100380",
"amount": 1000
}
Response
{
"order_id": "ORD-ac00cd6466",
"reference": "S20523453011",
"result": "SUCCESS",
"payment_token": "63831626",
"payment_url": "https://tz.selcom.online/paymentgw/checkout/...",
"redirect": "http://anypaytanzania.com/payment/success"
}
Usage: Redirect user to payment_url. Supports mobile money & cards.
3. Check Order Status
Verify payment status from gateway.
Endpoint
GET /check-order-status/?order_id=ORD-8202355
Response
{
"success": true,
"message": "Order status checked successfully",
"data": {
"order_id": "ORD-8202355",
"selcom_payment_status": "COMPLETED",
"selcom_amount": "500",
"selcom_transid": "DDQF10OW3W",
"selcom_channel": "MPESA-TZ",
"selcom_reference": "1684412135",
"payment_exists": true,
"source": "selcom_direct",
"security_check": "passed"
}
}
Status Values: PENDING, PROCESSING, COMPLETED, FAILED
4. List Payments
Retrieve all transactions.
Endpoint
GET /payments/
Response
{
"count": 15,
"results": [
{
"payment_id": "cbc3ec1a-d520-4afc-ad88-96feab1a148f",
"amount": 1000.0,
"currency": "TZS",
"payment_method": "mobile_money",
"status": "processing",
"reference": "WQ20260428BBD25BEA4407322A",
"created_at": "2026-04-28T23:12:00+03:00"
}
]
}
Payment Flows
Wallet Pull Flow
- Create order (optional)
- Send a request to
/wallet/pull/ - The customer receives a payment prompt
- Customer authorizes the payment on their phone
- Check status or wait for callback
Hosted Payment Flow
- Call
/create-order-minimal/ - Redirect the user to the returned
payment_url - User completes payment on the hosted page
- Optionally verify payment with
/check-order-status/
Code Examples
Choose a sample and click the copy button in the top-right corner.
import requests
headers = {
"Authorization": "Bearer YOUR_ACCESS_TOKEN",
"API-Key": "YOUR_API_KEY",
"Content-Type": "application/json"
}
data = {
"order_id": "ORD-12345",
"phone": "0798123456",
"amount": 1000
}
response = requests.post("https://anypaytanzania.com/api/payments/wallet/pull/",
headers=headers, json=data)
print(response.json())
Best Practices
- Always verify payments using /check-order-status/
- Do not rely only on frontend confirmation
- Store order_id and reference
- Handle asynchronous responses properly
- Use small amounts for testing (e.g., 500 TZS)
- Use valid Tanzanian numbers
- Log all API responses
Support
For more information, visit anypaytanzania.com or contact support at support@anypaytanzania.com