Skip to content

Latest commit

 

History

History
219 lines (156 loc) · 7.42 KB

File metadata and controls

219 lines (156 loc) · 7.42 KB

mpesa_client.ExperienceApi

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

mpesa_accountbalance_v1_query_post

AccountBalanceQueryResponse mpesa_accountbalance_v1_query_post(body)

Make an Account Balance query

Example

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)

Parameters

Name Type Description Notes
body AccountBalanceQueryRequest

Return type

AccountBalanceQueryResponse

Authorization

bearerAuth

HTTP request headers

  • Content-Type: application/json
  • Accept: application/json

[Back to top] [Back to API list] [Back to Model list] [Back to README]

mpesa_reversal_v1_request_post

TransactionReversalResponse mpesa_reversal_v1_request_post(body)

Reverse an M-Pesa Transaction

Example

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)

Parameters

Name Type Description Notes
body TransactionReversalRequest

Return type

TransactionReversalResponse

Authorization

bearerAuth

HTTP request headers

  • Content-Type: application/json
  • Accept: application/json

[Back to top] [Back to API list] [Back to Model list] [Back to README]

mpesa_stkpushquery_v1_query_post

StkPushQueryResponse mpesa_stkpushquery_v1_query_post(body)

Query the status of a Lipa na M-Pesa Online Payment

Example

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)

Parameters

Name Type Description Notes
body StkPushQueryRequest

Return type

StkPushQueryResponse

Authorization

bearerAuth

HTTP request headers

  • Content-Type: application/json
  • Accept: application/json

[Back to top] [Back to API list] [Back to Model list] [Back to README]

mpesa_transactionstatus_v1_query_post

TransactionStatusQueryResponse mpesa_transactionstatus_v1_query_post(body)

Query the Transaction Status of an M-Pesa Transaction

Example

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)

Parameters

Name Type Description Notes
body TransactionStatusQueryRequest

Return type

TransactionStatusQueryResponse

Authorization

bearerAuth

HTTP request headers

  • Content-Type: application/json
  • Accept: application/json

[Back to top] [Back to API list] [Back to Model list] [Back to README]