Skip to content

SDK Guide

Updated: 9/16/26, 11:08:10 AM

Overview

DaxPay provides official signing SDKs for the open Payment API (/unipay/*). They encapsulate request signing, response verification and callback verification, so you don't have to implement the Signature Mechanism by hand. The Go / Java / Node.js / PHP / Python SDKs share the same contract and golden test vectors — their behavior is byte-for-byte identical.

Every SDK needs only two keys:

KeyPurposeSource
Merchant private key (privateKey)Sign requestsYou generate an RSA key pair and keep the private key
Platform public key (publicKey)Verify responses and async notificationsObtain from the admin panel (App Configuration)

Languages & Repositories

LanguagePackage CoordinateRequirementsRepository
Gogithub.com/opendaxpay/dax-pay-sdk-goGo ≥ 1.21, zero third-party dependenciesGitee / GitHub
Javacn.daxpay.open:daxpay-open-sdkJava ≥ 8 (depends on Hutool)Gitee / GitHub
Node.js@daxpay/open-sdkNode ≥ 18 (ESM + TypeScript)Gitee / GitHub
PHPdaxpay/open-sdkPHP ≥ 7.4 (ext-json / openssl / mbstring)Gitee / GitHub
Pythondaxpay-open-sdkPython ≥ 3.10 (depends on cryptography)Gitee / GitHub

Source-based installation for now

None of the SDKs are published to public package registries (Maven Central / npm / PyPI / Packagist). Use the source-based installation shown in each tab below.

Quick Start

Install

bash
go get github.com/opendaxpay/dax-pay-sdk-go@main
go
import "github.com/opendaxpay/dax-pay-sdk-go/daxpay"

Initialize the Client

go
config := daxpay.Config{
    ServiceUrl: "https://your-domain.com", // platform gateway URL
    MchNo:      "M200000001",              // merchant number
    AppId:      "APP001",                  // app ID
    PrivateKey: merchantPrivateKeyPem,     // merchant private key (PEM text)
    PublicKey:  platformPublicKeyPem,      // platform public key (PEM text)
    Timeout:    30 * time.Second,
}
client := daxpay.NewClient(config)

Pay

go
result, err := client.Pay(context.Background(), &daxpay.PayParam{
    BizOrderNo: "PAY20260916001",
    Title:      "Test goods",
    Amount:     100, // amount in cents
    Method:     "wechat_qr",
    NotifyUrl:  "https://example.com/notify",
})
if err != nil {
    log.Fatal(err)
}
fmt.Println(result.OrderNo, result.PayBody)

Main fields of PayResult: orderNo (platform order number), tradeNo (trade number), status (order status), payBody (payment payload: QR link / invoke params / redirect URL), payBodyType (code_url / pay_info / redirect_url).

Verify Callback

go
// rawBody is the raw HTTP request body of the async notification
ok := client.VerifyNotice(rawBody)

Generic Request (execute)

The convenience method currently covers payment only. Refund, refund sync, order query, close and all other endpoints can be called through each SDK's generic execute(path, param): path is the endpoint path (e.g. /unipay/refund), param holds the business fields (common fields such as mchNo/appId/sign/reqTime and the signature are filled in automatically by the SDK). See the API docs for field details.

go
result, err := client.Execute(ctx, "/unipay/refund", map[string]any{
    "bizOrderNo": "PAY20260916001",
    "amount":     100,
    "reason":     "customer refund",
})

Notes

  • Key format: every SDK accepts PEM text; for Python the private key is PKCS#8 and the public key is X.509 SPKI.
  • Always verify callbacks against the raw body: verifyNotice needs the original payload string. Parsing and re-serializing it changes field order/whitespace and breaks the signature.
  • Time and amount: the SDK generates reqTime (Beijing time, yyyy-MM-dd HH:mm:ss) per platform convention; amounts are in cents (Long).
  • Sandbox: just point serviceUrl at your test deployment — SDK behavior is environment-independent.

Official Website · Released under the GNU LGPL v3.0