| Name | easy-monnify JSON |
| Version |
1.0.2
JSON |
| download |
| home_page | None |
| Summary | A python library to seamlessly integrate Monnify payment gateway into your projects |
| upload_time | 2024-08-19 10:05:05 |
| maintainer | None |
| docs_url | None |
| author | None |
| requires_python | >=3.8 |
| license | MIT |
| keywords |
|
| VCS |
 |
| bugtrack_url |
|
| requirements |
No requirements were recorded.
|
| Travis-CI |
No Travis.
|
| coveralls test coverage |
No coveralls.
|
.# easy_monnify
`easy_monnify` is a Python library that simplifies the interaction with the Monnify payment gateway. This library wraps around the Monnify API, allowing users to make **GET** and **POST** requests to various Monnify endpoints with ease, without needing to handle the complexities of crafting HTTP requests.
## Features
- Simple and intuitive interface for interacting with Monnify's API.
- Functions to perform common operations such as checking wallet balance, initiating transactions, and more.
- Easily extendable to add more endpoints as Monnify evolves.
## Registration
To use this library effectively, ensure you have created an account with monnify. if not, kindly create an account here [https://app.monnify.com/create-account](https://app.monnify.com/create-account)
## Installation
You can install this library using pip (once it's published):
```bash
pip install easy_monnify
```
## Usage
### Basic setup
First, you'll need to create an instance of the Monnify class by passing your contract code and wallet account number:
```python
from easy_monnify import Monnify
# Initialize the Monnify class with your API key, Client Secret Key and Environment
monnify = Monnify(apiKey="your_api_key", clientSecretKey="your_client_secret_key", environment="live")
# environment can either be "live" for production or "sandbox" for development.
# If no environment is specified, it defaults to "live"
```
### Available Functions
<table>
<thead>
<tr>
<th>Category</th>
<th>Functions</th>
</tr>
</thead>
<tbody>
<tr>
<td>Reserved Accounts</td>
<td>
<ul>
<li>Create Reserved Account</li>
<li>Get Reserved Account Details</li>
<li>Delete Reserved Accounts</li>
<li>Update BVN for Reserved Account</li>
</ul>
</td>
</tr>
<tr>
<td>Transactions</td>
<td>
<ul>
<li>Initiate A Transaction</li>
<li>Pay With Bank Transfer</li>
<li>Webhook Notification</li>
<li>Settlement Notification</li>
<li>Get A Transaction Details/ Verify Transaction</li>
</ul>
</td>
</tr>
<tr>
<td>Invoice Transactions (coming soon)</td>
<td>
<ul>
<li>Create Invoice</li>
<li>Get Invoice Details</li>
<li>Get All Invoice</li>
<li>Reserved Account Invoices</li>
<li>Webhook Notifications</li>
</ul>
</td>
</tr>
<tr>
<td>Sub Accounts/ Split Settlements</td>
<td>
<ul>
<li>Create Sub Account</li>
<li>Get All Sub Accounts</li>
<li>Update A Sub Account Info</li>
<li>Delete Sub Account</li>
</ul>
</td>
</tr>
<tr>
<td>Limit Transactions (coming soon)</td>
<td>
<ul>
<li>Create Limit Profile</li>
<li>Update Limit Profile</li>
<li>Get Limit Profiles</li>
<li>Reserve Account with Limit</li>
<li>Update A Reserve Account Limit</li>
</ul>
</td>
</tr>
<tr>
<td>Disbursement Transactions / Transfers</td>
<td>
<ul>
<li>Initiate A Single Transfer</li>
<li>Initiate A Bulk Transfer</li>
<li>Authorize A Single Transfer / Validate OTP</li>
<li>Authorize Bulk Transfer / Validate OTP</li>
<li>Resend OTP</li>
<li>Get Single Transfer Status</li>
<li>Get Bulk Transfer Status</li>
<li>Get All Transfers</li>
</ul>
</td>
</tr>
<tr>
<td>Wallet Account (coming soon)</td>
<td>
<ul>
<li>Get Wallet Balance</li>
<li>Get List of Banks (supported by Monnify) <a href="https://github.com/Rigantech/easy_monnify/blob/main/src/assets/banks.json">See sample list</a></li>
<li>Get All Available Bank USSDs (supported by Monnify) <a href="https://github.com/Rigantech/easy_monnify/blob/main/src/assets/banks_ussd.json">See sample list</a></li>
</ul>
</td>
</tr>
<tr>
<td>Bank Verification</td>
<td>
<ul>
<li>Verify Bank Account</li>
<li>Verify BVN Number (with Date of Birth)</li>
<li>Verify BVN Number (with Bank Account)</li>
</ul>
</td>
</tr>
</tbody>
</table>
### Usage
### Reserved Accounts
Reserved account APIs enable merchants create accounts that can be dedicated to each of their customers. Once any payment is done to that account, we notify your webhook with the payment information.
- Create Reserved Account
```python
data = monnify.createReservedAccount(
accountReference="reference_to_the_account", # generated by you to identify the account
accountName="name_of_account.",
currencyCode="NGN", # currency is in Naira
contractCode="your_monnify_account_contract_code",- # see Monnify dashboard
customerName="name_of_customer",
customerEmail="email_of_customer",
)
print(data)
```
- ```accountReference:``` String, Required
- ```accountName:``` String, Required
- ```currencyCode:``` String, Required, should be "NGN"
- ```contractCode:``` String, Required
- ```customerName:``` String, Required
- ```customerEmail:``` String, Required
#### sample response - success
```bash
# status 200
{
"requestSuccessful": true,
"responseMessage": "success",
"responseCode": "0",
"responseBody": {
"contractCode": "4876165459",
"accountReference": "jsnow1234",
"accountName": "John Snow Limited",
"currencyCode": "NGN",
"customerEmail": "john@snow.com",
"customerName": "John Snow Limited",
"accountNumber": "9879377424",
"bankName": "Providus Bank",
"bankCode": "101",
"status": "ACTIVE",
"createdOn": "2019-12-08 15:52:04.726",
"incomeSplitConfig": []
}
}
```
#### sample response - error
```bash
# status 400
{
"requestSuccessful": false,
"responseMessage": "Field contractCode cannot be null",
"responseCode": "99"
}
# status 401
{
"error": "invalid_token",
"error_description": "Access token expired: -geneerated_access_token"
}
# status 422
{
"requestSuccessful": false,
"responseMessage": "You can not reserve two accounts with the same reference",
"responseCode": "99"
}
```
- Get Reserved Account Details
```python
data = monnify.getReservedAccountDetails(
accountReference="reference_to_the_account"
)
print(data)
```
- ```accountReference:``` String, Required
#### sample response - success
```bash
# status 200
{
"requestSuccessful": true,
"responseMessage": "success",
"responseCode": "0",
"responseBody": {
"contractCode": "4876165459",
"accountReference": "Elmref6",
"accountName": "Elmer Martin",
"currencyCode": "NGN",
"customerEmail": "tobi@toio.com",
"customerName": "Mr Tobi",
"accountNumber": "3225593799",
"bankName": "Providus Bank",
"bankCode": "101",
"reservationReference": "L6KHK65ZSZJ23CKTFJKT",
"status": "ACTIVE",
"createdOn": "2019-11-05 12:03:16.0",
"contract": {
"name": "Default Contract",
"code": "4876165459",
"description": null,
"supportsAdvancedSettlementAccountSelection": false
},
"totalAmount": 10500,
"transactionCount": 3
}
}
```
#### sample response - error
```bash
# status 401
{
"error": "invalid_token",
"error_description": "Cannot convert access token to JSON"
}
# status 404
{
"requestSuccessful": false,
"responseMessage": "Cannot find reserved account",
"responseCode": "99"
}
```
- Delete Reserved Account
```python
data = monnify.deleteReservedAccount(
accountReference="reference_to_the_account"
)
print(data)
```
- ```accountReference:``` String, Required
#### sample response - success
```bash
# status 200
{
"requestSuccessful": true,
"responseMessage": "success",
"responseCode": "0",
"responseBody": {
"contractCode": "4876165459",
"accountReference": "1576076454948",
"accountName": "Test Payment",
"currencyCode": "NGN",
"customerEmail": "johndoe@email.com",
"customerName": "John Doe",
"accountNumber": "9749142778",
"bankName": "Providus Bank",
"bankCode": "101",
"reservationReference": "HJ2YVQ63VAHETLUB94FN",
"status": "ACTIVE",
"createdOn": "2019-12-11 15:00:56.0"
}
}
```
#### sample response - error
```bash
# status 401
{
"error": "invalid_token",
"error_description": "Cannot convert access token to JSON"
}
# status 404
{
"requestSuccessful": false,
"responseMessage": "Cannot find reserved account",
"responseCode": "99"
}
```
- Update BVN For Reserved Account
```python
data = monnify.updateBVN(
accountReference="reference_to_the_account",
bvn="bvn_of_account_owner"
)
print(data)
```
- ```accountReference:``` String, Required
- ```bvn:``` String, required
#### sample response - success
```bash
# status 200
{
"requestSuccessful": true,
"responseMessage": "success",
"responseCode": "00",
"responseBody": {
"bvn": "12345678901",
"accountReference": "ACC_REF_12345",
"accountName": "John Doe",
"accountNumber": "0123456789",
"bankCode": "101",
"bankName": "Providus Bank"
}
}
```
#### sample response - error
```bash
# status 401
{
"error": "invalid_token",
"error_description": "Cannot convert access token to JSON"
}
# status 404
{
"requestSuccessful": false,
"responseMessage": "Account not found",
"responseCode": "99"
}
{
"requestSuccessful": false,
"responseMessage": "BVN already associated with the account",
"responseCode": "01",
"bvn": "12345678901",
"accountReference": "ACC_REF_12345"
}
```
### Transactions
- Initiate Transaction
```python
data = monnify.initiateTransaction(
amount=100,
customerName="customer_full_name",
customerEmail="customerEmail", # e.g johndoe@gmail.com
paymentReference="unique_reference", # e.g ref1839238
paymentDescription="paymentDescription", # description of payment
currencyCode="NGN",
contractCode="contractCode", # see your monnify dashboard
redirectUrl="redirectUrl" # monnify redirect to this URL when transaction is completed
)
print(data)
```
- ```amount:``` Number, Required
- ```paymentReference:``` String, Required
- ```currencyCode:``` String, Required, should be "NGN"
- ```contractCode:``` String, Required
- ```customerName:``` String, Required
- ```customerEmail:``` String, Required
- ```redirectUrl:``` String, required
When transaction is initiated, monnify returns a checkoutUrl to make payment using monnify payment form
```Note:``` All transactions mst be initiated before using the bank transfer or payment with card options
#### sample response - success
```bash
# status 200
{
"requestSuccessful": true,
"responseMessage": "success",
"responseCode": "0",
"responseBody": {
"transactionReference": "MNFY|20191227150105|000223",
"paymentReference": "1577458865686",
"merchantName": "Tobi Limited",
"apiKey": "MK_TEST_VR7J3UAACH",
"enabledPaymentMethod": [
"ACCOUNT_TRANSFER"
],
"checkoutUrl": "https://sandbox.sdk.monnify.com/checkout/MNFY|20191227150105|000223",
"incomeSplitConfig": []
}
}
```
#### sample response - error
```bash
# status 400
{
"requestSuccessful": false,
"responseMessage": "Field contractCode cannot be null",
"responseCode": "99"
}
# status 403
{
"requestSuccessful": false,
"responseMessage": "Could not Authorize merchant",
"responseCode": "99"
}
# status 422
{
"requestSuccessful": false,
"responseMessage": "Duplicate payment reference",
"responseCode": "99"
}
```
- Pay With Bank Transfer
usually if you don't want to use monnify's payment form using the checkoutUrl returned after initiating transaction, you can use direct APIs for bank transfer.
Monnify will return an account number and bank for that transaction as well as an accountDuration specifying how long the account will last (10 minutes).
You can also pass an optional bank code parameter and Monnify will return a USSD string for payment from that bank.
```python
data = monnify.payWithBankTransfer(
transactionReference="Transaction reference returned by Monnify when the transaction was initialized",
bankCode="Bank Code for the bank's USSD string to be returned"
)
print(data)
```
- ```transactionReference:``` Number, Required
- ```bankCode:``` String, Optional
#### sample response - success
```bash
# status 200
{
"requestSuccessful": true,
"responseMessage": "success",
"responseCode": "0",
"responseBody": {
"accountNumber": "4878539561",
"accountName": "Is it working",
"bankName": "Providus Bank",
"bankCode": "101",
"accountDurationSeconds": 165, # transaction account expiration in seconds
"ussdPayment": "*737*2*100.00*4878539561#",
"requestTime": "2019-12-27T15:34:13",
"transactionReference": "MNFY|20191227150634|000260",
"paymentReference": "1577459193045",
"amount": 100,
"fee": 10,
"totalPayable": 100,
"collectionChannel": "API_NOTIFICATION",
"productInformation": null
}
}
```
#### sample response - error
```bash
# status 400
{
"requestSuccessful": false,
"responseMessage": "Field transactionReference cannot be null",
"responseCode": "99"
}
# status 403
{
"requestSuccessful": false,
"responseMessage": "Could not Authorize merchant",
"responseCode": "99"
}
# status 422
{
"requestSuccessful": false,
"responseMessage": "could not find specified bank",
"responseCode": "99"
}
```
- Webhook Notifications
When a transaction is processed successfully on Monnify, a webhook notification is sent to the webhook URL configured on the merchant's dashboard. merchant when a transaction has been processed successfully.
#### Account Transaction Notification
This is the notification sent when an account transaction is completed using bank transfer.
```bash
{
"transactionReference":"MNFY|20190920113413|000224",
"paymentReference":"1568979249981",
"amountPaid":"100.00",
"totalPayable":"100.00",
"paidOn":"20/09/2019 11:35:21",
"paymentStatus":"PAID",
"paymentDescription":"Is it working",
"transactionHash":"5a91ef93b91a0bfda95a19c18da4504506ba20f79d6c0fb9ec3907b56635e7b01360e2a9ffcb5bc1e1208df68688a6d0ce064bec968099d7466818b6826cfd66",
"currency":"NGN",
"paymentMethod":"ACCOUNT_TRANSFER",
"product":{
"type":"WEB_SDK",
"reference":"1568979249981"
},
"cardDetails":null,
"accountDetails":{
"accountName":"OLUWATOBI EMMANUEL AMIRA",
"accountNumber":"******7561",
"bankCode":"000015",
"amountPaid":"100.00"
},
"accountPayments":[
{
"accountName":"OLUWATOBI EMMANUEL AMIRA",
"accountNumber":"******7561",
"bankCode":"000015",
"amountPaid":"100.00"
}
],
"customer":{
"email":"stephen@ikhane.com",
"name":"Stephen Ikhane"
}
}
```
#### Card Transaction Notification
This is the notification sent when an account transaction is completed using a debit/credit card.
```bash
{
"transactionReference":"MNFY|20190920113413|000224",
"paymentReference":"1568979249981",
"amountPaid":"100.00",
"totalPayable":"100.00",
"paidOn":"20/09/2019 11:35:21",
"paymentStatus":"PAID",
"paymentDescription":"Is it working",
"transactionHash":"5a91ef93b91a0bfda95a19c18da4504506ba20f79d6c0fb9ec3907b56635e7b01360e2a9ffcb5bc1e1208df68688a6d0ce064bec968099d7466818b6826cfd66",
"currency":"NGN",
"paymentMethod":"ACCOUNT_TRANSFER",
"product":{
"type":"WEB_SDK",
"reference":"1568979249981"
},
"cardDetails": {
"cardType":null,
"authorizationCode":null,
"last4":"6871",
"expMonth":"08",
"expYear":"22",
"bin":"539941",
"reusable":false
},
"accountDetails": null,
"accountPayments": null,
"customer":{
"email":"stephen@ikhane.com",
"name":"Stephen Ikhane"
}
}
```
#### Calculating The Transaction Hash
When Monnify sends transaction notifications, they add a transaction hash for security reasons. They expect you to try to recreate the transaction hash and only honor the notification if it matches.
To calculate the hash value, use the information from the notification to call the following function;
```python
hash = monnify.createHashFromWebhook(
paymentReference="paymentReference",
amountPaid="amountPaid",
paidOn="paidOn",
transactionReference="transactionReference"
)
print(hash)
```
#### sample response
```bash
5a91ef93b91a0bfda95a19c18da4504506ba20f79d6c0fb9ec3907b56635e7b01360e2a9ffcb5bc1e1208df68688a6d0ce064bec968099d7466818b6826cfd66
```
- Settlement Notifications
This notification is sent when a merchant is settled. It is sent to the merchant's notification endpoint configured on the settings.
```bash
{
"settlementReference": "JDFHKHDLSJD",
"amount": 100000.00,
"destinationAccountNumber": "0802139801",
"destinationAccountName": "MERCHANT LIMITED",
"destinationBankCode": "058",
"destinationBankName": "GTBANK",
"settlementTime": "20/09/2019 11:35:21",
"transactionsCount": 1
}
```
- Verifying Transactions/ Get Transaction Details
On Monnify you can verify transactions using either the transactionReference automatically generated by Monnify.
```python
data = monnify.getTransactionDetails(
transactionReference="transaction_reference", # e.g ref1839238
)
print(data)
```
- ```transactiontReference:``` String, Required
#### sample response - success
```bash
# status 200
{
"requestSuccessful": true,
"responseMessage": "success",
"responseCode": "0",
"responseBody": {
"createdOn": "2019-09-24T08:00:59.000+0000",
"amount": 100,
"currencyCode": "NGN",
"customerName": "Stephen Ikhane",
"customerEmail": "stephen@ikhane.com",
"paymentDescription": "Test push payment config",
"paymentStatus": "PENDING",
"transactionReference": "MNFY|20190924080058|000004",
"paymentReference": "1569312056285"
}
}
```
#### sample response - error
```bash
# status 403
{
"requestSuccessful": false,
"responseMessage": "Could not Authorize merchant",
"responseCode": "99"
}
# status 404
{
"requestSuccessful": false,
"responseMessage": "Could not find transaction with the specified transaction reference",
"responseCode": "99"
}
```
### Sub Accounts / Split Settlements
With sub accounts, you can easily split a single payment across multiple accounts. This means for one transaction, Monnify can help you share the amount paid between up to 5 different accounts.
To use split payments, you need to create sub accounts. Sub accounts can be created and managed on the Monnify Dashboard or via APIs.
- Create A Sub Account
```python
data = monnify.createSubAccount(
bankCode="101", # bank code of sub account
accountNumber="0123456789", # account numer of sub account
email="accounts@monnify.com", # email of user account
splitPercentage="20" # percentage of payment to be received in this account
)
print(data)
```
- ```bankCode:``` String, Required
- ```accountNumber:``` String, Required
- ```email:``` String, Required
- ```splitPercentage:``` String, Required
#### sample response - success
```bash
# status 200
{
"requestSuccessful": true,
"responseMessage": "success",
"responseCode": "0",
"responseBody": [
{
"subAccountCode": "MFY_SUB_319452883328",
"accountNumber": "0123456789",
"accountName": "Customers Logistics Subaccount",
"currencyCode": "NGN",
"email": "accounts@monnify.com",
"bankCode": "101",
"bankName": "Providus",
"defaultSplitPercentage": 20
}
]
}
```
- Get All Sub Accounts
```python
data = monnify.getSubAccounts()
print(data)
```
#### sample response - success
```bash
# status 200
{
"requestSuccessful": true,
"responseMessage": "success",
"responseCode": "0",
"responseBody": [
{
"subAccountCode": "MFY_SUB_319452883328",
"accountNumber": "0123456789",
"accountName": "Customers Logistics Subaccount",
"currencyCode": "NGN",
"email": "accounts@monnify.com",
"bankCode": "101",
"bankName": "Providus",
"defaultSplitPercentage": 20
},
{
"subAccountCode": "MFY_SUB_8838656722391",
"accountNumber": "9876543210",
"accountName": "JANE, DOE SNOW",
"currencyCode": "NGN",
"email": "tamira2@gmail.com",
"bankCode": "057",
"bankName": "Zenith bank",
"defaultSplitPercentage": 50
}
]
}
```
- Update A Sub Account
```python
data = monnify.updateSubAccount(
subAccountCode="MFY_SUB_319452883328", # sub account code of the sub account to update
bankCode="058",
accountNumber="0123456789",
email="tamira3@gmail.com",
splitPercentage="25"
)
print(data)
```
#### sample response - success
```bash
# status 200
{
"requestSuccessful": true,
"responseMessage": "success",
"responseCode": "0",
"responseBody": [
{
"subAccountCode": "MFY_SUB_319452883328",
"accountNumber": "0123456789",
"accountName": "JOHN, DOE SNOW",
"currencyCode": "NGN",
"email": "tamira1@gmail.com",
"bankCode": "058",
"bankName": "GTBank",
"defaultSplitPercentage": 20
}
]
}
```
- Delete A Sub Account
```python
data = monnify.deleteSubAccount(
subAccountCode="MFY_SUB_319452883328", # sub account code of the sub account to delete
)
print(data)
```
#### sample response - success
```bash
# status 200
{
"requestSuccessful": true,
"responseMessage": "success",
"responseCode": "0"
}
```
### Disbursement Transactions / Transfers
The Monnify Disbursements APIs allow a merchant to initiate payouts from his Monnify Wallet to any bank account in Nigeria. They provide all the tools you need to enable you completely automate your disbursement processes.
- Initiate A Single Transfer
To initiate a single transfer, you will need to send a request to the endpoint. If the merchant does not have Two Factor Authentication (2FA) enabled, the transaction will be processed instantly as in the response. If 2FA is enabled, the response will indicate stutus as pending authorization.
```python
data = monnify.initiateSingleTransfer(
amount=100,
reference="reference12934",
narration="911 Transaction",
bankCode="058",
accountNumber="0111946768",
walletId="4794983C91374AD6B3ECD76F2BEA296D"
)
print(data)
```
- ```amount:``` Number, required; The amount to be disbursed to the beneficiary
- ```reference:``` String, required; The unique reference for a transaction. Also to be specified for each transaction in a bulk transaction request.
- ```narration:``` String, required; The Narration for the transactions being processed.
- ```bankCode:``` String, Required; The 3 digit bank code representing the destination bank.
- ```accountNumber:``` String, Required; The beneficiary account number.
- ```walletId:``` String, Required; Unique reference to identify the wallet to be debited.
#### sample response - success
```bash
# status 200
{
"requestSuccessful": true,
"responseMessage": "success",
"responseCode": "0",
"responseBody": {
"amount": 10,
"reference": "reference12934",
"status": "SUCCESS",
"dateCreated": "13/11/2019 09:34:32 PM"
}
}
# Pending Authorization
{
"requestSuccessful": true,
"responseMessage": "success",
"responseCode": "0",
"responseBody": {
"amount": 10,
"reference": "reference12934",
"status": "PENDING_AUTHORIZATION",
"dateCreated": "13/11/2019 08:48:32 PM"
}
}
```
- Initiate A Bulk Transfer
To initiate a bulk transfer, you will need to send a request to the endpoint. If the merchant does not have Two Factor Authentication (2FA) enabled, the transaction will be processed instantly as in the response. If 2FA is enabled, the response will indicate stutus as pending authorization.
When a bulk transfer request is sent, it is simply acknowledged by the system and then processed in the background. Monnify goes through each account to attempt to validate them and depending on what value is set for the onValidationFailure field, Monnify will either continue processing with the valid transfers or reject the entire batch.
Use ```BREAK``` to tell Monnify to reject the entire batch and use ```CONTINUE``` to tell Monnify to process the valid transactions.
```python
# define the lists of transactions to be performed
transaction_list = [
{
"amount": 1300,
"reference": "Final-Reference-1a",
"narration": "911 Transaction",
"bankCode": "058",
"accountNumber": "0111946768",
"currency": "NGN"
},
{
"amount": 570,
"reference": "Final-Reference-2a",
"narration": "911 Transaction",
"bankCode": "058",
"accountNumber": "0111946768",
"currency": "NGN"
},
{
"amount": 230,
"reference": "Final-Reference-3a",
"narration": "911 Transaction",
"bankCode": "058",
"accountNumber": "0111946768",
"currency": "NGN"
}
]
# make the request
data = monnify.initiateBulkTransfer(
title="title of the transfer",
batchReference="unique reference for batch",
narration="narration of the bulk transfer",
walletId="4794983C91374AD6B3ECD76F2BEA296D", #Unique reference to identify the wallet to be debited.
onValidationFailure="CONTINUE",
transactionList=transaction_list
)
print(data)
```
#### sample response - success
```bash
# status 200
{
"requestSuccessful": true,
"responseMessage": "success",
"responseCode": "0",
"responseBody": {
"totalAmount": 2108.48,
"totalFee": 8.48,
"batchReference": "batch-1573681308355",
"batchStatus": "COMPLETED",
"totalTransactions": 3,
"dateCreated": "13/11/2019 09:42:06 PM"
}
}
# Pending Authorization
{
"requestSuccessful": true,
"responseMessage": "success",
"responseCode": "0",
"responseBody": {
"totalAmount": 2108.48,
"totalFee": 8.48,
"batchReference": "batch-1573684027157",
"batchStatus": "PENDING_AUTHORIZATION",
"totalTransactions": 3,
"dateCreated": "13/11/2019 10:27:25 PM"
}
}
```
- Authorize A Single Transfer
To authorize a single transfer for 2FA, you will need to send the following request
```python
data = monnify.authorizeSingleTransfer(
reference="reference12934",
authorizationCode="40538652"
)
print(data)
```
- ```reference:``` String, required; The unique reference for a transaction.
- ```authorizationCode:``` String, required; The One Time Password sent to the specified email to be used to authenticate the transaction.
#### sample response - success
```bash
# status 200
{
"requestSuccessful": true,
"responseMessage": "success",
"responseCode": "0",
"responseBody": {
"amount": 10,
"reference": "reference12934",
"status": "SUCCESS",
"dateCreated": "13/11/2019 09:34:32 PM"
}
}
```
- Authorize Bulk Transfer
To authorize a bulk transfer for 2FA, you will need to send the following request
```python
data = monnify.authorizeBulkTransfer(
reference="batch-reference12934",
authorizationCode="40538652"
)
print(data)
```
- ```reference:``` String, required; The unique reference for batch transaction Also to be specified for each transaction in a bulk transaction request
- ```authorizationCode:``` String, required; The One Time Password sent to the specified email to be used to authenticate the transaction.
#### sample response - success
```bash
# status 200
{
"requestSuccessful": true,
"responseMessage": "success",
"responseCode": "0",
"responseBody": {
"amount": 10,
"reference": "batch-reference12934",
"status": "SUCCESS",
"dateCreated": "13/11/2019 09:34:32 PM"
}
}
```
- Resend OTP
To resend OTP for 2FA, you will need to send the following request.
```python
data = monnify.resendOTP(
reference="reference"
)
print(data)
```
- ```reference:``` String, required; The unique reference for batch transaction Also to be specified for each transaction in a bulk transaction request
#### sample response - success
```bash
# status 200
{
"requestSuccessful": true,
"responseMessage": "success",
"responseCode": "0",
"responseBody": {
"message": "Authorization code will be processed and sent to predefined email addresses(s)"
}
}
```
- Get Single Transfer Status
```python
data = monnify.getSingleTransferStatus(
reference="reference"
)
print(data)
```
- ```reference:``` String, required; The unique reference for single transaction
#### sample response - success
```bash
# status 200
{
"requestSuccessful": true,
"responseMessage": "success",
"responseCode": "0",
"responseBody": {
"amount": 230,
"reference": "Final-Reference-3a",
"narration": "911 Transaction",
"bankCode": "058",
"accountNumber": "0111946768",
"currency": "NGN",
"accountName": "MEKILIUWA, SMART CHINONSO",
"bankName": "GTBank",
"dateCreated": "13/11/2019 09:42:07 PM",
"fee": 1,
"status": "SUCCESS"
}
}
```
- Get Bulk Transfer Status
```python
data = monnify.getBulkTransferStatus(
reference="reference"
)
print(data)
```
- ```reference:``` String, required; The unique reference for bulk transaction
#### sample response - success
```bash
# status 200
{
"requestSuccessful": true,
"responseMessage": "success",
"responseCode": "0",
"responseBody": {
"title": "Final Batch - Continue on Failure",
"totalAmount": 2108.48,
"totalFee": 8.48,
"batchReference": "batchreference12934",
"totalTransactions": 3,
"failedCount": 0,
"successfulCount": 0,
"pendingCount": 3,
"batchStatus": "AWAITING_PROCESSING",
"dateCreated": "13/11/2019 10:45:08 PM"
}
}
```
Raw data
{
"_id": null,
"home_page": null,
"name": "easy-monnify",
"maintainer": null,
"docs_url": null,
"requires_python": ">=3.8",
"maintainer_email": null,
"keywords": null,
"author": null,
"author_email": "Rigan Tech <rigantech@gmail.com>",
"download_url": "https://files.pythonhosted.org/packages/25/0b/e43cc744f6907910997973de952dbee8d2198aae54e057739ffcfbc41670/easy_monnify-1.0.2.tar.gz",
"platform": null,
"description": ".# easy_monnify\r\n\r\n`easy_monnify` is a Python library that simplifies the interaction with the Monnify payment gateway. This library wraps around the Monnify API, allowing users to make **GET** and **POST** requests to various Monnify endpoints with ease, without needing to handle the complexities of crafting HTTP requests.\r\n\r\n## Features\r\n- Simple and intuitive interface for interacting with Monnify's API.\r\n- Functions to perform common operations such as checking wallet balance, initiating transactions, and more.\r\n- Easily extendable to add more endpoints as Monnify evolves.\r\n\r\n## Registration\r\nTo use this library effectively, ensure you have created an account with monnify. if not, kindly create an account here [https://app.monnify.com/create-account](https://app.monnify.com/create-account)\r\n\r\n## Installation\r\n\r\nYou can install this library using pip (once it's published):\r\n```bash\r\npip install easy_monnify\r\n```\r\n\r\n## Usage\r\n### Basic setup\r\n\r\nFirst, you'll need to create an instance of the Monnify class by passing your contract code and wallet account number:\r\n```python\r\nfrom easy_monnify import Monnify\r\n\r\n# Initialize the Monnify class with your API key, Client Secret Key and Environment\r\nmonnify = Monnify(apiKey=\"your_api_key\", clientSecretKey=\"your_client_secret_key\", environment=\"live\")\r\n# environment can either be \"live\" for production or \"sandbox\" for development.\r\n# If no environment is specified, it defaults to \"live\"\r\n```\r\n\r\n### Available Functions\r\n\r\n<table>\r\n <thead>\r\n <tr>\r\n <th>Category</th>\r\n <th>Functions</th>\r\n </tr>\r\n </thead>\r\n <tbody>\r\n <tr>\r\n <td>Reserved Accounts</td>\r\n <td>\r\n <ul>\r\n <li>Create Reserved Account</li>\r\n <li>Get Reserved Account Details</li>\r\n <li>Delete Reserved Accounts</li>\r\n <li>Update BVN for Reserved Account</li>\r\n </ul>\r\n </td>\r\n </tr>\r\n <tr>\r\n <td>Transactions</td>\r\n <td>\r\n <ul>\r\n <li>Initiate A Transaction</li>\r\n <li>Pay With Bank Transfer</li>\r\n <li>Webhook Notification</li>\r\n <li>Settlement Notification</li>\r\n <li>Get A Transaction Details/ Verify Transaction</li>\r\n </ul>\r\n </td>\r\n </tr>\r\n <tr>\r\n <td>Invoice Transactions (coming soon)</td>\r\n <td>\r\n <ul>\r\n <li>Create Invoice</li>\r\n <li>Get Invoice Details</li>\r\n <li>Get All Invoice</li>\r\n <li>Reserved Account Invoices</li>\r\n <li>Webhook Notifications</li>\r\n </ul>\r\n </td>\r\n </tr>\r\n <tr>\r\n <td>Sub Accounts/ Split Settlements</td>\r\n <td>\r\n <ul>\r\n <li>Create Sub Account</li>\r\n <li>Get All Sub Accounts</li>\r\n <li>Update A Sub Account Info</li>\r\n <li>Delete Sub Account</li>\r\n </ul>\r\n </td>\r\n </tr>\r\n <tr>\r\n <td>Limit Transactions (coming soon)</td>\r\n <td>\r\n <ul>\r\n <li>Create Limit Profile</li>\r\n <li>Update Limit Profile</li>\r\n <li>Get Limit Profiles</li>\r\n <li>Reserve Account with Limit</li>\r\n <li>Update A Reserve Account Limit</li>\r\n </ul>\r\n </td>\r\n </tr>\r\n <tr>\r\n <td>Disbursement Transactions / Transfers</td>\r\n <td>\r\n <ul>\r\n <li>Initiate A Single Transfer</li>\r\n <li>Initiate A Bulk Transfer</li>\r\n <li>Authorize A Single Transfer / Validate OTP</li>\r\n <li>Authorize Bulk Transfer / Validate OTP</li>\r\n <li>Resend OTP</li>\r\n <li>Get Single Transfer Status</li>\r\n <li>Get Bulk Transfer Status</li>\r\n <li>Get All Transfers</li>\r\n </ul>\r\n </td>\r\n </tr>\r\n <tr>\r\n <td>Wallet Account (coming soon)</td>\r\n <td>\r\n <ul>\r\n <li>Get Wallet Balance</li>\r\n <li>Get List of Banks (supported by Monnify) <a href=\"https://github.com/Rigantech/easy_monnify/blob/main/src/assets/banks.json\">See sample list</a></li>\r\n <li>Get All Available Bank USSDs (supported by Monnify) <a href=\"https://github.com/Rigantech/easy_monnify/blob/main/src/assets/banks_ussd.json\">See sample list</a></li>\r\n </ul>\r\n </td>\r\n </tr>\r\n <tr>\r\n <td>Bank Verification</td>\r\n <td>\r\n <ul>\r\n <li>Verify Bank Account</li>\r\n <li>Verify BVN Number (with Date of Birth)</li>\r\n <li>Verify BVN Number (with Bank Account)</li>\r\n </ul>\r\n </td>\r\n </tr>\r\n </tbody>\r\n</table>\r\n\r\n### Usage\r\n\r\n### Reserved Accounts\r\nReserved account APIs enable merchants create accounts that can be dedicated to each of their customers. Once any payment is done to that account, we notify your webhook with the payment information.\r\n- Create Reserved Account\r\n ```python\r\n data = monnify.createReservedAccount(\r\n accountReference=\"reference_to_the_account\", # generated by you to identify the account\r\n accountName=\"name_of_account.\",\r\n currencyCode=\"NGN\", # currency is in Naira\r\n contractCode=\"your_monnify_account_contract_code\",- # see Monnify dashboard\r\n customerName=\"name_of_customer\",\r\n customerEmail=\"email_of_customer\",\r\n )\r\n print(data)\r\n ```\r\n - ```accountReference:``` String, Required\r\n - ```accountName:``` String, Required\r\n - ```currencyCode:``` String, Required, should be \"NGN\"\r\n - ```contractCode:``` String, Required\r\n - ```customerName:``` String, Required\r\n - ```customerEmail:``` String, Required\r\n\r\n #### sample response - success\r\n ```bash\r\n # status 200\r\n {\r\n \"requestSuccessful\": true,\r\n \"responseMessage\": \"success\",\r\n \"responseCode\": \"0\",\r\n \"responseBody\": {\r\n \"contractCode\": \"4876165459\",\r\n \"accountReference\": \"jsnow1234\",\r\n \"accountName\": \"John Snow Limited\",\r\n \"currencyCode\": \"NGN\",\r\n \"customerEmail\": \"john@snow.com\",\r\n \"customerName\": \"John Snow Limited\",\r\n \"accountNumber\": \"9879377424\",\r\n \"bankName\": \"Providus Bank\",\r\n \"bankCode\": \"101\",\r\n \"status\": \"ACTIVE\",\r\n \"createdOn\": \"2019-12-08 15:52:04.726\",\r\n \"incomeSplitConfig\": []\r\n }\r\n }\r\n ```\r\n #### sample response - error\r\n ```bash\r\n # status 400\r\n {\r\n \"requestSuccessful\": false,\r\n \"responseMessage\": \"Field contractCode cannot be null\",\r\n \"responseCode\": \"99\"\r\n }\r\n\r\n # status 401\r\n {\r\n \"error\": \"invalid_token\",\r\n \"error_description\": \"Access token expired: -geneerated_access_token\"\r\n }\r\n\r\n # status 422\r\n {\r\n \"requestSuccessful\": false,\r\n \"responseMessage\": \"You can not reserve two accounts with the same reference\",\r\n \"responseCode\": \"99\"\r\n }\r\n ```\r\n\r\n- Get Reserved Account Details\r\n ```python\r\n data = monnify.getReservedAccountDetails(\r\n accountReference=\"reference_to_the_account\"\r\n )\r\n print(data)\r\n ```\r\n - ```accountReference:``` String, Required\r\n\r\n #### sample response - success\r\n ```bash\r\n # status 200\r\n {\r\n \"requestSuccessful\": true,\r\n \"responseMessage\": \"success\",\r\n \"responseCode\": \"0\",\r\n \"responseBody\": {\r\n \"contractCode\": \"4876165459\",\r\n \"accountReference\": \"Elmref6\",\r\n \"accountName\": \"Elmer Martin\",\r\n \"currencyCode\": \"NGN\",\r\n \"customerEmail\": \"tobi@toio.com\",\r\n \"customerName\": \"Mr Tobi\",\r\n \"accountNumber\": \"3225593799\",\r\n \"bankName\": \"Providus Bank\",\r\n \"bankCode\": \"101\",\r\n \"reservationReference\": \"L6KHK65ZSZJ23CKTFJKT\",\r\n \"status\": \"ACTIVE\",\r\n \"createdOn\": \"2019-11-05 12:03:16.0\",\r\n \"contract\": {\r\n \"name\": \"Default Contract\",\r\n \"code\": \"4876165459\",\r\n \"description\": null,\r\n \"supportsAdvancedSettlementAccountSelection\": false\r\n },\r\n \"totalAmount\": 10500,\r\n \"transactionCount\": 3\r\n }\r\n }\r\n ```\r\n #### sample response - error\r\n ```bash\r\n # status 401\r\n {\r\n \"error\": \"invalid_token\",\r\n \"error_description\": \"Cannot convert access token to JSON\"\r\n }\r\n\r\n # status 404\r\n {\r\n \"requestSuccessful\": false,\r\n \"responseMessage\": \"Cannot find reserved account\",\r\n \"responseCode\": \"99\"\r\n }\r\n ```\r\n\r\n- Delete Reserved Account\r\n ```python\r\n data = monnify.deleteReservedAccount(\r\n accountReference=\"reference_to_the_account\"\r\n )\r\n print(data)\r\n ```\r\n - ```accountReference:``` String, Required\r\n\r\n #### sample response - success\r\n ```bash\r\n # status 200\r\n {\r\n \"requestSuccessful\": true,\r\n \"responseMessage\": \"success\",\r\n \"responseCode\": \"0\",\r\n \"responseBody\": {\r\n \"contractCode\": \"4876165459\",\r\n \"accountReference\": \"1576076454948\",\r\n \"accountName\": \"Test Payment\",\r\n \"currencyCode\": \"NGN\",\r\n \"customerEmail\": \"johndoe@email.com\",\r\n \"customerName\": \"John Doe\",\r\n \"accountNumber\": \"9749142778\",\r\n \"bankName\": \"Providus Bank\",\r\n \"bankCode\": \"101\",\r\n \"reservationReference\": \"HJ2YVQ63VAHETLUB94FN\",\r\n \"status\": \"ACTIVE\",\r\n \"createdOn\": \"2019-12-11 15:00:56.0\"\r\n }\r\n }\r\n ```\r\n #### sample response - error\r\n ```bash\r\n # status 401\r\n {\r\n \"error\": \"invalid_token\",\r\n \"error_description\": \"Cannot convert access token to JSON\"\r\n }\r\n\r\n # status 404\r\n {\r\n \"requestSuccessful\": false,\r\n \"responseMessage\": \"Cannot find reserved account\",\r\n \"responseCode\": \"99\"\r\n }\r\n ```\r\n\r\n\r\n\r\n\r\n- Update BVN For Reserved Account\r\n ```python\r\n data = monnify.updateBVN(\r\n accountReference=\"reference_to_the_account\",\r\n bvn=\"bvn_of_account_owner\"\r\n )\r\n print(data)\r\n ```\r\n - ```accountReference:``` String, Required\r\n - ```bvn:``` String, required\r\n\r\n #### sample response - success\r\n ```bash\r\n # status 200\r\n {\r\n \"requestSuccessful\": true,\r\n \"responseMessage\": \"success\",\r\n \"responseCode\": \"00\",\r\n \"responseBody\": {\r\n \"bvn\": \"12345678901\",\r\n \"accountReference\": \"ACC_REF_12345\",\r\n \"accountName\": \"John Doe\",\r\n \"accountNumber\": \"0123456789\",\r\n \"bankCode\": \"101\",\r\n \"bankName\": \"Providus Bank\"\r\n }\r\n }\r\n ```\r\n #### sample response - error\r\n ```bash\r\n # status 401\r\n {\r\n \"error\": \"invalid_token\",\r\n \"error_description\": \"Cannot convert access token to JSON\"\r\n }\r\n\r\n # status 404\r\n {\r\n \"requestSuccessful\": false,\r\n \"responseMessage\": \"Account not found\",\r\n \"responseCode\": \"99\"\r\n }\r\n\r\n {\r\n \"requestSuccessful\": false,\r\n \"responseMessage\": \"BVN already associated with the account\",\r\n \"responseCode\": \"01\",\r\n \"bvn\": \"12345678901\",\r\n \"accountReference\": \"ACC_REF_12345\"\r\n }\r\n ```\r\n\r\n### Transactions\r\n- Initiate Transaction\r\n ```python\r\n data = monnify.initiateTransaction(\r\n amount=100,\r\n customerName=\"customer_full_name\",\r\n customerEmail=\"customerEmail\", # e.g johndoe@gmail.com\r\n paymentReference=\"unique_reference\", # e.g ref1839238\r\n paymentDescription=\"paymentDescription\", # description of payment\r\n currencyCode=\"NGN\",\r\n contractCode=\"contractCode\", # see your monnify dashboard\r\n redirectUrl=\"redirectUrl\" # monnify redirect to this URL when transaction is completed\r\n )\r\n print(data)\r\n ```\r\n - ```amount:``` Number, Required\r\n - ```paymentReference:``` String, Required\r\n - ```currencyCode:``` String, Required, should be \"NGN\"\r\n - ```contractCode:``` String, Required\r\n - ```customerName:``` String, Required\r\n - ```customerEmail:``` String, Required\r\n - ```redirectUrl:``` String, required\r\n When transaction is initiated, monnify returns a checkoutUrl to make payment using monnify payment form\r\n ```Note:``` All transactions mst be initiated before using the bank transfer or payment with card options \r\n\r\n #### sample response - success\r\n ```bash\r\n # status 200\r\n {\r\n \"requestSuccessful\": true,\r\n \"responseMessage\": \"success\",\r\n \"responseCode\": \"0\",\r\n \"responseBody\": {\r\n \"transactionReference\": \"MNFY|20191227150105|000223\",\r\n \"paymentReference\": \"1577458865686\",\r\n \"merchantName\": \"Tobi Limited\",\r\n \"apiKey\": \"MK_TEST_VR7J3UAACH\",\r\n \"enabledPaymentMethod\": [\r\n \"ACCOUNT_TRANSFER\"\r\n ],\r\n \"checkoutUrl\": \"https://sandbox.sdk.monnify.com/checkout/MNFY|20191227150105|000223\",\r\n \"incomeSplitConfig\": []\r\n }\r\n }\r\n ```\r\n #### sample response - error\r\n ```bash\r\n # status 400\r\n {\r\n \"requestSuccessful\": false,\r\n \"responseMessage\": \"Field contractCode cannot be null\",\r\n \"responseCode\": \"99\"\r\n }\r\n\r\n # status 403\r\n {\r\n \"requestSuccessful\": false,\r\n \"responseMessage\": \"Could not Authorize merchant\",\r\n \"responseCode\": \"99\"\r\n }\r\n\r\n # status 422\r\n {\r\n \"requestSuccessful\": false,\r\n \"responseMessage\": \"Duplicate payment reference\",\r\n \"responseCode\": \"99\"\r\n }\r\n ```\r\n\r\n- Pay With Bank Transfer\r\n usually if you don't want to use monnify's payment form using the checkoutUrl returned after initiating transaction, you can use direct APIs for bank transfer. \r\n Monnify will return an account number and bank for that transaction as well as an accountDuration specifying how long the account will last (10 minutes). \r\n You can also pass an optional bank code parameter and Monnify will return a USSD string for payment from that bank.\r\n ```python\r\n data = monnify.payWithBankTransfer(\r\n transactionReference=\"Transaction reference returned by Monnify when the transaction was initialized\",\r\n bankCode=\"Bank Code for the bank's USSD string to be returned\"\r\n )\r\n print(data)\r\n ```\r\n - ```transactionReference:``` Number, Required\r\n - ```bankCode:``` String, Optional\r\n\r\n #### sample response - success\r\n ```bash\r\n # status 200\r\n {\r\n \"requestSuccessful\": true,\r\n \"responseMessage\": \"success\",\r\n \"responseCode\": \"0\",\r\n \"responseBody\": {\r\n \"accountNumber\": \"4878539561\",\r\n \"accountName\": \"Is it working\",\r\n \"bankName\": \"Providus Bank\",\r\n \"bankCode\": \"101\",\r\n \"accountDurationSeconds\": 165, # transaction account expiration in seconds\r\n \"ussdPayment\": \"*737*2*100.00*4878539561#\",\r\n \"requestTime\": \"2019-12-27T15:34:13\",\r\n \"transactionReference\": \"MNFY|20191227150634|000260\",\r\n \"paymentReference\": \"1577459193045\",\r\n \"amount\": 100,\r\n \"fee\": 10,\r\n \"totalPayable\": 100,\r\n \"collectionChannel\": \"API_NOTIFICATION\",\r\n \"productInformation\": null\r\n }\r\n }\r\n ```\r\n #### sample response - error\r\n ```bash\r\n # status 400\r\n {\r\n \"requestSuccessful\": false,\r\n \"responseMessage\": \"Field transactionReference cannot be null\",\r\n \"responseCode\": \"99\"\r\n }\r\n\r\n # status 403\r\n {\r\n \"requestSuccessful\": false,\r\n \"responseMessage\": \"Could not Authorize merchant\",\r\n \"responseCode\": \"99\"\r\n }\r\n\r\n # status 422\r\n {\r\n \"requestSuccessful\": false,\r\n \"responseMessage\": \"could not find specified bank\",\r\n \"responseCode\": \"99\"\r\n }\r\n ```\r\n\r\n- Webhook Notifications\r\n When a transaction is processed successfully on Monnify, a webhook notification is sent to the webhook URL configured on the merchant's dashboard. merchant when a transaction has been processed successfully. \r\n #### Account Transaction Notification\r\n This is the notification sent when an account transaction is completed using bank transfer.\r\n ```bash\r\n {\r\n \"transactionReference\":\"MNFY|20190920113413|000224\",\r\n \"paymentReference\":\"1568979249981\",\r\n \"amountPaid\":\"100.00\",\r\n \"totalPayable\":\"100.00\",\r\n \"paidOn\":\"20/09/2019 11:35:21\",\r\n \"paymentStatus\":\"PAID\",\r\n \"paymentDescription\":\"Is it working\",\r\n \"transactionHash\":\"5a91ef93b91a0bfda95a19c18da4504506ba20f79d6c0fb9ec3907b56635e7b01360e2a9ffcb5bc1e1208df68688a6d0ce064bec968099d7466818b6826cfd66\",\r\n \"currency\":\"NGN\",\r\n \"paymentMethod\":\"ACCOUNT_TRANSFER\",\r\n \"product\":{\r\n \"type\":\"WEB_SDK\",\r\n \"reference\":\"1568979249981\"\r\n },\r\n \"cardDetails\":null,\r\n \"accountDetails\":{\r\n \"accountName\":\"OLUWATOBI EMMANUEL AMIRA\",\r\n \"accountNumber\":\"******7561\",\r\n \"bankCode\":\"000015\",\r\n \"amountPaid\":\"100.00\"\r\n },\r\n \"accountPayments\":[\r\n {\r\n \"accountName\":\"OLUWATOBI EMMANUEL AMIRA\",\r\n \"accountNumber\":\"******7561\",\r\n \"bankCode\":\"000015\",\r\n \"amountPaid\":\"100.00\"\r\n }\r\n ],\r\n \"customer\":{\r\n \"email\":\"stephen@ikhane.com\",\r\n \"name\":\"Stephen Ikhane\"\r\n }\r\n } \r\n ```\r\n #### Card Transaction Notification\r\n This is the notification sent when an account transaction is completed using a debit/credit card.\r\n ```bash\r\n {\r\n \"transactionReference\":\"MNFY|20190920113413|000224\",\r\n \"paymentReference\":\"1568979249981\",\r\n \"amountPaid\":\"100.00\",\r\n \"totalPayable\":\"100.00\",\r\n \"paidOn\":\"20/09/2019 11:35:21\",\r\n \"paymentStatus\":\"PAID\",\r\n \"paymentDescription\":\"Is it working\",\r\n \"transactionHash\":\"5a91ef93b91a0bfda95a19c18da4504506ba20f79d6c0fb9ec3907b56635e7b01360e2a9ffcb5bc1e1208df68688a6d0ce064bec968099d7466818b6826cfd66\",\r\n \"currency\":\"NGN\",\r\n \"paymentMethod\":\"ACCOUNT_TRANSFER\",\r\n \"product\":{\r\n \"type\":\"WEB_SDK\",\r\n \"reference\":\"1568979249981\"\r\n },\r\n \"cardDetails\": {\r\n \"cardType\":null,\r\n \"authorizationCode\":null,\r\n \"last4\":\"6871\",\r\n \"expMonth\":\"08\",\r\n \"expYear\":\"22\",\r\n \"bin\":\"539941\",\r\n \"reusable\":false \r\n },\r\n \"accountDetails\": null,\r\n \"accountPayments\": null,\r\n \"customer\":{\r\n \"email\":\"stephen@ikhane.com\",\r\n \"name\":\"Stephen Ikhane\"\r\n }\r\n }\r\n ```\r\n #### Calculating The Transaction Hash\r\n When Monnify sends transaction notifications, they add a transaction hash for security reasons. They expect you to try to recreate the transaction hash and only honor the notification if it matches. \r\n To calculate the hash value, use the information from the notification to call the following function;\r\n ```python\r\n hash = monnify.createHashFromWebhook(\r\n paymentReference=\"paymentReference\",\r\n amountPaid=\"amountPaid\",\r\n paidOn=\"paidOn\",\r\n transactionReference=\"transactionReference\"\r\n )\r\n print(hash)\r\n ```\r\n #### sample response\r\n ```bash\r\n 5a91ef93b91a0bfda95a19c18da4504506ba20f79d6c0fb9ec3907b56635e7b01360e2a9ffcb5bc1e1208df68688a6d0ce064bec968099d7466818b6826cfd66\r\n ```\r\n\r\n- Settlement Notifications\r\n This notification is sent when a merchant is settled. It is sent to the merchant's notification endpoint configured on the settings.\r\n ```bash\r\n {\r\n \"settlementReference\": \"JDFHKHDLSJD\",\r\n \"amount\": 100000.00,\r\n \"destinationAccountNumber\": \"0802139801\",\r\n \"destinationAccountName\": \"MERCHANT LIMITED\",\r\n \"destinationBankCode\": \"058\",\r\n \"destinationBankName\": \"GTBANK\",\r\n \"settlementTime\": \"20/09/2019 11:35:21\",\r\n \"transactionsCount\": 1\r\n }\r\n ```\r\n\r\n- Verifying Transactions/ Get Transaction Details\r\n On Monnify you can verify transactions using either the transactionReference automatically generated by Monnify.\r\n ```python\r\n data = monnify.getTransactionDetails(\r\n transactionReference=\"transaction_reference\", # e.g ref1839238\r\n )\r\n print(data)\r\n ```\r\n - ```transactiontReference:``` String, Required\r\n\r\n #### sample response - success\r\n ```bash\r\n # status 200\r\n {\r\n \"requestSuccessful\": true,\r\n \"responseMessage\": \"success\",\r\n \"responseCode\": \"0\",\r\n \"responseBody\": {\r\n \"createdOn\": \"2019-09-24T08:00:59.000+0000\",\r\n \"amount\": 100,\r\n \"currencyCode\": \"NGN\",\r\n \"customerName\": \"Stephen Ikhane\",\r\n \"customerEmail\": \"stephen@ikhane.com\",\r\n \"paymentDescription\": \"Test push payment config\",\r\n \"paymentStatus\": \"PENDING\",\r\n \"transactionReference\": \"MNFY|20190924080058|000004\",\r\n \"paymentReference\": \"1569312056285\"\r\n }\r\n }\r\n ```\r\n #### sample response - error\r\n ```bash\r\n # status 403\r\n {\r\n \"requestSuccessful\": false,\r\n \"responseMessage\": \"Could not Authorize merchant\",\r\n \"responseCode\": \"99\"\r\n }\r\n\r\n # status 404\r\n {\r\n \"requestSuccessful\": false,\r\n \"responseMessage\": \"Could not find transaction with the specified transaction reference\",\r\n \"responseCode\": \"99\"\r\n }\r\n ```\r\n\r\n\r\n### Sub Accounts / Split Settlements\r\nWith sub accounts, you can easily split a single payment across multiple accounts. This means for one transaction, Monnify can help you share the amount paid between up to 5 different accounts. \r\nTo use split payments, you need to create sub accounts. Sub accounts can be created and managed on the Monnify Dashboard or via APIs.\r\n- Create A Sub Account\r\n ```python\r\n data = monnify.createSubAccount(\r\n bankCode=\"101\", # bank code of sub account\r\n accountNumber=\"0123456789\", # account numer of sub account\r\n email=\"accounts@monnify.com\", # email of user account\r\n splitPercentage=\"20\" # percentage of payment to be received in this account\r\n )\r\n print(data)\r\n ```\r\n - ```bankCode:``` String, Required\r\n - ```accountNumber:``` String, Required\r\n - ```email:``` String, Required\r\n - ```splitPercentage:``` String, Required\r\n\r\n #### sample response - success\r\n ```bash\r\n # status 200\r\n {\r\n \"requestSuccessful\": true,\r\n \"responseMessage\": \"success\",\r\n \"responseCode\": \"0\",\r\n \"responseBody\": [\r\n {\r\n \"subAccountCode\": \"MFY_SUB_319452883328\",\r\n \"accountNumber\": \"0123456789\",\r\n \"accountName\": \"Customers Logistics Subaccount\",\r\n \"currencyCode\": \"NGN\",\r\n \"email\": \"accounts@monnify.com\",\r\n \"bankCode\": \"101\",\r\n \"bankName\": \"Providus\",\r\n \"defaultSplitPercentage\": 20\r\n }\r\n ]\r\n }\r\n ```\r\n\r\n- Get All Sub Accounts\r\n ```python\r\n data = monnify.getSubAccounts()\r\n print(data)\r\n ```\r\n #### sample response - success\r\n ```bash\r\n # status 200\r\n {\r\n \"requestSuccessful\": true,\r\n \"responseMessage\": \"success\",\r\n \"responseCode\": \"0\",\r\n \"responseBody\": [\r\n {\r\n \"subAccountCode\": \"MFY_SUB_319452883328\",\r\n \"accountNumber\": \"0123456789\",\r\n \"accountName\": \"Customers Logistics Subaccount\",\r\n \"currencyCode\": \"NGN\",\r\n \"email\": \"accounts@monnify.com\",\r\n \"bankCode\": \"101\",\r\n \"bankName\": \"Providus\",\r\n \"defaultSplitPercentage\": 20\r\n },\r\n {\r\n \"subAccountCode\": \"MFY_SUB_8838656722391\",\r\n \"accountNumber\": \"9876543210\",\r\n \"accountName\": \"JANE, DOE SNOW\",\r\n \"currencyCode\": \"NGN\",\r\n \"email\": \"tamira2@gmail.com\",\r\n \"bankCode\": \"057\",\r\n \"bankName\": \"Zenith bank\",\r\n \"defaultSplitPercentage\": 50\r\n }\r\n ]\r\n }\r\n ```\r\n\r\n- Update A Sub Account\r\n ```python\r\n data = monnify.updateSubAccount(\r\n subAccountCode=\"MFY_SUB_319452883328\", # sub account code of the sub account to update\r\n bankCode=\"058\",\r\n accountNumber=\"0123456789\",\r\n email=\"tamira3@gmail.com\",\r\n splitPercentage=\"25\"\r\n )\r\n print(data)\r\n ```\r\n #### sample response - success\r\n ```bash\r\n # status 200\r\n {\r\n \"requestSuccessful\": true,\r\n \"responseMessage\": \"success\",\r\n \"responseCode\": \"0\",\r\n \"responseBody\": [\r\n {\r\n \"subAccountCode\": \"MFY_SUB_319452883328\",\r\n \"accountNumber\": \"0123456789\",\r\n \"accountName\": \"JOHN, DOE SNOW\",\r\n \"currencyCode\": \"NGN\",\r\n \"email\": \"tamira1@gmail.com\",\r\n \"bankCode\": \"058\",\r\n \"bankName\": \"GTBank\",\r\n \"defaultSplitPercentage\": 20\r\n }\r\n ]\r\n }\r\n ```\r\n\r\n- Delete A Sub Account\r\n ```python\r\n data = monnify.deleteSubAccount(\r\n subAccountCode=\"MFY_SUB_319452883328\", # sub account code of the sub account to delete\r\n )\r\n print(data)\r\n ```\r\n #### sample response - success\r\n ```bash\r\n # status 200\r\n {\r\n \"requestSuccessful\": true,\r\n \"responseMessage\": \"success\",\r\n \"responseCode\": \"0\"\r\n }\r\n ```\r\n\r\n### Disbursement Transactions / Transfers\r\nThe Monnify Disbursements APIs allow a merchant to initiate payouts from his Monnify Wallet to any bank account in Nigeria. They provide all the tools you need to enable you completely automate your disbursement processes.\r\n- Initiate A Single Transfer\r\n To initiate a single transfer, you will need to send a request to the endpoint. If the merchant does not have Two Factor Authentication (2FA) enabled, the transaction will be processed instantly as in the response. If 2FA is enabled, the response will indicate stutus as pending authorization.\r\n ```python\r\n data = monnify.initiateSingleTransfer(\r\n amount=100,\r\n reference=\"reference12934\",\r\n narration=\"911 Transaction\",\r\n bankCode=\"058\",\r\n accountNumber=\"0111946768\",\r\n walletId=\"4794983C91374AD6B3ECD76F2BEA296D\"\r\n )\r\n print(data)\r\n ```\r\n - ```amount:``` Number, required; The amount to be disbursed to the beneficiary\r\n - ```reference:``` String, required; The unique reference for a transaction. Also to be specified for each transaction in a bulk transaction request.\r\n - ```narration:``` String, required; The Narration for the transactions being processed.\r\n - ```bankCode:``` String, Required; The 3 digit bank code representing the destination bank.\r\n - ```accountNumber:``` String, Required; The beneficiary account number.\r\n - ```walletId:``` String, Required; Unique reference to identify the wallet to be debited.\r\n\r\n #### sample response - success\r\n ```bash\r\n # status 200\r\n {\r\n \"requestSuccessful\": true,\r\n \"responseMessage\": \"success\",\r\n \"responseCode\": \"0\",\r\n \"responseBody\": {\r\n \"amount\": 10,\r\n \"reference\": \"reference12934\",\r\n \"status\": \"SUCCESS\",\r\n \"dateCreated\": \"13/11/2019 09:34:32 PM\"\r\n }\r\n }\r\n # Pending Authorization\r\n {\r\n \"requestSuccessful\": true,\r\n \"responseMessage\": \"success\",\r\n \"responseCode\": \"0\",\r\n \"responseBody\": {\r\n \"amount\": 10,\r\n \"reference\": \"reference12934\",\r\n \"status\": \"PENDING_AUTHORIZATION\",\r\n \"dateCreated\": \"13/11/2019 08:48:32 PM\"\r\n }\r\n }\r\n ```\r\n\r\n- Initiate A Bulk Transfer\r\n To initiate a bulk transfer, you will need to send a request to the endpoint. If the merchant does not have Two Factor Authentication (2FA) enabled, the transaction will be processed instantly as in the response. If 2FA is enabled, the response will indicate stutus as pending authorization. \r\n When a bulk transfer request is sent, it is simply acknowledged by the system and then processed in the background. Monnify goes through each account to attempt to validate them and depending on what value is set for the onValidationFailure field, Monnify will either continue processing with the valid transfers or reject the entire batch. \r\n Use ```BREAK``` to tell Monnify to reject the entire batch and use ```CONTINUE``` to tell Monnify to process the valid transactions.\r\n ```python\r\n # define the lists of transactions to be performed\r\n transaction_list = [\r\n {\r\n \"amount\": 1300,\r\n \"reference\": \"Final-Reference-1a\",\r\n \"narration\": \"911 Transaction\",\r\n \"bankCode\": \"058\",\r\n \"accountNumber\": \"0111946768\",\r\n \"currency\": \"NGN\"\r\n },\r\n {\r\n \"amount\": 570,\r\n \"reference\": \"Final-Reference-2a\",\r\n \"narration\": \"911 Transaction\",\r\n \"bankCode\": \"058\",\r\n \"accountNumber\": \"0111946768\",\r\n \"currency\": \"NGN\"\r\n },\r\n {\r\n \"amount\": 230,\r\n \"reference\": \"Final-Reference-3a\",\r\n \"narration\": \"911 Transaction\",\r\n \"bankCode\": \"058\",\r\n \"accountNumber\": \"0111946768\",\r\n \"currency\": \"NGN\"\r\n }\r\n ]\r\n # make the request\r\n data = monnify.initiateBulkTransfer(\r\n title=\"title of the transfer\",\r\n batchReference=\"unique reference for batch\",\r\n narration=\"narration of the bulk transfer\",\r\n walletId=\"4794983C91374AD6B3ECD76F2BEA296D\", #Unique reference to identify the wallet to be debited.\r\n onValidationFailure=\"CONTINUE\",\r\n transactionList=transaction_list\r\n )\r\n print(data)\r\n ```\r\n #### sample response - success\r\n ```bash\r\n # status 200\r\n {\r\n \"requestSuccessful\": true,\r\n \"responseMessage\": \"success\",\r\n \"responseCode\": \"0\",\r\n \"responseBody\": {\r\n \"totalAmount\": 2108.48,\r\n \"totalFee\": 8.48,\r\n \"batchReference\": \"batch-1573681308355\",\r\n \"batchStatus\": \"COMPLETED\",\r\n \"totalTransactions\": 3,\r\n \"dateCreated\": \"13/11/2019 09:42:06 PM\"\r\n }\r\n }\r\n # Pending Authorization\r\n {\r\n \"requestSuccessful\": true,\r\n \"responseMessage\": \"success\",\r\n \"responseCode\": \"0\",\r\n \"responseBody\": {\r\n \"totalAmount\": 2108.48,\r\n \"totalFee\": 8.48,\r\n \"batchReference\": \"batch-1573684027157\",\r\n \"batchStatus\": \"PENDING_AUTHORIZATION\",\r\n \"totalTransactions\": 3,\r\n \"dateCreated\": \"13/11/2019 10:27:25 PM\"\r\n }\r\n }\r\n ```\r\n\r\n- Authorize A Single Transfer\r\n To authorize a single transfer for 2FA, you will need to send the following request\r\n ```python\r\n data = monnify.authorizeSingleTransfer(\r\n reference=\"reference12934\",\r\n authorizationCode=\"40538652\"\r\n )\r\n print(data)\r\n ```\r\n - ```reference:``` String, required; The unique reference for a transaction.\r\n - ```authorizationCode:``` String, required; The One Time Password sent to the specified email to be used to authenticate the transaction.\r\n\r\n #### sample response - success\r\n ```bash\r\n # status 200\r\n {\r\n \"requestSuccessful\": true,\r\n \"responseMessage\": \"success\",\r\n \"responseCode\": \"0\",\r\n \"responseBody\": {\r\n \"amount\": 10,\r\n \"reference\": \"reference12934\",\r\n \"status\": \"SUCCESS\",\r\n \"dateCreated\": \"13/11/2019 09:34:32 PM\"\r\n }\r\n }\r\n ```\r\n\r\n- Authorize Bulk Transfer\r\n To authorize a bulk transfer for 2FA, you will need to send the following request\r\n ```python\r\n data = monnify.authorizeBulkTransfer(\r\n reference=\"batch-reference12934\",\r\n authorizationCode=\"40538652\"\r\n )\r\n print(data)\r\n ```\r\n - ```reference:``` String, required; The unique reference for batch transaction Also to be specified for each transaction in a bulk transaction request\r\n - ```authorizationCode:``` String, required; The One Time Password sent to the specified email to be used to authenticate the transaction.\r\n\r\n #### sample response - success\r\n ```bash\r\n # status 200\r\n {\r\n \"requestSuccessful\": true,\r\n \"responseMessage\": \"success\",\r\n \"responseCode\": \"0\",\r\n \"responseBody\": {\r\n \"amount\": 10,\r\n \"reference\": \"batch-reference12934\",\r\n \"status\": \"SUCCESS\",\r\n \"dateCreated\": \"13/11/2019 09:34:32 PM\"\r\n }\r\n }\r\n ```\r\n\r\n- Resend OTP\r\n To resend OTP for 2FA, you will need to send the following request.\r\n ```python\r\n data = monnify.resendOTP(\r\n reference=\"reference\"\r\n )\r\n print(data)\r\n ```\r\n - ```reference:``` String, required; The unique reference for batch transaction Also to be specified for each transaction in a bulk transaction request\r\n\r\n #### sample response - success\r\n ```bash\r\n # status 200\r\n {\r\n \"requestSuccessful\": true,\r\n \"responseMessage\": \"success\",\r\n \"responseCode\": \"0\",\r\n \"responseBody\": {\r\n \"message\": \"Authorization code will be processed and sent to predefined email addresses(s)\"\r\n }\r\n }\r\n ```\r\n\r\n- Get Single Transfer Status\r\n ```python\r\n data = monnify.getSingleTransferStatus(\r\n reference=\"reference\"\r\n )\r\n print(data)\r\n ```\r\n - ```reference:``` String, required; The unique reference for single transaction\r\n\r\n #### sample response - success\r\n ```bash\r\n # status 200\r\n {\r\n \"requestSuccessful\": true,\r\n \"responseMessage\": \"success\",\r\n \"responseCode\": \"0\",\r\n \"responseBody\": {\r\n \"amount\": 230,\r\n \"reference\": \"Final-Reference-3a\",\r\n \"narration\": \"911 Transaction\",\r\n \"bankCode\": \"058\",\r\n \"accountNumber\": \"0111946768\",\r\n \"currency\": \"NGN\",\r\n \"accountName\": \"MEKILIUWA, SMART CHINONSO\",\r\n \"bankName\": \"GTBank\",\r\n \"dateCreated\": \"13/11/2019 09:42:07 PM\",\r\n \"fee\": 1,\r\n \"status\": \"SUCCESS\"\r\n }\r\n }\r\n ```\r\n\r\n- Get Bulk Transfer Status\r\n ```python\r\n data = monnify.getBulkTransferStatus(\r\n reference=\"reference\"\r\n )\r\n print(data)\r\n ```\r\n - ```reference:``` String, required; The unique reference for bulk transaction\r\n\r\n #### sample response - success\r\n ```bash\r\n # status 200\r\n {\r\n \"requestSuccessful\": true,\r\n \"responseMessage\": \"success\",\r\n \"responseCode\": \"0\",\r\n \"responseBody\": {\r\n \"title\": \"Final Batch - Continue on Failure\",\r\n \"totalAmount\": 2108.48,\r\n \"totalFee\": 8.48,\r\n \"batchReference\": \"batchreference12934\",\r\n \"totalTransactions\": 3,\r\n \"failedCount\": 0,\r\n \"successfulCount\": 0,\r\n \"pendingCount\": 3,\r\n \"batchStatus\": \"AWAITING_PROCESSING\",\r\n \"dateCreated\": \"13/11/2019 10:45:08 PM\"\r\n }\r\n }\r\n ```\r\n",
"bugtrack_url": null,
"license": "MIT",
"summary": "A python library to seamlessly integrate Monnify payment gateway into your projects",
"version": "1.0.2",
"project_urls": {
"Issues": "https://github.com/Rigantech/easy_monnify/issues",
"homepage": "https://github.com/Rigantech/easy_monnify",
"repository": "https://github.com/Rigantech/easy_monnify"
},
"split_keywords": [],
"urls": [
{
"comment_text": "",
"digests": {
"blake2b_256": "7797cfb2318c2e22b5f0356599ad369456d9f82b3013af1beb503f8b9cc3f576",
"md5": "c8ef34d1a4edc32a58c01629edea8a79",
"sha256": "6c8a039e7bdba2c8b469108a97fbfe9ed2c283d284f6636bcf63646ce95ae009"
},
"downloads": -1,
"filename": "easy_monnify-1.0.2-py3-none-any.whl",
"has_sig": false,
"md5_digest": "c8ef34d1a4edc32a58c01629edea8a79",
"packagetype": "bdist_wheel",
"python_version": "py3",
"requires_python": ">=3.8",
"size": 12083,
"upload_time": "2024-08-19T10:05:03",
"upload_time_iso_8601": "2024-08-19T10:05:03.046710Z",
"url": "https://files.pythonhosted.org/packages/77/97/cfb2318c2e22b5f0356599ad369456d9f82b3013af1beb503f8b9cc3f576/easy_monnify-1.0.2-py3-none-any.whl",
"yanked": false,
"yanked_reason": null
},
{
"comment_text": "",
"digests": {
"blake2b_256": "250be43cc744f6907910997973de952dbee8d2198aae54e057739ffcfbc41670",
"md5": "7b1cfee7ebb22b58bf0e60b5a7674451",
"sha256": "ff2c7c61ef36f449fcacae55575e330327b51f7129649e3a59482cd5a52ce6a9"
},
"downloads": -1,
"filename": "easy_monnify-1.0.2.tar.gz",
"has_sig": false,
"md5_digest": "7b1cfee7ebb22b58bf0e60b5a7674451",
"packagetype": "sdist",
"python_version": "source",
"requires_python": ">=3.8",
"size": 24333,
"upload_time": "2024-08-19T10:05:05",
"upload_time_iso_8601": "2024-08-19T10:05:05.542207Z",
"url": "https://files.pythonhosted.org/packages/25/0b/e43cc744f6907910997973de952dbee8d2198aae54e057739ffcfbc41670/easy_monnify-1.0.2.tar.gz",
"yanked": false,
"yanked_reason": null
}
],
"upload_time": "2024-08-19 10:05:05",
"github": true,
"gitlab": false,
"bitbucket": false,
"codeberg": false,
"github_user": "Rigantech",
"github_project": "easy_monnify",
"travis_ci": false,
"coveralls": false,
"github_actions": false,
"lcname": "easy-monnify"
}