送礼

移动端送礼支付(微信支付)
 var params={
                    "openId" :  //微信id
                    "optType":"FFSL", //不能更改的值
                    "totalAmount":  ,//打赏的金额(分)
                    "remark" : , //祝福语
                    "nickName" : ,//微信昵称
                    "headerUrl" :  ,//微信头像url
                };
                CR_SDK.payMoney(params);//调起微信支付

调起微信支付,支付成功后,在聊天信息接口会有通知:

// 接收聊天信息
    CR_SDK.on('cr_receive_chat_msg', function(res){
        console.log(res);
        if( res.data.type == 5){
                // 5 是移动端送礼
            }
        ....
    }
PC端送礼支付(扫码支付)
 var params={
                "optType":"PCSL", //不能更改的值
                "totalAmount":watchFee*100, //打赏的金额(分)
                "remark": , //祝福语
                "nickName" :  ,//昵称
                "headerUrl":  , //头像的url
            };
            CR_SDK.pcPayMoney(params);

在调用支付后立马执行回调函数:

CR_SDK.on('cr_check_paywatch_img', function(res){
               if(res.code == 0){ //成功返回
                   if(res.data && res.data.code_url){
                      res.data.code_url //返回支付的地址
                      ....// 生成二维码展示,让别人扫码支付
                   }
               }
           })

支付成功后,在聊天信息接口通知:

// 接收聊天信息
    CR_SDK.on('cr_receive_chat_msg', function(res){
        console.log(res);
        if( res.data.type == 15){
                // 15 是PC端送礼
            }
        ....
    }
© HeDonghai all right reserved,powered by Gitbook文件修订时间: 2018-11-20 14:29:10

results matching ""

    No results matching ""