Skip to main content

SDKs & Libraries

TypeScript SDK

  • Packages: @peakgateway/sdk (server and browser-runtime client) and @peakgateway/web-sdk (browser checkout)
  • Targets: Node.js 18.17 or later and modern browser and worker runtimes; ESM
  • Runtime dependencies: none for @peakgateway/sdk
  • Contents: the public merchant and partner API only. Peak's staff, agent and terminal-fleet operations are not in these packages.

retired @gateway scope. Do not install @gateway/sdk from public npm.

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 '@peakgateway/sdk'

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

// Persist this key and the original request before dispatch; reuse on recovery.
const checkoutCreateKey = process.env.CHECKOUT_CREATE_KEY!
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',
}, checkoutCreateKey)

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

The processing service's typed sale and authorization operations are not part of the public SDK. Use hosted checkout, or an explicitly documented card-present boundary, to take a payment.

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

The Kotlin artifact namespace is com.myriad.gateway:

ArtifactConsumer
gateway-sdk-core-kmpJVM and Kotlin Multiplatform core client
gateway-sdk-core-kmp-androidAndroid 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

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.