I am still testing my code under sandbox, therefore, I believe giving the consumer key and consumer secret for my application is not a security issue, because I can always delete and change. The main problem is that the STK Push results in the error: 'errorCode': '500.001.1001', 'errorMessage': 'Wrong credentials'
. My full code is shown below and any assistance will be appreciated:
import base64
import datetime
import json
from requests.auth import HTTPBasicAuth # Correct authentication
# Credentials
consumer_key = "VehT7XXDuS8UVeLQkqOe3lTkFc14lFKtyssZBcAzBexwgcJG"
consumer_secret = "OE9NWfYcW8JKeQ6v7FzObIEG8zjAJpQTDfKFARLAM0WX1Wy3dT9JM12Gxt92oKAz"
# Business Details (Ensure correctness)
shortcode = "174379" # 174379 for Safaricom sandbox
passkey = "bfb279f9aa9bdbcf158e97dd71a467cd2f2c3e6c74a35d8b22a82e1a8ed2c919"
# Generate timestamp
timestamp = datetime.datetime.now().strftime("%Y%m%d%H%M%S")
print(f"
发布者:admin,转转请注明出处:http://www.yc00.com/questions/1744316748a4568221.html
评论列表(0条)