API Docs
Fetching Transactions
You can fetch a transaction using either the transaction reference or transaction ID. The response will provide detailed information about the transaction.
Headers
- Authorization:
Bearer YOUR_SECRET_KEY - Content-Type:
application/json
Query Parameters
- transaction_reference:
string(optional) - Transaction reference provided by merchant/developer. - transaction_id:
string(optional) - Transaction ID.
Sample Request to Fetch a Transaction
1. Fetch Transaction using Transaction Reference
cURL
curl -X GET "https://api.motapa.africa/v1/transactions/fetch?transaction_reference=MOTAPAPAY1234567890" \ -H "Authorization: Bearer mp_test_26PHem9AhJZvU623DfE1x4sd" \ -H "Content-Type: application/json"
Python
import requests
url = "https://api.motapa.africa/v1/transactions/fetch"
params = {
"transaction_reference": "MOTAPAPAY1234567890"
}
headers = {
"Authorization": "Bearer mp_test_26PHem9AhJZvU623DfE1x4sd",
"Content-Type": "application/json"
}
response = requests.get(url, headers=headers, params=params)
if response.status_code == 200:
print("Transaction details:", response.json())
else:
print("Error:", response.status_code, response.text)2. Fetch Transaction using Transaction ID
cURL
curl -X GET "https://api.motapa.africa/v1/transactions/fetch?transaction_id=mp_1234567890" \ -H "Authorization: Bearer mp_test_26PHem9AhJZvU623DfE1x4sd" \ -H "Content-Type: application/json"
Python
import requests
url = "https://api.motapa.africa/v1/transactions/fetch"
params = {
"transaction_id": "mp_1234567890"
}
headers = {
"Authorization": "Bearer mp_test_26PHem9AhJZvU623DfE1x4sd",
"Content-Type": "application/json"
}
response = requests.get(url, headers=headers, params=params)
if response.status_code == 200:
print("Transaction details:", response.json())
else:
print("Error:", response.status_code, response.text)Sample Responses
Successful Retrieval (200)
{
"result": "success",
"transaction": {
"transaction_id": "mp_1234567890",
"transaction_reference": "MOTAPAPAY1234567890",
"amount": "1000",
"charges": "10",
"total": "1010",
"currency": "USD",
"payment_method_name": "Visa/Mastercard",
"payment_method_code": "card",
"payment_method_type": "card",
"message": "Transaction fetchd successfully.",
"details": {}
}
}Bad Request (400)
{
"result": "error",
"message": "Invalid request parameters."
}Unauthorized (401)
{
"result": "error",
"message": "Unauthorized. Please provide a valid API key."
}Internal Server Error (500)
{
"result": "error",
"message": "Internal server error. Please try again later."
}