All URIs are relative to https://sandbox.safaricom.co.ke
| Method | HTTP request | Description |
|---|---|---|
| mpesa_accountbalance_v1_query_post | POST /mpesa/accountbalance/v1/query | Make an Account Balance query |
| mpesa_reversal_v1_request_post | POST /mpesa/reversal/v1/request | Reverse an M-Pesa Transaction |
| mpesa_stkpushquery_v1_query_post | POST /mpesa/stkpushquery/v1/query | Query the status of a Lipa na M-Pesa Online Payment |
| mpesa_transactionstatus_v1_query_post | POST /mpesa/transactionstatus/v1/query | Query the Transaction Status of an M-Pesa Transaction |
AccountBalanceQueryResponse mpesa_accountbalance_v1_query_post(body)
Make an Account Balance query
from __future__ import print_function
import time
import mpesa_client
from mpesa_client.rest import ApiException
from pprint import pprint
# Configure API key authorization: bearerAuth
configuration = mpesa_client.Configuration()
configuration.api_key['Authorization'] = 'YOUR_API_KEY'
# Uncomment below to setup prefix (e.g. Bearer) for API key, if needed
# configuration.api_key_prefix['Authorization'] = 'Bearer'
# create an instance of the API class
api_instance = mpesa_client.ExperienceApi(mpesa_client.ApiClient(configuration))
body = mpesa_client.AccountBalanceQueryRequest() # AccountBalanceQueryRequest |
try:
# Make an Account Balance query
api_response = api_instance.mpesa_accountbalance_v1_query_post(body)
pprint(api_response)
except ApiException as e:
print("Exception when calling ExperienceApi->mpesa_accountbalance_v1_query_post: %s\n" % e)| Name | Type | Description | Notes |
|---|---|---|---|
| body | AccountBalanceQueryRequest |
- Content-Type: application/json
- Accept: application/json
[Back to top] [Back to API list] [Back to Model list] [Back to README]
TransactionReversalResponse mpesa_reversal_v1_request_post(body)
Reverse an M-Pesa Transaction
from __future__ import print_function
import time
import mpesa_client
from mpesa_client.rest import ApiException
from pprint import pprint
# Configure API key authorization: bearerAuth
configuration = mpesa_client.Configuration()
configuration.api_key['Authorization'] = 'YOUR_API_KEY'
# Uncomment below to setup prefix (e.g. Bearer) for API key, if needed
# configuration.api_key_prefix['Authorization'] = 'Bearer'
# create an instance of the API class
api_instance = mpesa_client.ExperienceApi(mpesa_client.ApiClient(configuration))
body = mpesa_client.TransactionReversalRequest() # TransactionReversalRequest |
try:
# Reverse an M-Pesa Transaction
api_response = api_instance.mpesa_reversal_v1_request_post(body)
pprint(api_response)
except ApiException as e:
print("Exception when calling ExperienceApi->mpesa_reversal_v1_request_post: %s\n" % e)| Name | Type | Description | Notes |
|---|---|---|---|
| body | TransactionReversalRequest |
- Content-Type: application/json
- Accept: application/json
[Back to top] [Back to API list] [Back to Model list] [Back to README]
StkPushQueryResponse mpesa_stkpushquery_v1_query_post(body)
Query the status of a Lipa na M-Pesa Online Payment
from __future__ import print_function
import time
import mpesa_client
from mpesa_client.rest import ApiException
from pprint import pprint
# Configure API key authorization: bearerAuth
configuration = mpesa_client.Configuration()
configuration.api_key['Authorization'] = 'YOUR_API_KEY'
# Uncomment below to setup prefix (e.g. Bearer) for API key, if needed
# configuration.api_key_prefix['Authorization'] = 'Bearer'
# create an instance of the API class
api_instance = mpesa_client.ExperienceApi(mpesa_client.ApiClient(configuration))
body = mpesa_client.StkPushQueryRequest() # StkPushQueryRequest |
try:
# Query the status of a Lipa na M-Pesa Online Payment
api_response = api_instance.mpesa_stkpushquery_v1_query_post(body)
pprint(api_response)
except ApiException as e:
print("Exception when calling ExperienceApi->mpesa_stkpushquery_v1_query_post: %s\n" % e)| Name | Type | Description | Notes |
|---|---|---|---|
| body | StkPushQueryRequest |
- Content-Type: application/json
- Accept: application/json
[Back to top] [Back to API list] [Back to Model list] [Back to README]
TransactionStatusQueryResponse mpesa_transactionstatus_v1_query_post(body)
Query the Transaction Status of an M-Pesa Transaction
from __future__ import print_function
import time
import mpesa_client
from mpesa_client.rest import ApiException
from pprint import pprint
# Configure API key authorization: bearerAuth
configuration = mpesa_client.Configuration()
configuration.api_key['Authorization'] = 'YOUR_API_KEY'
# Uncomment below to setup prefix (e.g. Bearer) for API key, if needed
# configuration.api_key_prefix['Authorization'] = 'Bearer'
# create an instance of the API class
api_instance = mpesa_client.ExperienceApi(mpesa_client.ApiClient(configuration))
body = mpesa_client.TransactionStatusQueryRequest() # TransactionStatusQueryRequest |
try:
# Query the Transaction Status of an M-Pesa Transaction
api_response = api_instance.mpesa_transactionstatus_v1_query_post(body)
pprint(api_response)
except ApiException as e:
print("Exception when calling ExperienceApi->mpesa_transactionstatus_v1_query_post: %s\n" % e)| Name | Type | Description | Notes |
|---|---|---|---|
| body | TransactionStatusQueryRequest |
TransactionStatusQueryResponse
- Content-Type: application/json
- Accept: application/json
[Back to top] [Back to API list] [Back to Model list] [Back to README]