> ## 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.

# Payments

> Create and query GoPay payments with fully typed request and response models.

# Payments

<Tip>
  After `createPayment`, send the shopper to **`gw_url`**. Treat **notification** and **return** callbacks as hints — always confirm status with **`getPayment`** on the server.
</Tip>

This page covers core payment creation and retrieval operations.

## Create payment

```ts theme={null}
import { Currency, 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',
});

const payment = await client.createPayment({
  amount: 15900,
  currency: Currency.CZK,
  order_number: 'ORDER-15900',
  order_description: 'Premium subscription',
  payer: {
    contact: {
      email: 'buyer@example.com',
      first_name: 'John',
      last_name: 'Doe',
    },
  },
  callback: {
    return_url: 'https://example.com/payment/return',
    notification_url: 'https://example.com/payment/notify',
  },
});
```

### Automatic defaults

If omitted, the SDK injects:

* `target: { type: 'ACCOUNT', goid: <configured-goid> }`
* `lang: <configured-language>`

## Query payment details

```ts theme={null}
const details = await client.getPayment(payment.id!);

console.log({
  id: details.id,
  state: details.state,
  subState: details.sub_state,
  amount: details.amount,
  currency: details.currency,
});
```

## Card details and card deletion

```ts theme={null}
const card = await client.getCardDetails(123456);
console.log(card.status, card.card_brand, card.card_expiration);

await client.deleteCard(123456);
```

## Embed.js helper

To embed GoPay UI assets with the same gateway environment:

```ts theme={null}
const embedJsUrl = client.getEmbedJsUrl();
// https://gw.sandbox.gopay.com/gp-gw/js/embed.js
```

## Types used

From `gopay-sdk` exports:

* `CreatePaymentRequest`
* `PaymentResponse`
* `CardDetailsResponse`
* `Currency`, `Language`, `PaymentInstrument`, and other enums
