Products & prices

Create catalog items, configure prices, and set charge distribution.

Create a product

Import TaxCategory from the SDK for typed tax_category values: none, vat, or dst.

from nezahub import TaxCategory

product = client.products.create(
    name="Monthly data bundle",
    description="5 GB plan",
    active=True,
    tax_category=TaxCategory.VAT,
)

Create a price

Use PriceType and PaymentCurrency enums. Pass amounts as strings.

from nezahub import PaymentCurrency, PriceType

price = client.prices.create(
    product["id"],
    type=PriceType.ONE_OFF,
    unit_amount="1000",
    currency=PaymentCurrency.KES,
    currency_amounts={PaymentCurrency.UGX: "4800"},
)

Charge distribution

Per customer country, choose who pays tax, platform, MoMo processing (momo_collect), and payout (momo_withdraw). Use ChargePreset instead of hand-building payer maps.

PresetTaxPlatformProcessingPayout
ChargePreset.SellerPaysAllSellerSellerSellerSeller
ChargePreset.CustomerPaysAllCustomerCustomerCustomerCustomer
ChargePreset.MarketplaceStandardCustomerCustomerSellerSeller
ChargePreset.SaasStandardSellerSellerSellerSeller
ChargePreset.PassThroughCustomerCustomerCustomerCustomer
ChargePreset.CustomYou define each field
from nezahub import ChargePreset, MarketCountryCode, charge_distribution_from_preset

client.prices.update(
    product["id"],
    price["id"],
    charge_distribution=charge_distribution_from_preset(
        ChargePreset.MARKETPLACE_STANDARD,
        [MarketCountryCode.KE, MarketCountryCode.UG],
    ),
)

ChargePreset.MarketplaceStandard is a common default: customer pays tax and platform; seller pays processing and payout.

Custom overrides

Start from a preset, then override individual fields with ChargeKey and ChargePayer:

from nezahub import (
    ChargeKey,
    ChargePayer,
    ChargePreset,
    MarketCountryCode,
    apply_charge_preset,
    merge_country_charge_settings,
)

distribution = apply_charge_preset({}, ChargePreset.MARKETPLACE_STANDARD, [MarketCountryCode.KE])
distribution = merge_country_charge_settings(
    distribution,
    MarketCountryCode.KE,
    {ChargeKey.PLATFORM: ChargePayer.SELLER},
)
client.prices.update(product["id"], price["id"], charge_distribution=distribution)
Set charge distribution before checkout, it changes the customer total and seller net. Use detect_charge_preset() / detectChargePreset() to see which preset matches saved settings.