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

> Create your first GoPay payment with the GoPay SDK (gopay-sdk).

# Quickstart

<Info>
  This walkthrough targets the **sandbox**. Use production `gatewayUrl` and credentials only when you are ready to go live — see [Production checklist](/production-checklist).
</Info>

Follow the steps below to create a payment and inspect its state with the GoPay SDK.

<Steps>
  <Step title="Prepare credentials">
    Create sandbox credentials in your GoPay account and configure:

    * `GOPAY_CLIENT_ID`
    * `GOPAY_CLIENT_SECRET`
    * your merchant `goid`
  </Step>

  <Step title="Create the client">
    ```ts theme={null}
    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',
    });
    ```
  </Step>

  <Step title="Create a payment">
    ```ts theme={null}
    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',
      },
    });
    ```
  </Step>

  <Step title="Send the shopper to GoPay">
    ```ts theme={null}
    if (payment.gw_url) {
      // From a backend service, return this URL to your frontend or redirect
      console.log('Redirect user to:', payment.gw_url);
    }
    ```
  </Step>

  <Step title="Query payment state">
    ```ts theme={null}
    if (payment.id) {
      const details = await client.getPayment(payment.id);
      console.log(details.state, details.sub_state);
    }
    ```
  </Step>
</Steps>

<Tip>
  **Amounts** are always in **minor units** (e.g. halers for CZK). See [Best practices](/best-practices) for more payment integration patterns.
</Tip>

## Next steps

* [Configuration](/configuration) — timeouts, OAuth scope, language, custom `User-Agent`
* [Error handling](/error-handling) — retries and failure handling
* [Payments](/payments) — full payment lifecycle and options
