sparkplug / momoapi-python

MTN MoMo API Client Library for Python
MIT License
47 stars 55 forks source link

ENVIRONMENT is missing in the configuration #35

Open umarfarukabu opened 2 years ago

umarfarukabu commented 2 years ago

Why does the momo API keep throwing me the ENVIRONMENT is missing in the configuration, Exception. after i had provided one in the config={

        'ENVIRONMENT': os.environ.get("https://sandbox.momodeveloper.mtn.com/collection/v1_0/bc-authorize"),
        'BASE_URL': os.environ.get("BASE_URL"),
        'CALLBACK_HOST': os.environ.get("http://127.0.0.1:8000"),}

The documentation stated that it was optional but when left blank or provided with one i get that Exception.....whenever i make client.requestToPay(amount='100', mobile ='233247854320', external_id='324445335').

what could possibly be the case ....?

sicelo commented 2 years ago

yes, ENVIRONMENT is 'optional' using this library, because it was written to default to "sandbox" , https://github.com/sparkplug/momoapi-python/blob/224bc9f2d1b9719bff63a92c17b8d205f5cf0508/src/mtnmomo/config.py#L59

You are setting a wrong environment in your example.