consts

package
v0.2.17 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Jun 25, 2023 License: Apache-2.0 Imports: 1 Imported by: 0

Documentation

Overview

Package consts 微信支付 API v3 Go SDK 常量

Index

Constants

View Source
const (
	WechatPayAPIServer       = "https://api.mch.weixin.qq.com"  // 微信支付 API 地址
	WechatPayAPIServerBackup = "https://api2.mch.weixin.qq.com" // 微信支付 API 备份地址
)

微信支付 API 地址

View Source
const (
	Version         = "0.2.15"                     // SDK 版本
	UserAgentFormat = "WechatPay-Go/%s (%s) GO/%s" // UserAgent中的信息
)

SDK 相关信息

View Source
const (
	Authorization = "Authorization"  // Header 中的 Authorization 字段
	Accept        = "Accept"         // Header 中的 Accept 字段
	ContentType   = "Content-Type"   // Header 中的 ContentType 字段
	ContentLength = "Content-Length" // Header 中的 ContentLength 字段
	UserAgent     = "User-Agent"     // Header 中的 UserAgent 字段
)

HTTP 请求报文 Header 相关常量

View Source
const (
	ApplicationJSON = "application/json"
	ImageJPG        = "image/jpg"
	ImagePNG        = "image/png"
	VideoMP4        = "video/mp4"
)

常用 ContentType

View Source
const (
	SignatureMessageFormat = "%s\n%s\n%d\n%s\n%s\n" // 数字签名原文格式
	// HeaderAuthorizationFormat 请求头中的 Authorization 拼接格式
	HeaderAuthorizationFormat = "%s mchid=\"%s\",nonce_str=\"%s\",timestamp=\"%d\",serial_no=\"%s\",signature=\"%s\""
)

请求报文签名相关常量

View Source
const (
	WechatPayTimestamp = "Wechatpay-Timestamp" // 微信支付回包时间戳
	WechatPayNonce     = "Wechatpay-Nonce"     // 微信支付回包随机字符串
	WechatPaySignature = "Wechatpay-Signature" // 微信支付回包签名信息
	WechatPaySerial    = "Wechatpay-Serial"    // 微信支付回包平台序列号
	RequestID          = "Request-Id"          // 微信支付回包请求ID
)

HTTP 应答报文 Header 相关常量

View Source
const (
	FiveMinute     = 5 * 60           // 回包校验最长时间(秒)
	DefaultTimeout = 30 * time.Second // HTTP 请求默认超时时间
)

时间相关常量

Variables

This section is empty.

Functions

This section is empty.

Types

This section is empty.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL