python - Flask Integration with Mpesa Express STK results in Wrong credentials - Stack Overflow

I am still testing my code under sandbox, therefore, I believe giving the consumer key and consumer sec

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条)

  • 暂无评论

联系我们

400-800-8888

在线咨询: QQ交谈

邮件:admin@example.com

工作时间:周一至周五,9:30-18:30,节假日休息

关注微信