Skip to main content

Official Python SDK for Monei API - AI agent for finance, Financial services, wallets, and crypto exchange

Project description

Monei Python SDK

The official Python SDK for Monei API - providing seamless integration with Monei's comprehensive financial services including wallets, crypto transactions, bill payments, and AI agent.

Installation

pip install monei-sdk

Quick Start

import asyncio
import os
from monei import MoneiClient

async def main():
    # Initialize client with API key
    client = MoneiClient(api_key=os.getenv('MONEI_API_KEY'))
    
    try:
        # Get user info
        user = await client.user.get_me()
        print(f"Welcome {user.firstName} {user.lastName}!")
        
        # Get wallet balance
        wallet = await client.wallet.get_wallet()
        print(f"Naira Balance: ₦{wallet.nairaBalance:,.2f}")
        
    finally:
        await client.close()

asyncio.run(main())

Features

  • User Management - Profile, KYC verification
  • Wallet Operations - Balance, funding, withdrawals, peer transfers
  • EVM Wallets - Ethereum, BSC, Polygon support
  • Solana Wallets - SOL and SPL token management
  • Bill Payments - Airtime, data, electricity, cable TV
  • Crypto Exchange - Token swaps on EVM and Solana
  • AI Agent - Conversational banking assistant
  • Beneficiary Management - Bank, crypto, and peer beneficiaries

Basic Usage Examples

1. Wallet Operations

from monei import MoneiClient
from monei.models.wallet import PeerTransferDto

async def wallet_operations():
    async with MoneiClient(api_key="your-api-key") as client:
        # Fund wallet
        fund_result = await client.wallet.fund_wallet(5000.0)
        print(f"Funding link: {fund_result.link}")
        
        # Peer transfer
        transfer = PeerTransferDto(
            receiver="user@example.com",
            amount=1000.0,
            transactionPin="1234"
        )
        result = await client.wallet.peer_transfer(transfer)
        print("Transfer successful!")

2. Crypto Operations

from monei.models.evm import SendNativeTokenDto

async def crypto_operations():
    async with MoneiClient(api_key="your-api-key") as client:
        # Get EVM portfolio
        portfolio = await client.evm.get_portfolio(chain_id=56)  # BSC
        print(f"Portfolio value: ${portfolio.totalPortfolioValueUSD}")
        
        # Send crypto
        transfer = SendNativeTokenDto(
            to="0x742d35Cc6634C0532925a3b844Bc454e4438f44e",
            amount="0.01",
            chainId=1  # Ethereum
        )
        result = await client.evm.send_native_token(transfer)
        print(f"Transaction hash: {result.txHash}")

3. Bill Payments

from monei.models.bills import AirtimePurchaseDto

async def bill_payments():
    async with MoneiClient(api_key="your-api-key") as client:
        # Buy airtime
        airtime = AirtimePurchaseDto(
            phoneNumber="08012345678",
            biller="MTN",
            amount=500.0
        )
        result = await client.bills.buy_airtime(airtime)
        print(f"Airtime purchase successful! Reference: {result.reference}")

4. AI Agent

from monei.models.agent import AgentChatRequestDto

async def ai_agent():
    async with MoneiClient(api_key="your-api-key") as client:
        # Chat with AI agent
        chat_request = AgentChatRequestDto(
            message="What's my current account balance?",
            conversationId="conv_123"
        )
        response = await client.agent.chat(chat_request)
        print(f"Agent: {response.response}")

Authentication

Get your API key from the Monei Dashboard.

# Use environment variable (recommended)
client = MoneiClient(api_key=os.getenv('MONEI_API_KEY'))

# Or pass directly
client = MoneiClient(api_key="your-api-key-here")

Error Handling

from monei import MoneiAPIError, AuthenticationError

try:
    async with MoneiClient(api_key="invalid-key") as client:
        await client.user.get_me()
except AuthenticationError as e:
    print(f"Authentication failed: {e}")
except MoneiAPIError as e:
    print(f"API error: {e}")

Getting Help

License

MIT License - see LICENSE file for details.

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

monei_sdk-0.1.2.tar.gz (18.2 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

monei_sdk-0.1.2-py3-none-any.whl (20.0 kB view details)

Uploaded Python 3

File details

Details for the file monei_sdk-0.1.2.tar.gz.

File metadata

  • Download URL: monei_sdk-0.1.2.tar.gz
  • Upload date:
  • Size: 18.2 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: uv/0.9.10 {"installer":{"name":"uv","version":"0.9.10"},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"macOS","version":null,"id":null,"libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":null}

File hashes

Hashes for monei_sdk-0.1.2.tar.gz
Algorithm Hash digest
SHA256 33598e9e918c17d764610601b65be7167bc52554521959c9bf7342d26e31d54a
MD5 5d267d83cc935b06e7f35ccbc67850af
BLAKE2b-256 354794a54bbc3f878da8e9bf66736abc86f75457334b536cff34fe782ba81c33

See more details on using hashes here.

File details

Details for the file monei_sdk-0.1.2-py3-none-any.whl.

File metadata

  • Download URL: monei_sdk-0.1.2-py3-none-any.whl
  • Upload date:
  • Size: 20.0 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: uv/0.9.10 {"installer":{"name":"uv","version":"0.9.10"},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"macOS","version":null,"id":null,"libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":null}

File hashes

Hashes for monei_sdk-0.1.2-py3-none-any.whl
Algorithm Hash digest
SHA256 e9830ece496e121f33eba4ab730a1e8d1abbd9123629170c4b8bbe330c4d34cd
MD5 70f7e918e42113ddbab0f33de299ac3c
BLAKE2b-256 181be2911d3a4e0ef0a2562d9ac73554bc1f2fcf90da6a67b31545999586687b

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page