# Generating a transaction

Endpoint: POST /payment/{serviceId}/transactions
Version: 1.0.0
Security: bearerAuth

## Security:

  - `bearerAuth` (unknown)
    http bearer scopes: payment.transactions.create

## Path parameters:

  - `serviceId` (string, required)

## Header parameters:

  - `x-sim-flow-submerchant` (string)
    **Applies only to SimPay Flow integrators.** If you do not use SimPay Flow - skip this header.
Indicates the submerchant on whose behalf the request is made. The value is the submerchant ID (`flsm_...`)
or its `customId` assigned during registration (max. 36 characters).
**When is the header required?**
When `serviceId` in the path is an Online Payments service **linked to your active Flow service**
(the parent service, visible as `paymentService` in `GET /flow/{flowServiceId}`).
In that case every request to `/payment/{serviceId}/...` must include this header - without it you will receive
`422` with the `SIMPAY_FLOW_VALIDATION_ERROR` code.
For regular Online Payments services (not linked to Flow) the header is ignored.
**How does it work?**
- In the path you always pass the
`serviceId`
 of the
**parent service**
 (linked to the Flow service), not the submerchant's service.
- The request is executed in the context of the submerchant's Online Payments service - transactions, refunds, channels, subscriptions

and BLIK aliases belong to the given submerchant, and funds go to its wallet.
- Submerchant Online Payments services cannot be used directly - passing their ID as
`serviceId`

returns
`422`
 (
`VALIDATION_ERROR`
).

**Possible errors:**
- `422`

`SIMPAY_FLOW_VALIDATION_ERROR`
 - missing header for a service linked to Flow or an invalid value,
- `404`

`FLOW_SUBMERCHANT_NOT_FOUND`
 - the submerchant does not exist within this Flow service,
- `403`

`FLOW_SUBMERCHANT_NOT_ACTIVE`
 - the submerchant has not completed onboarding or is not active,
- `400`

`FLOW_SUBMERCHANT_PAYMENT_SERVICE_NOT_FOUND`
 /
`FLOW_SUBMERCHANT_PAYMENT_SERVICE_NOT_ACTIVE`
 - the submerchant's Online Payments service does not exist or is not active.

**Example:** `x-sim-flow-submerchant: flsm_aaaabbbb` or `x-sim-flow-submerchant: user-123`

## Request fields (application/json):

  - `amount` (number, required)
    Transaction amount

  - `currency` (string)
    Transaction currency

  - `description` (string)
    Transaction description given by the partner, presented on the payment gateway

  - `control` (string)
    Field for use by the partner

  - `customer` (object)
    Basic information about the payer

  - `customer.name` (string)

  - `customer.email` (string)

  - `customer.ip` (string)
    Buyer's IP address. Required when using directChannel.

  - `customer.countryCode` (string)
    Buyer's ISO code. Required when using directChannel.
    Example: PL

  - `antifraud` (object)
    Information object for antifraud

  - `antifraud.useragent` (string)
    Buyer's UserAgent. Required when using directChannel.

  - `antifraud.steamid` (string)
    Buyer's STEAMID64
    Example: 76561198000000000

  - `antifraud.mcusername` (string)
    Minecraft player nickname

  - `antifraud.mcid` (string)
    Minecraft player UUID

  - `billing` (object)

  - `billing.name` (string, required)

  - `billing.surname` (string, required)

  - `billing.street` (string, required)

  - `billing.building` (string)

  - `billing.flat` (string)

  - `billing.city` (string, required)

  - `billing.region` (string)

  - `billing.postalCode` (string, required)
    Postal code, format depends on the `country` field

  - `billing.country` (string, required)
    Country

  - `billing.company` (string)
    Company name

  - `cart` (array)

  - `cart.name` (string, required)
    Product name

  - `cart.quantity` (number, required)
    Quantity of the product

  - `cart.price` (number, required)
    Price of one product

  - `cart.producer` (string, required)
    Product brand

  - `cart.category` (string, required)
    Product category

  - `cart.code` (string, required)
    Product code

  - `returns` (object)

  - `returns.success` (string)

  - `returns.failure` (string)

  - `directChannel` (string)
    In this field you can send the channel ID, then the payer will be redirected directly to the page of the given channel
For example, if you enter `blik`, you will be redirected directly to the BLIK payment gateway. In this case, it is necessary to send `antifraud.useragent` and `customer.ip`.

  - `channels` (array)
    Array with payment channel IDs that will be displayed to the payer on the gateway after redirection to the transaction url
A list of available channels along with their IDs can be obtained here [Retrieving a list of channels for the service](#tag/Payment/operation/paymentGetChannels)

  - `channelTypes` (object)
    Object in which we can define which channel types should be available on the payment gateway

  - `channelTypes.blik` (boolean)
    BLIK payment

  - `channelTypes.transfer` (boolean)
    Online transfers payment

  - `channelTypes.cards` (boolean)
    Card payments

  - `channelTypes.ewallets` (boolean)
    Virtual wallets payments (Google Pay, Apple Pay)

  - `channelTypes.paypal` (boolean)
    PayPal payment

  - `channelTypes.paysafe` (boolean)
    Payments from the Paysafe group (Skrill, PaysafeCard)

  - `channelTypes.latam` (boolean)
    South American payments (PIX, Boleto, BoletoFlash)

  - `referer` (string)

  - `context` (object)
    Object containing additional data passed to the payment channel (recommended for Twisto)

  - `context.accountCreatedAt` (string)
    Date when the buyer's account was created (ISO 8601 format)
    Example: 2026-03-27T14:55:33+01:00

  - `context.salesTotalCount` (integer)
    Number of buyer's transactions completed before this transaction
    Example: 27

  - `context.salesTotalAmount` (number)
    Total amount of all buyer's transactions completed before this transaction
    Example: 1234.56

  - `context.salesAvgAmount` (number)
    Average amount of buyer's transactions completed before this transaction
    Example: 123.45

  - `context.salesMaxAmount` (number)
    Maximum amount of buyer's transactions completed before this transaction
    Example: 500

  - `context.refundsTotalAmount` (number)
    Total amount of all buyer's refunds processed before this transaction
    Example: 0

  - `context.previousChargeback` (boolean)
    Whether the buyer has had chargebacks before
    Example: false

  - `context.accountSetCurrency` (string)
    Buyer's account currency
    Example: PLN

  - `context.lastLoginAt` (string)
    Date of the buyer's last login to the store account
    Example: 2026-03-20T14:55:33+01:00

  - `context.hasPreviousPurchases` (boolean)
    Whether the buyer has made previous purchases in the store
    Example: true

## Response 200 fields (application/json):

  - `success` (boolean, required)
    Request status

  - `data` (object, required)

  - `data.transactionId` (string, required)
    Transaction ID

  - `data.redirectUrl` (string, required)

## Response 401:

  - `401` (unknown)
    Unauthorized

## Response 401 fields (application/json):

  - `feedbackUrl` (string)
    URL for reporting API problems (`POST /feedback`). Returned for authenticated API keys.
    Example: https://api.simpay.pl/feedback

  - `success` (boolean, required)
    Request status

  - `errorCode` (string, required)
    Error status code
    Enum: "UNAUTHORIZED"

## Response 403:

  - `403` (unknown)
    Forbidden

## Response 403 fields (application/json):

  - `feedbackUrl` (string)
    URL for reporting API problems (`POST /feedback`). Returned for authenticated API keys.
    Example: https://api.simpay.pl/feedback

  - `success` (boolean, required)
    Request status

  - `errorCode` (string, required)
    Error status code
    Enum: "INVALID_ABILITY_PROVIDED", "IP_ADDRESS_NOT_WHITELISTED"

## Response 404:

  - `404` (unknown)
    NotFound

## Response 404 fields (application/json):

  - `success` (boolean, required)
    Request status

  - `errorCode` (string, required)
    Error status code
    Enum: "SERVICE_NOT_FOUND", "TRANSACTION_NOT_FOUND", "ROUTE_NOT_FOUND"

## Response 422:

  - `422` (unknown)
    Unprocessable Content

## Response 422 fields (application/json):

  - `feedbackUrl` (string)
    URL for reporting API problems (`POST /feedback`). Returned for authenticated API keys.
    Example: https://api.simpay.pl/feedback

  - `success` (boolean, required)
    Request status

  - `errorCode` (string, required)
    Error status code
    Enum: "VALIDATION_ERROR"

  - `errors` (object, required)

  - `errors.amount` (array)

