There’s one official SDK per language. All five cover all 115 operations of the gateway with the same names (adapted to each language’s conventions) and handle what every integration ends up doing by hand: authentication, Idempotency-Key on writes, retries with backoff, typed problem+json errors, pagination, deprecation warnings and webhook verification. They’re all on version 1.1.0 and target API v1 (aligned SemVer: SDK major = API major).

Requirements #

SDKPackageRequirementsDependencies
Pythoncompense-sdk-python (imported as compense_gateway)Python 3.9+httpx (sync and async client)
JavaScript / TypeScript@compense/sdkNode.js 18+ (also Deno, Bun and edge)None: uses native fetch. ESM and CommonJS with types
PHPcompense/sdkPHP 8.1+Any PSR-18 client (Guzzle suggested)
.NETCompense.Sdknet8.0 or netstandard2.0 (.NET Framework 4.6.2+)System.Text.Json, Microsoft.Extensions.Http
Gogithub.com/Appiasoft/compense-saas-sdk-goGo 1.21+ (iterators with 1.23+)Standard library only

Installation #

Install
pip install compense-sdk-python

Your package manager can't find the SDK?

The SDKs aren’t on the public registries (PyPI, npm, Packagist, NuGet) yet: they’re distributed as releases of their private GitHub repositories. During onboarding Compense gives your team read access, and you download the package from each repo’s v1.1.0 release (compense-saas-sdk-python, -js, -php, -dotnet, -go in the Appiasoft organization). It installs the same way: pip install ./compense_sdk_python-1.1.0-py3-none-any.whl, npm install ./compense-sdk-1.1.0.tgz, dotnet add package Compense.Sdk --source ./artifacts, a vcs repository (or path with the zip) in composer.json, and for Go set GOPRIVATE=github.com/Appiasoft/* before go get. Each release has the exact instructions.

Create the client #

Create one client per key and reuse it: they’re all safe for concurrent use and keep a connection pool.

import os
from compense_gateway import CompenseClient, AsyncCompenseClient

client = CompenseClient(api_key=os.environ["COMPENSE_API_KEY"], environment="sandbox")

# Same surface, everything awaitable (FastAPI, aiohttp…):
async_client = AsyncCompenseClient(api_key=os.environ["COMPENSE_API_KEY"], environment="sandbox")

Client options #

The same knobs exist in all five SDKs:

OptionPythonJavaScript / TSPHP.NETGo
Environmentenvironment=environmentenvironment:CompenseEnvironment / EnvironmentWithEnvironment
Custom base URL (overrides the environment)base_url=baseUrlbaseUrl:BaseUrlWithBaseURL
Per-attempt timeouttimeout= (s)timeout (ms)timeout: (s)Timeout (TimeSpan)WithTimeout
Retriesretry=RetryConfig(...)retry: {...}retry: new RetryConfig(...)Retry = new RetryOptions {...}WithRetry(RetryConfig{...})
Retry writesRetryConfig(retry_writes=True)retryWrites: trueRetryConfig(retryWrites: true)RetryWrites = trueWithRetryWrites(true)
Custom HTTP clienthttp_client= / transport= (httpx)fetchhttpClient: (PSR-18)new CompenseClient(httpClient, options)WithHTTPClient
Deprecation warningscompense_gateway loggerloggerlogger: (PSR-3)ILogger (Compense.Sdk)WithLogger (slog)

Example with everything configured:

from compense_gateway import CompenseClient, RetryConfig

client = CompenseClient(
    api_key=os.environ["COMPENSE_API_KEY"],
    environment="sandbox",
    timeout=30.0,
    retry=RetryConfig(max_attempts=5, backoff_base=0.5, backoff_max=30.0, jitter=True),
)

Each option is covered in detail in Retries and backoff and on each SDK’s page. Next step: your first call.