Skip to main content
The UQPAY Go SDK provides typed access to the UQPAY API, including automatic OAuth2 authentication, automatic idempotency keys, and thread-safe credential management.

GitHub

github.com/uqpay/uqpay-sdk-go
The SDK requires Go 1.19 or higher. Current version: 1.0.3.

Installation

go get github.com/uqpay/uqpay-sdk-go@latest

Quick start

package main

import (
    "context"
    "log"

    "github.com/uqpay/uqpay-sdk-go"
    "github.com/uqpay/uqpay-sdk-go/configuration"
    "github.com/uqpay/uqpay-sdk-go/issuing"
)

func main() {
    client, err := uqpay.NewClient(
        "your-client-id",
        "your-api-key",
        configuration.Sandbox(),
    )
    if err != nil {
        log.Fatal(err)
    }

    ctx := context.Background()

    // Create a cardholder
    cardholder, err := client.Issuing.Cardholders.Create(ctx, &issuing.CreateCardholderRequest{
        Email:       "user@example.com",
        PhoneNumber: "1234567890",
        FirstName:   "John",
        LastName:    "Doe",
        CountryCode: "US",
    })
    if err != nil {
        log.Fatal(err)
    }
    log.Printf("Cardholder ID: %s\n", cardholder.CardholderID)
}

Configuration

// Sandbox (for testing)
client, err := uqpay.NewClient(clientID, apiKey, configuration.Sandbox())

// Production
client, err := uqpay.NewClient(clientID, apiKey, configuration.Production())

Authentication

The SDK handles OAuth2 authentication automatically:
  • Fetches access tokens using client credentials
  • Caches tokens until expiration
  • Automatically refreshes expired tokens
  • Thread-safe token management

Idempotency

Every API request automatically includes a unique idempotency key to ensure safe retries and prevent duplicate operations. You do not need to set this manually.

Error handling

The SDK returns detailed error information including HTTP status codes and API error details:
card, err := client.Issuing.Cards.Get(ctx, cardID)
if err != nil {
    log.Printf("Error: %v\n", err)
    return
}
Example error format:
failed to get card: 404: card_not_found: Card not found (HTTP 404)

API coverage

Banking API

ResourceOperations
BalancesGet, List, ListTransactions
TransfersCreate, List, Get
DepositsList, Get
BeneficiariesCreate, List, Get, Update, Delete, ListPaymentMethods, Check
PayoutsCreate, List, Get
Virtual AccountsCreate, List
ConversionsCreateQuote, Create, List, Get, ListConversionDates
Exchange RatesList

Issuing API

ResourceOperations
CardholdersCreate, Get, List
CardsCreate, Get, GetSecure, List, Recharge, Withdraw, UpdateStatus
TransactionsGet, List
ProductsList