接入说明
1、前置准备,业务侧需要先申请应用,https://open.gongyi.qq.com/docs/guide/接入步骤.html
2、平台侧根据应用id分配支付bid
3、完成企业平台入驻,并成功创建活动,https://corp.gongyi.qq.com/#/register
4、如需接入发花,请参考小红花文档 小红花
概述
业务接入行为捐流程图
异步代扣的方式,整体流程如下:
注:
1、有感发花流程参考小红花相关文档,文档链接: 小红花
2、有感发花调用接口PreTry预发花时,open_id填业务侧用户id、business_info填请求代扣接口中的行为捐流水id的json信息,如:{" reward_transcode":"trans_7890"}
1、查询活动接口
使用场景: 业务在对接行为捐活动场景时,需要知道当前项目的活动相关信息,可以调用本接口来获取。
调用凭证: 应用签名
请求方式: POST(HTTPS)
请求地址: https://oapi.gongyi.qq.com/api/reward_donate_service/GetActivityInfo
请求参数:
参数 | 类型 | 必填 | 说明 |
---|---|---|---|
project_no | string | 是 | 项目ID |
注:同一个项目可能被绑定到多个活动上,所以该接口回包是一个数组,业务侧自行选择当前的活动。
- 请求示例
{
"project_no": "224328"
}
返回参数:
参数 | 类型 | 说明 |
---|---|---|
activity_info | []object | 活动信息列表 |
activity_info.activity_no | string | 活动ID |
activity_info.activity_type | uint32 | 活动类型: 1-一块走捐步,2-积分捐,4-企业直接捐赠,5-行为捐 |
activity_info.activity_name | string | 活动名称 |
activity_info.org_no | string | 企业ID |
activity_info.activity_status | uint32 | 活动状态: 1-未上线, 2-进行中, 3-暂停中, 4-已结束 |
activity_info.money | string | 企业当前活动冻结总金额, 单位分 |
activity_info.merchant_no | string | 商户号 |
activity_info.project_no_list | []string | 企业当前活动绑定的项目列表 |
activity_info.xwj_rule | []object | 行为捐规则信息列表 |
activity_info.xwj_rule.content | string | 行为捐具体公益行为名称 |
activity_info.xwj_rule.title | string | 行为捐公益行为描述 |
返回示例:
{
"code": 0,
"msg": "Success",
"op_time": 1650812345,
"trace_id": "1a2b3c4d5e6f7g8h1a2b3c4d5e6f7g8h",
"data": {
"activity_no": "123",
"activity_type": 2,
"activity_name": "测试活动",
"org_no": "110058",
"activity_status": 2,
"money": "500000",
"merchant_no": "19680000001",
"project_no_list": [
"224328",
"50000636"
],
"xwj_rule": [
{
"content": "测试行为23333",
"title": "测试行为335553444"
},
{
"content": "测试行为345144",
"title": "测试行为喂喂喂55"
}
]
}
}
2、B2B行为捐代扣接口
使用场景: 业务在对接行为捐活动场景时,行为捐赠后需要发起活动的B2B扣款,调用本接口来完成扣款。
调用凭证: 应用签名
请求方式: POST(HTTPS)
请求地址: https://oapi.gongyi.qq.com/api/reward_donate_service/BehaviorToDonate
请求参数:
参数 | 类型 | 必填 | 说明 |
---|---|---|---|
activity_no | string | 是 | 活动ID |
project_no | string | 是 | 项目ID |
third_uid | string | 是 | 业务侧用户id |
rule_content | string | 是 | 行为捐的具体公益行为名称 |
reward_transcode | string | 是 | 捐赠行为流水id |
trans_time | string | 是 | 捐赠行为时间, 如:2006-01-02 15:04:05 |
money | uint32 | 是 | 企业捐赠金额,单位分 |
bid | string | 是 | 业务ID,业务去公益侧申请的bid |
- 请求示例
{
"activity_no": "123456",
"project_no": "224328",
"third_uid": "user_001",
"rule_content": "xxx",
"reward_transcode": "trans_7890",
"trans_time": "2025-08-01 12:00:00",
"money": 100,
"bid": "123456789"
}
以下错误码需要进行代扣重试:
错误码 | 说明 |
---|---|
32240007 | 库存扣取失败,需要重试 |
32240043 | 库存扣取状态异常,需要重试 |
其他错误码无需重试:
错误码 | 说明 |
---|---|
32240001 | 请求参数异常 |
返回示例:
{
"code": 0,
"msg": "Success",
"op_time": 1650812345,
"trace_id": "1a2b3c4d5e6f7g8h1a2b3c4d5e6f7g8h",
"data": {}
}
注: 1、捐赠金额会做校验,要求大于等于0.01元,小于等于1000元。
2、rule_content字段需要与企业平台创建的规则中的公益行为名称对应。
3、B2B查单接口
使用场景: 业务在对接行为捐活动场景时,调用接口B2B扣款后,返回了订单状态为未成功支付,这是需要业务侧重新查单来继续校验该笔订单的状态。
调用凭证: 应用签名
请求方式: POST(HTTPS)
请求地址: https://oapi.gongyi.qq.com/api/reward_donate_service/RewardDonateQuery
请求参数:
参数 | 类型 | 必填 | 说明 |
---|---|---|---|
activity_no | string | 是 | 活动ID |
project_no | string | 是 | 项目ID |
third_uid | string | 是 | 业务侧用户ID |
bid | string | 是 | 业务ID,业务去公益侧申请的bid |
reward_transcode | string | 是 | 用户捐赠行为流水ID |
注:bid+reward_transcode必填
- 请求示例
{
"activity_no": "123456",
"project_no": "224328",
"third_uid": "user_001",
"bid": "12345",
"reward_transcode": "trans_7890"
}
返回参数:
参数 | 类型 | 说明 |
---|---|---|
activity_no | string | 活动ID |
project_no | string | 项目ID |
third_uid | string | 业务侧用户ID |
money | uint32 | 企业捐赠金额,单位分 |
reward_transcode | string | 用户捐赠行为流水ID |
donate_transcode | string | 企业捐赠流水ID |
donate_status | uint32 | 捐赠状态: 2-已下单,11-支付(转账)成功,13-支付(转账)失败,15-已退款 |
以下错误码需要进行重试:
错误码 | 说明 |
---|---|
32240046 | 支付查单失败,需要重试 |
其他错误码无需重试:
错误码 | 说明 |
---|---|
32240001 | 请求参数异常 |
32240004 | 支付查单失败,不需要重试 |
返回示例:
{
"code": 0,
"msg": "Success",
"op_time": 1650812345,
"trace_id": "1a2b3c4d5e6f7g8h1a2b3c4d5e6f7g8h",
"data": {
"activity_no": "123456",
"project_no": "224328",
"third_uid": "user_001",
"money": 5000,
"reward_transcode": "trans_7890",
"donate_transcode": "donate_12345",
"donate_status": 11
}
}