Documentation ¶
Overview ¶
Package order 订单相关
Package order 订单相关 ¶
Package order 订单相关
Index ¶
Examples ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func CloseOrder ¶
关闭订单
以下情况需要调用关单接口:商户订单支付失败需要生成新单号重新发起支付,要对原订单号调用关单,避免重复支付;系统下单后,用户支付超时,系统退出不再受理,避免用户继续,请调用关单接口。
注意:订单生成后不能马上调用关单接口,最短调用时间间隔为5分钟。
See: https://pay.weixin.qq.com/wiki/doc/api/app/app.php?chapter=9_3&index=5
POST https://api.mch.weixin.qq.com/pay/closeorder
Example ¶
package main import ( "fmt" "github.com/fastwego/wxpay" "github.com/fastwego/wxpay/apis/order" ) func main() { var ctx *wxpay.WXPay params := map[string]string{ "appid": "APPID", // ... } resp, err := order.CloseOrder(ctx, params) fmt.Println(resp, err) }
Output:
func OrderQuery ¶
查询订单
该接口提供所有微信支付订单的查询,商户可以通过该接口主动查询订单状态,完成下一步的业务逻辑。
需要调用查询接口的情况:
◆ 当商户后台、网络、服务器等出现异常,商户系统最终未接收到支付通知;
◆ 调用支付接口后,返回系统错误或未知交易状态情况;
◆ 调用被扫支付API,返回USERPAYING的状态;
◆ 调用关单或撤销接口API之前,需确认支付状态;
See: https://pay.weixin.qq.com/wiki/doc/api/app/app.php?chapter=9_2&index=4
POST https://api.mch.weixin.qq.com/pay/orderquery
Example ¶
package main import ( "fmt" "github.com/fastwego/wxpay" "github.com/fastwego/wxpay/apis/order" ) func main() { var ctx *wxpay.WXPay params := map[string]string{ "appid": "APPID", // ... } resp, err := order.OrderQuery(ctx, params) fmt.Println(resp, err) }
Output:
func UnifiedOrder ¶
统一下单
商户系统先调用该接口在微信支付服务后台生成预支付交易单,返回正确的预支付交易会话标识后再在APP里面调起支付。
See: https://pay.weixin.qq.com/wiki/doc/api/app/app.php?chapter=9_1
POST https://api.mch.weixin.qq.com/pay/unifiedorder
Example ¶
package main import ( "fmt" "github.com/fastwego/wxpay" "github.com/fastwego/wxpay/apis/order" ) func main() { var ctx *wxpay.WXPay params := map[string]string{ "appid": "APPID", // ... } resp, err := order.UnifiedOrder(ctx, params) fmt.Println(resp, err) }
Output:
Types ¶
This section is empty.