Files
vf_react/wechat_pay_config.py
2025-10-11 12:02:01 +08:00

70 lines
2.2 KiB
Python
Raw Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

#!/usr/bin/env python
# -*- coding: utf-8 -*-
"""
微信支付真实配置文件
请根据您的微信商户平台信息填写
"""
# 微信支付配置 - 请替换为您的真实信息
WECHAT_PAY_CONFIG = {
# 基础配置
'app_id': 'wx0edeaab76d4fa414', # 微信公众平台AppID
'mch_id': '1718543833', # 微信支付商户号
'api_key': '141a5753c42526bb44bc44d6c4277664', # 微信商户平台设置的API密钥
# 证书文件路径
'cert_path': './certs/apiclient_cert.pem',
'key_path': './certs/apiclient_key.pem',
# 回调配置
'notify_url': 'https://valuefrontier.cn/api/payment/wechat/callback',
# 其他配置
'sign_type': 'MD5',
'trade_type': 'NATIVE'
}
# 配置验证函数
def validate_config():
"""验证配置是否完整"""
issues = []
if WECHAT_PAY_CONFIG['app_id'].startswith('wx你的'):
issues.append("❌ app_id 还是示例值请替换为真实的微信AppID")
if WECHAT_PAY_CONFIG['mch_id'].startswith('你的'):
issues.append("❌ mch_id 还是示例值,请替换为真实的商户号")
if WECHAT_PAY_CONFIG['api_key'].startswith('你的'):
issues.append("❌ api_key 还是示例值请替换为真实的32位API密钥")
# 检查证书文件
import os
for key in ['cert_path', 'key_path']:
if not os.path.exists(WECHAT_PAY_CONFIG[key]):
issues.append(f"❌ 证书文件不存在: {WECHAT_PAY_CONFIG[key]}")
return len(issues) == 0, issues
if __name__ == "__main__":
print("微信支付配置验证")
print("=" * 50)
is_valid, issues = validate_config()
if is_valid:
print("✅ 配置验证通过!")
else:
print("⚠️ 配置存在问题:")
for issue in issues:
print(f" {issue}")
print("\n📋 配置步骤:")
print("1. 登录微信商户平台 (pay.weixin.qq.com)")
print("2. 获取AppID和商户号")
print("3. 在API安全中设置32位API密钥")
print("4. 下载证书文件并放到 ./certs/ 文件夹")
print("5. 更新本文件中的配置信息")
print("=" * 50)