Official-style Go client for the ABA PayWay payment gateway (ABA Bank, Cambodia). Standard library only in the core SDK — no runtime dependencies beyond Go.
go get github.com/abapayway/go
package main
import (
"context"
"log"
"github.com/abapayway/go/abapayway"
"github.com/abapayway/go/abapayway/types"
)
func main () {
client , err := abapayway .NewClient (& abapayway.Config {
MerchantID : "your_merchant_id" ,
APIKey : "your_api_key" ,
Sandbox : true ,
})
if err != nil {
log .Fatal (err )
}
checkout , err := client .Checkout .Create (context .Background (), & types.CheckoutOptions {
Amount : 10.00 ,
Currency : string (abapayway .CurrencyUSD ),
OrderID : "order-12345" ,
ReturnURL : abapayway .EncodeURL ("https://yoursite.com/return" ),
})
if err != nil {
log .Fatal (err )
}
_ = checkout .HTML // hosted checkout HTML
}
For refund, payment link, and pre-auth APIs, set RSAPublicKeyPEM on Config (RSA public key from ABA Bank).
Field
Description
MerchantID
Merchant key from ABA Bank
APIKey
HMAC signing key (public key)
RSAPublicKeyPEM
RSA public key PEM for encrypted endpoints
Sandbox
Use sandbox base URL when true
BaseURL
Optional override of sandbox/production URL
HTTPClient
Optional custom *http.Client (default 30s timeout)
Base URLs (from PayWay API docs ):
Sandbox: https://checkout-sandbox.payway.com.kh
Production: https://checkout.payway.com.kh
client.Checkout — Ecommerce checkout
Method
Description
Create(ctx, options)
Purchase API — returns checkout HTML
GetTransaction(ctx, transactionId)
Full transaction details and history
CloseTransaction(ctx, transactionId)
Cancel transaction (no callback)
CheckTransaction(ctx, transactionId)
Status check (within 7 days)
GetTransactionList(ctx, filters)
Paginated transaction list
GetExchangeRate(ctx)
Latest ABA Bank forex rates
Method
Description
Create(ctx, transactionId, amount)
Full or partial refund (requires RSA)
Method
Description
Verify(payload, signature)
HMAC-SHA512 webhook signature verification
client.Credentials — Credentials on file
Method
Description
LinkAccount(ctx, options)
QR / deeplink for ABA account linking
LinkCard(ctx, options)
HTML for card linking
Payment(ctx, token, options)
Pay with stored token (PWT)
RenewToken(ctx, options)
Renew expiring account tokens (request_id, ctid, pwt)
GetTokenDetails(ctx, requestID)
Retrieve token details by request_id
RemoveToken(ctx, options)
Remove linked token (ctid, pwt)
Subscribe(ctx, options)
Purchase + link via Purchase API (multipart)
Method
Description
Generate(ctx, options)
Generate payment QR (online / in-store)
Method
Description
Create(ctx, options)
Create payment link (requires RSA)
Get(ctx, linkId)
Payment link details (requires RSA)
Method
Description
Complete(ctx, transactionId, options)
Capture pre-authorized funds
CompleteWithPayout(ctx, transactionId, options)
Capture with payout
Cancel(ctx, transactionId)
Release pre-auth hold
Method
Description
Create(ctx, options)
Split / route funds (requires RSA)
UpdateBeneficiaryStatus(ctx, beneficiaryId, status)
Toggle beneficiary active/inactive
AddBeneficiaryToWhitelist(ctx, options)
Whitelist payout accounts
client.Transaction — KHQR / merchant reference
Method
Description
GetByMerchantRef(ctx, merchantRef)
Transactions by merchant_ref
EncodeItems, EncodeDeeplink, EncodeBase64JSON, EncodeURL — Base64 encoding for PayWay fields
Typed errors: AuthenticationError, ValidationError, NetworkError, TransactionError, RefundError, WebhookError, TokenError
Error helpers: IsAuthenticationError, IsValidationError, IsNetworkError, IsTransactionError
go test ./... -race -coverprofile=coverage.out
See CONTRIBUTING.md .
MIT — see LICENSE .