Skip to main content

SDKs & Libraries

Peak Gateway publishes TypeScript and Kotlin SDKs. Pin an explicit version in production and use the release that matches your target Gateway environment.

TypeScript SDK

  • Package: @gateway/sdk
  • Targets: server and modern web JavaScript runtimes supported by the package's published build
  • Runtime dependencies: none

Install:

npm install @gateway/sdk

The package exposes two top-level clients:

  • GatewayAdminClient for management, reporting, subscription, and webhook APIs on the api.* boundary
  • GatewayPayClient for hosted checkout and payment-facing APIs on the pay.* boundary
import { GatewayPayClient } from '@gateway/sdk'

const client = new GatewayPayClient({
  clientId: process.env.PEAK_CLIENT_ID!,
  clientSecret: process.env.PEAK_CLIENT_SECRET!,
  environment: 'production',
})

const session = await client.checkoutSessions.create({
  amount: 2500,
  currency: 'USD',
  locationId: process.env.PEAK_LOCATION_ID!,
  successUrl: 'https://example.com/checkout/success',
  cancelUrl: 'https://example.com/checkout/cancel',
})

console.log(`Send the shopper to ${session.checkoutUrl}`)

The core processing service is internal-only. Do not call GatewayAdminClient.transactions.sale() or .authorize() through api.peakgateway.co; use hosted checkout or an explicitly documented card-present boundary.

Do not place clientSecret in browser code. Use a backend or a checkout session token for shopper-facing flows.

See the TypeScript SDK reference for modules, result types, OAuth behavior, and webhook verification.

Kotlin and Android SDKs

Published artifacts use Maven group com.myriad.gateway:

ArtifactConsumer
gateway-sdk-core-kmpJVM and Kotlin Multiplatform core client
gateway-sdk-core-kmp-androidPublished Android variant of the KMP core
gateway-sdk-androidSelf-contained Android client and terminal/runtime surface
gateway-sdk-android-nearpayOptional NearPay runtime used with gateway-sdk-android

JVM:

dependencies {
    implementation("com.myriad.gateway:gateway-sdk-core-kmp:<version>")
}

Android applications normally depend on the self-contained Android artifact. Do not also add core artifacts, which would duplicate Gateway classes:

dependencies {
    implementation("com.myriad.gateway:gateway-sdk-android:<version>")
    // Add only when the deployment uses the NearPay rail:
    implementation("com.myriad.gateway:gateway-sdk-android-nearpay:<version>")
}

See the Kotlin SDK reference and Android SDK reference for configuration and platform requirements.

Reliability guidance

  • Reuse a client instance so its token cache and HTTP resources are effective.
  • Supply idempotency keys only on operations that document them.
  • Retry transport failures only through the SDK's documented policy. Never blindly retry an unknown payment outcome; reconcile it first.
  • Handle approved, declined, in-doubt, and API-error results explicitly.
  • Verify webhook signatures before acting on webhook payloads.