uniapp app微信提现(APP、wx小程序)

app微信提现 小程序提现在下面

需要导入一个插件
点击跳转插件地址:https://ext.dcloud.net.cn/plugin?id=22283

配置以下两步后需提交云端打包生效

1.导入插件后在 manifest.json 里配置安卓和苹果的 schemes

uniapp app微信提现(APP、wx小程序)_第1张图片

2. IOS平台 在根目录下创建文件 Info.plist

iOS平台必须在项目根目录下的 Info.plist 文件中配置微信开发者平台的APPID和通用链接

在 WeChat 节点下配置 appid 和 universalLink
在 CFBundleURLTypes 节点下配置 scheme 数据

<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
    <dict>
        <key>WeChat</key>
        <dict>
            <key>appid</key>
            <string>请填写微信开发者平台对应app的APPID</string>
            <key>universalLink</key>
            <string>请填写能唤起当前应用的Universal Links路径</string>
        </dict>

        <key>CFBundleURLTypes</key>
        <array>
            <dict>
                <key>CFBundleTypeRole</key>
                <string>Editor</string>
                <key>CFBundleURLName</key>
                <string>WeChat</string>
                <key>CFBundleURLSchemes</key>
                <array>
                    <string>请填写微信开发者平台对应app的APPID</string>
                </array>
            </dict>
        </array>
    </dict>
</plist>

示例
uniapp app微信提现(APP、wx小程序)_第2张图片
配置完上面的一定打自定义包,ios用测试证书打包

APP提现代码

uni.requestMerchantTransfer({
    "mchId": "mchId",
    "appId": "微信开发者平台对应app的APPID",
    "package": "package",
    success: (res) => {
        console.log(res)
    },
    fail: (res) => {
        console.log(res.errMsg)
    },
    complete: (res) => {
        console.log(res.errMsg)
    }
})

微信小程序提现

官方文档地址有代码
点击跳转文档地址
下面是官方文档的代码

if (wx.canIUse('requestMerchantTransfer')) {
  wx.requestMerchantTransfer({
    mchId: 'wx8888888888888888',
    appId: wx.getAccountInfoSync().miniProgram.appId,
    package: 'affffddafdfafddffda==',
    success: (res) => {
      // res.err_msg将在页面展示成功后返回应用时返回ok,并不代表付款成功
      console.log('success:', res);
    },
    fail: (res) => {
      console.log('fail:', res);
    },
  });
} else {
  wx.showModal({
    content: '你的微信版本过低,请更新至最新版本。',
    showCancel: false,
  });
}

你可能感兴趣的:(uniapp,小程序,uni-app,微信,小程序)