收藏
回答

商户号该产品权限未开通,请前往商户平台>产品中心检查后重试?

商户号的相关参数已有,商户平台已经开启了App支付,刷脸支付和JSAPI支付,但是我在使用贵司的SDK时,给我返回的是

{"code":"NO_AUTH","message":"商户号该产品权限未开通,请前往商户平台>产品中心检查后重试"}

public static void main(String[] args) {
    // 使用自动更新平台证书的RSA配置
    // 建议将 config 作为单例或全局静态对象,避免重复的下载浪费系统资源
    Config config =
            new RSAAutoCertificateConfig.Builder()
                    .merchantId(merchantId)
                    .privateKeyFromPath(privateKeyPath)
                    .merchantSerialNumber(merchantSerialNumber)
                    .apiV3Key(apiV3key)
                    .build();
    // 构建service
    NativePayService service = new NativePayService.Builder().config(config).build();
    // request.setXxx(val)设置所需参数,具体参数可见Request定义
    PrepayRequest request = new PrepayRequest();
    Amount amount = new Amount();
    amount.setTotal(100);
    request.setAmount(amount);
    // AppId
    request.setAppid("wx");
    // 商户号ID
    request.setMchid("1");
    request.setDescription("测试商品标题");
    request.setNotifyUrl("https://notify_url");
    request.setOutTradeNo("out_trade_no_001");
    // 调用下单方法,得到应答
    PrepayResponse response = service.prepay(request);
    // 使用微信扫描 code_url 对应的二维码,即可体验Native支付
    System.out.println(response.getCodeUrl());
}
回答关注问题邀请回答
收藏
登录 后发表内容