# Introduction - Online Payments

Welcome to the Online Payments module! This guide will walk you through the most important steps needed to start
accepting payments using our API. In just a few minutes, you'll generate your first transaction.

## 1. Prerequisites

Before sending your first API request, you need to prepare two things in the SimPay Client Panel:

1. **Service registration:** Go to the Client Panel and add a new service for Online Payments. After creating it,
you will receive a unique service identifier (e.g., `e65c7519`), which will be required when generating each transaction (
you will provide it in the URL).
2. **API Key (Bearer Token):** Authentication in our API is done using tokens. You can find your API key
after logging into the panel, under the **My Account > API Keys** tab.


Test mode
To test payments without using real money and actually charging accounts, simply **enable "Test
mode"** in the settings of your specific service in the Client Panel.

## 2. API Communication Basics

Our API is designed in the REST spirit and communicates exclusively in **JSON** format.

Every request sent to SimPay servers must absolutely include security in the form of a token and appropriate
HTTP headers. Missing the `Content-Type` header may result in request rejection.


```http
Authorization: Bearer YOUR_API_KEY
Accept: application/json
Content-Type: application/json
```

## 3. Generating Your First Transaction

To create a new payment transaction and generate a link for the customer, send a `POST` request to the endpoint
`/payment/{serviceId}/transactions`, replacing `{serviceId}` with your service identifier.

### Example Request

Below is the simplest possible request. According to the specification, the only absolutely required field in the request
body is the amount (`amount`).


```http
POST /payment/e65c7519/transactions HTTP/1.1
Host: api.simpay.pl
Authorization: Bearer YOUR_API_KEY
Accept: application/json
Content-Type: application/json

{
  "amount": 100.00,
  "currency": "PLN"
}
```

> **Want to send more data?** You can optionally provide the customer's email address, restrict available payment channels,
or force a specific gateway language. The full list and structure of all supported parameters can be found in our
**[API Reference](/apis)**.


### Example Response

Upon successful transaction creation, the server will return an `HTTP 200 OK` status and a JSON object containing
the transaction identifier and `redirectUrl` – the address to which you should redirect the buyer.


```json
{
  "success": true,
  "data": {
    "transactionId": "1d87a1b3-18f8-4146-bcb1-c0c9f293b04f",
    "redirectUrl": "https://pay.simpay.pl/1d87a1b3-18f8-4146-bcb1-c0c9f293b04f"
  }
}
```

> **What now?** Redirect your customer's browser to the address provided in the `redirectUrl` field. The customer will pay for the order
on our gateway, and we'll take care of the rest!


## 4. What's Next?

You've successfully generated your first transaction! To build a complete and fully automated e-commerce integration,
explore the following topics:

👉 **[IPN Notifications (Webhooks)](/notifications/payment)** – an absolute must! Learn how your server should
automatically find out that the customer has actually paid for the order, so you can deliver the goods.

👉 **[Payments bypassing the gateway (directChannel)](/payment/directchannel)** – learn how to implement
White-Label Checkout and increase conversion in your store.

👉 **[Transaction status list](/payment/statuses)** – learn the full payment lifecycle.