Cloudreve自定义付款渠道-爱发电接口
参考 https://docs.cloudreve.org/use/pro/pay 构建
推荐使用 Python3.11
使用爱发电接口
可以在Cloudreve-AfdianPay-Build仓库下载编译好的文件直接运行,或者自行配置运行环境(存在问题,后面有空了再修复)
下载 src
文件夹,运行 pip install -r requirements.txt
安装依赖包
修改 .env
文件中的内容
SITE_URL="你的网站url,不带斜杠,例如 https://demo.cloudreve.org"
USER_ID="你的爱发电user_id"
TOKEN="你的爱发电api token"
PORT="5000"# 监听端口,默认5000
例如
SITE_URL="https://demo.cloudreve.org"
USER_ID="abcxxxxxxx123"
TOKEN="aAABBB123xxxxzzz"
PORT="5000"
运行 cloudreve_pay.py
文件即可
默认监听5000端口,可以自行修改 .env
文件的 PORT
参数
PORT="5000"# 监听端口,默认5000
在爱发电开发者页面设置Webhook URL http://example.com:5000/afdian
将 example.com
更换为你的域名或IP,点击保存
如果没有报错则说明成功
在Cloudreve管理后台-参数设置-增值服务-自定义付款渠道中填写付款方式名称、支付接口地址、通信密钥
接口地址为: http://example.com:5000/order/create
将 example.com
更换为你的域名或IP,点击保存
通信密钥可以随意填写,暂时还没加入签名验证,后面有空了再更新
为了防止伪造Post请求,强烈建议在正式上线前更改 cloudreve_pay.py
文件中第28行
的post路径,并在爱发电后台做相应调整
后续更新中会加入API主动请求验证获取信息的正确性