momoapi-python icon indicating copy to clipboard operation
momoapi-python copied to clipboard

ENVIRONMENT is missing in the configuration

Open umarfarukabu opened this issue 4 years ago • 1 comments

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 ....?

umarfarukabu avatar Nov 23 '21 16:11 umarfarukabu

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.

sicelo avatar Nov 24 '21 20:11 sicelo