Closed Brightmuk closed 4 years ago
Encountered the same. Did you manage to change? or get a work around?
I had to use the library as a django app. I simply moved the lib from my packages in the virtual environment then registered it as an app.
Finally all you have to do is edit the core.py file at def stk_push function by changing amount to as follows:
data = { 'BusinessShortCode': business_short_code, 'Password': password, 'Timestamp': timestamp, 'TransactionType': transaction_type, 'Amount': str(amount), 'PartyA': party_a, 'PartyB': party_b, 'PhoneNumber': phone_number, 'CallBackURL': callback_url, 'AccountReference': account_reference, 'TransactionDesc': transaction_desc }
So instead of importing the library you just import the app.
Thanks a lot mate. Cheers🍻
Sorry for the delay, I've resolved the default amount tag issue. Sorted in version 1.1.2
django_daraja/mpesa.core In the
stk_push
function theamount
variable is by default set to1
Here is the rendered json datadata = { 'BusinessShortCode': business_short_code, 'Password': password, 'Timestamp': timestamp, 'TransactionType': transaction_type, 'Amount': '1', 'PartyA': party_a, 'PartyB': party_b, 'PhoneNumber': phone_number, 'CallBackURL': callback_url, 'AccountReference': account_reference, 'TransactionDesc': transaction_desc }