API Reference

FlexiPay API Client.

Note

The IP address, PORT and Authorization Token are to be provided by FlexPay.

class flexpay.API(remote_ip: str, remote_port: Union[int, str], authorization_token: str)[source]

Bases: object

The API Client.

Ip:

The remote ip address of the FlexPay gateway server

Port:

The remote port of the FlexPay gateway server

Auth_token:

The Bearer authorization token issued by FlexPay

Methods.

check_transaction(orderNumber: str)[source]

Check the status of a previously sent payment request.

Parameters:

orderNumber (str) – FlexPay internal reference for the transaction.

Returns:

a dict object with details.

Return type:

dict

Response Parameters

Code:

code to indicate the status of the request >> 0 if correctly received 1 if not correctly received.

Message:

description of the Response

Transaction:

Object containing the field below

reference:

Your internal reference of the transaction.

orderNumber:

FlexPay internal reference for the transaction.

status:

Code to indicate the status of the transaction. >> 0 if successful, 1 if transaction has failed.

amount:

the transaction amount sent to gateway.

amountCustomer:

total amount paid by the customer.

currency:

The transaction currency.

createdAt:

The transaction DateTime

payment_service(merchant_code: str, your_reference: str, customer_phonenumber: str, amount: Union[int, str], callbackUrl: str, transaction_type: Union[int, str] = 1, currency: str = 'CDF')[source]

Make a payment request to flexpay.

Parameters:
  • merchant_code (str) – Merchant Code FlexPay

  • transaction_type (Union[int, str]) – The type of transaction >> (1. mobile money, 2. Bank card)

  • your_reference (str) – Your internal reference for the transaction

  • customer_phonenumber (str) – Phone number of the customer.

  • amount (Union[int, str]) – The transaction amount.

  • currency (str) – The transaction currency (CDF or USD).

  • callbackUrl (str) – The Callback URL where the transaction result will be sent.

Returns:

a dict object with details code, message, orderNumber.

Return type:

dict

Description of Response Parameters

Code:

code to indicate the status of the request 0 if correctly received 1 if not correctly received.

Message:

A description of the response

OrderNumber:

FlexPay internal reference for the transaction.

A request is sent to the CallBack URL to provide status of the transaction.

Description fields of Result.

Code:

code to indicate the status of the request 0 if correctly received 1 if not correctly received.

Reference:

Your internal reference of the transaction

Provider_reference:

The transaction reference from the mobile money operator if the transaction was successful.

OrderNumber:

FlexPay internal reference of the transaction.

payout_service(merchant_code: str, your_reference: str, customer_phonenumber: str, amount: Union[int, str], callbackUrl: str, transaction_type: Union[int, str] = 1, currency: str = 'CDF')[source]

Merchant Payout Service.

Parameters:
  • merchant_code (str) – Merchant Code FlexPay

  • transaction_type (Union[int, str]) – The type of transaction >> (1. mobile money, 2. Bank card)

  • your_reference (str) – Your internal reference for the transaction

  • customer_phonenumber (str) – Phone number of the customer.

  • amount (Union[int, str]) – The transaction amount.

  • currency (str) – The transaction currency (CDF or USD).

  • callbackUrl (str) – The Callback URL where the transaction result will be sent.

Returns:

a dict object with details code, message, orderNumber.

Return type:

dict

Description of Response Parameters

Code:

code to indicate the status of the request 0 if correctly received 1 if not correctly received.

Message:

A description of the response

OrderNumber:

FlexPay internal reference for the transaction.

A request is sent to the CallBack URL to provide status of the transaction.

Description fields of Result.

Code:

code to indicate the status of the request 0 if correctly received 1 if not correctly received.

Reference:

Your internal reference of the transaction

Provider_reference:

The transaction reference from the mobile money operator if the transaction was successful.

OrderNumber:

FlexPay internal reference of the transaction.