# Native 扫码支付

# 说明

  • 该接口微信/支付宝均可使用
  • 该接口生成一个动态二维码,用户扫码支付

# 接口地址

https://open.weidoufu.com/pay/native (opens new window)

请求方式:POST

# 接口参数

字段名称 字段类型 必填参数 说明 (AccessKey/SecretKey)应用密钥
access_key string(32) 应用密钥的 AK,即是 AccessKey
body string(32) 商品名称 例如:QQ 会员充值
out_order_no string(32) 商户订单号(字母、数字,至少 18 位长度)
pay_type int(2) 支付类型 1-微信;2-支付宝;3-云闪付
total_fee int(9) 价格单位:分
notify_url string(128) 你平台的接收回调通知的地址
expire int(2) 订单过期分钟,默认 30,最大值 60;例如:10,即是 10 分钟
attach string(128) 附加信息,回调时原样传回 例如:{test:'test1_params'}
ledger string(512) 分账接收方,jsonArray 格式 例如:'[{"amount":1,"sub_mch_no":"xxxxxxxx"}]'
sign string 签名结果(大写),详见 签名算法 (opens new window)

# 返回参数

返回为 json 格式

名称 字段类型 必填参数 说明
code int 1:成功   0:失败
message string 返回描述信息
status string 返回状态,有 successfail
qrcode string base64 编码的二维码图片
code_url string 付款链接,可以唤起 APP 付款
mch_trade_no string 平台返回的订单号
out_order_no string 商户订单号(字母、数字)

实例成功返回结果:

{
  code: 1,
  data: {
    qrcode: "data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAfQAAAH0CAYAAADL1t+KAAAAAklEQVR4AewaftIAAAvTSURBVO3BQY5gWW4kQCcR97+yT2+1EFDzEl0/qTCz6X8EADhtAwCctwEAztsAAOdtAIDzNgDAeRsA4LwNAHDeBgA4bwMAnLcBAM7bAADnbQCA8zYAwHkbAOC8DQBw3gYAOG8DAJy3AQDO2wAA520AgPM2AMB5GwDgvA0AcN4GADhvAwCctwEAztsAAOdtAIDzNgDAeRsA4LyffGhmwt+vbV7NTF61zRdmJn+ibV7NTL7QNq9mJq/a5iszky+0zauZCX+/tvnCBgA4bwMAnLcBAM7bAADnbQCA8zYAwHkbAOC8DQBw3gYAOG8DAJy3AQDO2wAA520AgPM2AMB5Pzmqbfj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tAIDzNgDAeRsA4LwNAHDeBgA4bwMAnPeTX6ht+He0zTUzkz/RNtfMTL7QNn9iZvKqbV7NTF7NTF61zW/TNq9mJq/a5poNAHDeBgA4bwMAnLcBAM7bAADnbQCA8zYAwHkbAOC8DQBw3gYAOG8DAJy3AQDO2wAA520AgPN+ctTMhL/fzOSatrmobV7NTF61zauZyVdmJl9om1czk1dt82pm8ifahv++DQBw3gYAOG8DAJy3AQDO2wAA520AgPM2AMB5GwDgvA0AcN4GADhvAwCctwEAztsAAOdtAIDzpv8RAOC0DQBw3gYAOG8DAJy3AQDO2wAA520AgPM2AMB5GwDgvA0AcN4GADhvAwCctwEAztsAAOdtAIDzNgDAeRsA4LwNAHDeBgA4bwMAnLcBAM7bAADnbQCA8zYAwHkbAOC8DQBw3gYAOG8DAJy3AQDO2wAA5/0/eZM5+BaeOnQAAAAASUVORK5CYII="
    code_url: "weixin://wxpay/bizpayurl?pr=JM2RWx4zz",
    mch_trade_no: "202105070633559103599974",
    out_order_no: "10018801620383702069",
  },
  message: "成功",
  status: "success"
}

# 最后说明

返回结果里面 qrcode 是 base64 图片,src 赋值即可;

返回结果里面 code_url 需要转成二维码,用微信/支付宝扫码即可支付;

若是支付宝 code_url ,在大部分手机上,跳转这个地址参数,可以拉起支付宝 app 支付(h5)

最后更新于: 11/11/2023, 10:28:08 AM