微信创建会员卡-47001错误

文档:1.新版会员卡介绍 | 微信开放文档

错误:

47001 解析 JSON/XML 内容错误

接口:

HTTP请求方式: POSTURL:https://api.weixin.qq.com/card/create?access_token=ACCESS_TOKEN

原因

参数设置错误:["swipe_card" => ['is_swipe_card'=>true]

​​​​​​微信创建会员卡-47001错误_第1张图片

解决

正确设置:"pay_info" => ["swipe_card" => ['is_swipe_card'=>true]]//是否设置该会员卡支持拉出微信支付刷卡界面

 $base_info = [
               // "sub_merchant_info"=> ["merchant_id" => '345363425'],//子商户号  子商户创建会员卡方调用
                "logo_url"=> $background_pic_url,
                "brand_name"=>$row['name'],
                "code_type"=>"CODE_TYPE_TEXT",
                "title"=>"会员卡",
                "color"=>"Color010",
                "notice"=>"使用时向服务员出示此券",
                "service_phone"=>"020-88888888",
                "description"=>"不可与其他优惠同享",
                "date_info"=> $date_info,
                "sku"=> $sku,
                "get_limit"=>1,//会员卡每人限领1张
                "use_custom_code"=>false,
                "can_give_friend"=>true,
                "location_id_list"=> $location_id_list,
                "need_push_on_view"=>true,
                "pay_info" => ["swipe_card" => ['is_swipe_card'=>true]]//是否设置该会员卡支持拉出微信支付刷卡界面
        ];

附传参示范:

{
    "background_pic_url":"http://mmbiz.qpic.cn/sz_mmbiz_jpg//0",
    "base_info":{
        "logo_url":"http://mmbiz.qpic.cn/sz_mmbiz_jpg//0",
        "brand_name":"XXXXX",
        "code_type":"CODE_TYPE_TEXT",
        "title":"会员卡",
        "color":"Color010",
        "notice":"使用时向服务员出示此券",
        "service_phone":"020-88888888",
        "description":"不可与其他优惠同享",
        "date_info":{
            "type":"DATE_TYPE_FIX_TIME_RANGE",
            "begin_timestamp":1694680879,
            "end_timestamp":2010240000
        },
        "sku":{
            "quantity":10
        },
        "get_limit":1,
        "use_custom_code":false,
        "can_give_friend":true,
        "location_id_list":[
            123,
            12321
        ],
        "need_push_on_view":true,
        "pay_info":{
            "swipe_card":{
                "is_swipe_card":true
            }
        }
    },
    "supply_bonus":false,
    "supply_balance":false,
    "prerogative":"持此会员卡可享店铺9折优惠",
    "auto_activate":true,
    "custom_field1":{
        "name_type":"FIELD_NAME_TYPE_DISCOUNT",
        "url":"https://XXX.com",
        "app_brand_pass":"pages/index/login",
        "app_brand_user_name":"gh_44444b42bd567@app"
    },
    "custom_field2":{
        "name_type":"FIELD_NAME_TYPE_COUPON",
        "url":"https://xx.xxx.com",
        "app_brand_pass":"pages/index/login",
        "app_brand_user_name":"gh_44444b42bd567@app"
    },
    "custom_field3":{
        "url":"https://xxx.xxx.com",
        "name":"点餐小程序",
        "app_brand_pass":"pages/index/login",
        "app_brand_user_name":"gh_44444b42bd567@app"
    },
    "discount":10
}

你可能感兴趣的:(php,微信,微信会员卡)