---
url: https://simplepay.webmania.cc/en/guide/getting-started.md
description: >-
  SimplePay Node.js integration step by step: install with npm, yarn or pnpm,
  set up merchant keys, run your first sandbox payment with simplepay-js-sdk.
---

# Getting started

`simplepay-js-sdk` is a small TypeScript package with no runtime dependencies. It starts SimplePay payments from a Node.js app and verifies the back-URL redirect and the IPN notification.

::: warning Unofficial SDK
This package is a community project, not a SimplePay Zrt. product. SimplePay's rules and API behaviour are described in the [official documentation](https://docs.simplepay.hu/).
:::

## Requirements

* Node.js 20 or newer (the package uses the built-in `fetch` and `AbortSignal.timeout`)
* A SimplePay merchant account. A sandbox account is enough for testing.
* An ESM project (`import`). The package ships as an ES module only.

## 1. Install

::: code-group

```bash [npm]
npm install simplepay-js-sdk
```

```bash [yarn]
yarn add simplepay-js-sdk
```

```bash [pnpm]
pnpm add simplepay-js-sdk
```

:::

## 2. Set up your keys

In the SimplePay merchant admin each account (one per currency) has a **merchant ID** and a **secret key**. The SDK reads them from environment variables named after the currency:

```bash [.env]
SIMPLEPAY_MERCHANT_ID_HUF=P123456
SIMPLEPAY_MERCHANT_KEY_HUF=your-secret-key
SIMPLEPAY_REDIRECT_URL=https://example.com/payment/back
# SIMPLEPAY_PRODUCTION=true   # live only!
```

Until `SIMPLEPAY_PRODUCTION` is `true`, every call goes to the sandbox (`https://sandbox.simplepay.hu/payment/v2`). All variables: [Configuration](./configuration).

::: danger Keep the secret key on the server
Anyone with a `SIMPLEPAY_MERCHANT_KEY_*` value can send signed requests in your name. Keep it out of the browser, git and logs.
:::

## 3. First sandbox payment

```ts
import { startPayment } from 'simplepay-js-sdk'

const response = await startPayment({
  orderRef: `order-${Date.now()}`, // unique order reference
  total: 1212,
  customerEmail: 'customer@example.com',
  invoice: {
    name: 'Test Customer',
    country: 'HU',
    state: 'Budapest',
    city: 'Budapest',
    zip: '1111',
    address: 'Fő utca 1.',
  },
})

console.log(response.paymentUrl)
```

Open `paymentUrl` and pay with a [sandbox test card](./testing), for example `4908 3660 9990 0425`, expiry `12/28`, CVC `123`.

## 4. The three endpoints

A complete SimplePay integration needs three server endpoints:

| Endpoint | What it does | Guide |
|---|---|---|
| Start payment | `startPayment()`, then redirect to `paymentUrl` | [One-time payment](./one-time-payment) |
| Back URL | `getPaymentResponse(r, s)` when the customer returns | [Back URL](./back-url) |
| IPN | `handleIpnRequest()` for SimplePay's server-to-server notification | [IPN](./ipn) |

Mark the order as paid **from the IPN**, not from the back URL: the customer may close the browser before returning.

## Next

* [Framework recipes](../recipes/nuxt): Nuxt / Nitro, Express, Next.js
* [API reference](../reference/api)
* [Go-live checklist](./go-live)
