Go SDK
Go 标准库客户端,包含四个接口方法、请求签名、回调验签和只读查询示例。
特点
- 内置 CreatePayinOrder、GetPayinOrder、CreateExclusiveBinding、CreatePayoutOrder 4 个方法
- 成功返回原始业务 JSON;普通 JSON 错误与 HTTP 空正文拒绝分别处理。
- 回调使用原订单 API Key 和原始请求体字节验签。
安装
cd uugate-go-sdk
go test ./...
go run ./examples/basic快速示例
import (
"context"
"os"
uugate "uugate.local/openapi"
)
client, err := uugate.NewClient("https://api.uugate.com",
os.Getenv("UUGATE_MERCHANT_UID"), os.Getenv("UUGATE_API_KEY"))
if err != nil { panic(err) }
order, err := client.CreatePayinOrder(context.Background(), map[string]any{
"chainCode": "TRON", "tokenSymbol": "USDT",
"merchantOrderNo": "M202604170001", "amount": "100.00",
"notifyUrl": "https://merchant.example.com/api/uugate/payin-notify",
})
if err != nil { panic(err) }
_ = order