Skip to main content

Documentation Index

Fetch the complete documentation index at: https://docs.zabcik.me/llms.txt

Use this file to discover all available pages before exploring further.

Quickstart

This walkthrough targets the sandbox. Use production gatewayUrl and credentials only when you are ready to go live — see Production checklist.
Follow the steps below to create a payment and inspect its state with the GoPay SDK.
1

Prepare credentials

Create sandbox credentials in your GoPay account and configure:
  • GOPAY_CLIENT_ID
  • GOPAY_CLIENT_SECRET
  • your merchant goid
2

Create the client

import { createGoPayClient } from 'gopay-sdk';

const client = createGoPayClient({
  goid: 8123456789,
  clientId: process.env.GOPAY_CLIENT_ID!,
  clientSecret: process.env.GOPAY_CLIENT_SECRET!,
  gatewayUrl: 'https://gw.sandbox.gopay.com/api',
});
3

Create a payment

import { Currency } from 'gopay-sdk';

const payment = await client.createPayment({
  amount: 10000, // 100.00 CZK in minor units
  currency: Currency.CZK,
  order_number: `ORDER-${Date.now()}`,
  payer: {
    contact: {
      email: 'buyer@example.com',
    },
  },
  callback: {
    return_url: 'https://example.com/return',
    notification_url: 'https://example.com/notify',
  },
});
4

Send the shopper to GoPay

if (payment.gw_url) {
  // From a backend service, return this URL to your frontend or redirect
  console.log('Redirect user to:', payment.gw_url);
}
5

Query payment state

if (payment.id) {
  const details = await client.getPayment(payment.id);
  console.log(details.state, details.sub_state);
}
Amounts are always in minor units (e.g. halers for CZK). See Best practices for more payment integration patterns.

Next steps