Convert module
This holds a function to convert to subunits in NGN, GHS, USD, ZAR and KES
- convert_to_subunit(amount: int, currency: Currency)→ int
Convert a subunit amount to a base amount
- Parameters:
amount (int) – The amount to convert
currency (Currency. This is an Enum class) – The Currency type to use for conversion
- Returns:
The subunit of the amount i.e 100 kobo = 1 Naira (Currency.Naira)
- Return type:
int
USAGE
>>> from paystackease import convert_to_subunit, Currency
>>> subunit = convert_to_subunit(amount=100, currency=Currency.NGN)
>>> print(f"Subunit: {subunit}")
This will printed as:
Subunit: 10000