# Generating a transaction

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

## Path parameters:

  - `serviceId` (string, required)
    Service ID

## 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,null)
    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,null)
    Information object for antifraud

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

  - `antifraud.steamid` (integer)
    Buyer's STEAMID64

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

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

  - `billing` (object,null)

  - `billing.name` (string,null, required)

  - `billing.surname` (string,null, required)

  - `billing.street` (string,null, required)

  - `billing.building` (string,null)

  - `billing.flat` (string,null)

  - `billing.city` (string,null, required)

  - `billing.region` (string,null)

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

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

  - `billing.company` (string,null)
    Company name

  - `shipping` (object,null)

  - `cart` (array,null)

  - `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,null, required)
    Product brand

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

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

  - `returns` (object,null)

  - `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,null)
    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,null)
    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,null)
    Object containing additional data passed to the payment channel (recommended for Twisto)

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

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

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

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

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

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

  - `context.previousChargeback` (boolean,null)
    Whether the buyer has had chargebacks before

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

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

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

## Response 200 fields (application/json):

  - `success` (boolean, required)
    Request status
    Example: true

  - `data` (object, required)
    Example: {"transactionId":"1d87a1b3-18f8-4146-bcb1-c0c9f293b04f","redirectUrl":"https://pay.simpay.pl/1d87a1b3-18f8-4146-bcb1-c0c9f293b04f"}

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

  - `data.redirectUrl` (string, required)
    Example: "https://pay.simpay.pl/1d87a1b3-18f8-4146-bcb1-c0c9f293b04f"

## Response 401 fields (application/json):

  - `success` (boolean, required)
    Request status

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

## Response 403 fields (application/json):

  - `success` (boolean, required)
    Request status

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

## 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 fields (application/json):

  - `success` (boolean, required)
    Request status

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

  - `errors` (object, required)
    Example: {"amount":["The amount field is required."],"currency":["The selected currency is invalid."]}

  - `errors.amount` (array)
    Example: ["The amount field is required."]


