Skip to main content

GoPay SDK

Package: gopay-sdk on npm — a TypeScript client for the official GoPay REST API, built for server-side Node.js services.
New here? Follow InstallationQuickstart → your first sandbox payment, then dive into Payments and Error handling.
The SDK handles OAuth2 tokens, typed requests and responses, and the full payment lifecycle so you can focus on your product logic.

Highlights

What you can build

  • Payments — create, query, and complete checkout flows
  • Refunds — full or partial refunds and refund history
  • Recurrence & auth — recurring charges, captures, voids
  • Instruments & statements — payment methods per currency, account exports
  • Observability — inject HttpTransport / TokenCache for tracing and shared caches

Installation

Add gopay-sdk and point at sandbox or production gateway URLs.

Quickstart

Sandbox credentials, client setup, and first createPayment in a few steps.

Configuration

Timeouts, OAuth scope, language, custom User-Agent, transport, and cache.

Payments

Create payments, query state, cards, and embed helpers.

Error handling

GoPayApiError vs GoPayConfigError, retries, and logging safely.

Best practices

Production patterns: secrets, amounts, idempotency, and resilience.

Requirements

  • Node.js >=18
  • TypeScript >=5 (recommended)

Install

Minimal example