Skip to main content

Business Service

The monei.business service allows you to manage customers under a specific business. With this service, you can:
  • Create business customers
  • Retrieve all business customers
  • Get customer details
  • Update customer information
  • Disable customers

Initialize

from monei import Monei

monei = Monei(api_key="your-secret-key")

Create Business Customer

Create a new customer under a business.
customer = await monei.business.create_business_customer(
    "business-id",
    {
        "first_name": "John",
        "last_name": "Doe",
        "email": "john@example.com",
        "phone_number": "+2348012345678",
    }
)

print(customer["id"])
print(customer["email"])

Get Business Customers

Retrieve all customers associated with a business.
customers = await monei.business.get_business_customers("business-id")

for customer in customers["data"]:
    print(customer["id"], customer["email"])

Get Customer Details

Retrieve detailed information about a specific customer.
customer = await monei.business.get_customer_details(
    "business-id",
    "customer-id"
)

print(customer["id"])
print(customer["email"])

Update Customer

Update a customer’s information.
updated = await monei.business.update_customer(
    "business-id",
    "customer-id",
    {
        "first_name": "Jane",
        "email": "jane@example.com"
    }
)

print(updated["id"])
print(updated["email"])

Disable Customer

Disable a customer under a business.
response = await monei.business.disable_customer(
    "business-id",
    "customer-id"
)

print(response["status"])

Error Handling

All Business Service methods may raise MoneiAPIError if the request fails.
from monei.exceptions import MoneiAPIError

try:
    customer = await monei.business.get_customer_details(
        "business-id",
        "customer-id"
    )
except MoneiAPIError as error:
    print(error.message)

Service Methods Overview

MethodDescription
create_business_customerCreate a new customer under a business
get_business_customersRetrieve all customers for a business
get_customer_detailsGet details of a specific customer
update_customerUpdate customer information
disable_customerDisable a business customer