自定义版交易组件 生成订单https://api.weixin.qq.com/shop/order/add
接口一直报1010004错误那位大佬帮忙看看什么问题啊?
参数对了很多遍找不出问题在哪
pay_info字段异常,请检查json及字段合法性 rid: 6239d2e7-4a950b75-0452fffc
下面是我的请求参数
{"create_time":"2022-03-22 21:43:32","out_order_id":"146","openid":"oo58i5EDIR-xWmNjXW-vyONZX41Q","path":"\/pages\/order\/orderDetail\/orderDetail?order_id=146","scene":1177,"order_detail":{"product_infos":[{"out_product_id":"245","out_sku_id":"1529","product_cnt":1,"sale_price":3900,"sku_real_price":3900,"path":"pages\/goods\/goodsDetail\/goodsDetail?goods_id=245","title":"小猪努比 NB 830便携式奶粉格 三层 三层","head_img":"https:\/\/shop-img.hanbaoxuan.com\/1624357783.jpg"}],"pay_info":{"pay_method_type":0},"price_info":{"order_price":3900,"freight":0}},"delivery_detail":{"delivery_type":1},"address_info":{"receiver_name":"liudaoning","detailed_address":"北京市市辖区东城区sadasd","tel_number":"18701519716"},"fund_type":0,"expire_time":1648043012}
这里的fund_type应该是传1吧,这样pay_info里面才不用传prepay_id,然后支付的时候再调用生成支付参数接口获取最新的支付参数。
1. fund_type为1时为二级商户号订单,调用创建订单接口时只需要传入 pay_info.pay_method_type, 配合获取支付参数接口唤起二级商户的支付
2. fund_type为0时为非二级商户号订单,需要在统一下单拿到prepay_id后调用生成订单接口,需要多传入pay_info.prepay_id和pay_info.prepay_time
ps. 在MP开通自定义交易组件的流程里,要完成订单接口调用验证,需要用编辑器指定视频号场景值,模拟fund_type为1的场景进行二级商户号的下单和支付才可以
新文档:https://developers.weixin.qq.com/miniprogram/dev/platform-capabilities/business-capabilities/ministore/minishopopencomponent2/API/order/add_order_new.html
旧文档:https://developers.weixin.qq.com/miniprogram/dev/platform-capabilities/business-capabilities/ministore/minishopopencomponent2/API/order/add_order.html
这里需要看旧文档https://developers.weixin.qq.com/miniprogram/dev/platform-capabilities/business-capabilities/ministore/minishopopencomponent2/API/order/add_order.html 不能按照新文档来
自定义组件调试开通时,prepay_id不用传,直接按照文档上来就行,也不用看旧文档,wxjava里如果封装好了,而且参数都一样的,可以通过封装的来,不然,就直接发送post请求,自己去解析返回结果
我也遇到这个问题了,就是按照文档实例来传的,一直说异常