github.com/chanxuehong/wechat@v0.0.0-20230222024006-36f0325263cd/mch/core/native_url.go (about)

     1  package core
     2  
     3  import (
     4  	"net/url"
     5  )
     6  
     7  // 扫码原生支付模式1的地址
     8  func NativeURL1(appId, mchId, productId, timestamp, nonceStr, apiKey string) string {
     9  	m := make(map[string]string, 5)
    10  	m["appid"] = appId
    11  	m["mch_id"] = mchId
    12  	m["product_id"] = productId
    13  	m["time_stamp"] = timestamp
    14  	m["nonce_str"] = nonceStr
    15  
    16  	return "weixin://wxpay/bizpayurl?sign=" + Sign(m, apiKey, nil) +
    17  		"&appid=" + url.QueryEscape(appId) +
    18  		"&mch_id=" + url.QueryEscape(mchId) +
    19  		"&product_id=" + url.QueryEscape(productId) +
    20  		"&time_stamp=" + url.QueryEscape(timestamp) +
    21  		"&nonce_str=" + url.QueryEscape(nonceStr)
    22  }