# Retrieving transaction details

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

## 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
    Example: "flsm_aaaabbbb"

## Path parameters:

  - `serviceId` (string, required)
    Service ID

  - `transactionId` (string, required)
    Transaction ID

## Response 200 fields (application/json):

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

  - `data` (object, required)
    Example: {"id":"328bd42d-d08b-43f6-9463-869e5bd32b4","payer_transaction_id":"477YDX14","status":"transaction_paid","amount":{"value":7.55,"currency":"BRL","commission":0.12,"commission_currency":"EUR","original":{"value":5,"currency":"PLN","pln_rate":1}},"channel":"nest","control":null,"description":null,"redirect":{"success":null,"failure":null},"customer":{"name":null,"email":"kontakt@simpay.pl","ip":"192.168.0.1","country":"PL"},"billing":{"name":null,"surname":null,"street":null,"building":null,"flat":null,"city":null,"region":null,"postalCode":null,"country":null,"company":null},"shipping":{"name":null,"surname":null,"street":null,"building":null,"flat":null,"city":null,"region":null,"postalCode":null,"country":null,"company":null},"cart":null,"paid_at":"2023-12-07T05:21:50+01:00","expires_at":null,"created_at":"2023-12-07T05:20:30+01:00","updated_at":"2023-12-07T05:21:50+01:00"}

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

  - `data.payer_transaction_id` (string, required)
    Transaction identifier shared with the payer
    Example: "477YDX14"

  - `data.status` (string, required)
    Transaction status
    Enum: "transaction_new", "transaction_confirmed", "transaction_generated", "transaction_paid", "transaction_failure", "transaction_expired", "transaction_canceled", "transaction_refunded", "transaction_fraud", "transaction_fraud_possibility"

  - `data.amount` (object, required)
    Example: {"value":7.55,"currency":"BRL","commission":0.12,"commission_currency":"EUR","original":{"value":5,"currency":"PLN","pln_rate":1}}

  - `data.amount.value` (number, required)
    Payment amount in the buyer's currency
    Example: 7.55

  - `data.amount.currency` (string, required)
    Buyer's currency
    Example: "BRL"

  - `data.amount.commission` (number,null, required)
    SimPay's commission amount
    Example: 0.12

  - `data.amount.commission_currency` (string, required)
    Commission currency (PLN/EUR)
    Example: "EUR"

  - `data.amount.original` (object)
    Original amounts declared at initiation
    Example: {"value":5,"currency":"PLN","pln_rate":1}

  - `data.amount.original.value` (number,null)
    Payment amount
    Example: 5

  - `data.amount.original.currency` (string,null)
    Payment currency
    Example: "PLN"

  - `data.amount.original.pln_rate` (number,null)
    Currency exchange rate
    Example: 1

  - `data.channel` (string,null, required)
    Example: "nest"

  - `data.control` (string,null, required)

  - `data.description` (string,null, required)

  - `data.redirect` (object, required)
    Example: {"success":null,"failure":null}

  - `data.redirect.success` (string,null, required)

  - `data.redirect.failure` (string,null, required)

  - `data.customer` (object, required)
    Example: {"name":null,"email":"kontakt@simpay.pl","ip":"192.168.0.1","country":"PL"}

  - `data.customer.name` (string,null, required)

  - `data.customer.email` (string,null, required)
    Example: "kontakt@simpay.pl"

  - `data.customer.ip` (string,null)
    Example: "192.168.0.1"

  - `data.customer.country` (string,null)
    Example: "PL"

  - `data.billing` (object,null, required)

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

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

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

  - `data.billing.building` (string,null)

  - `data.billing.flat` (string,null)

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

  - `data.billing.region` (string,null)

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

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

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

  - `data.shipping` (object,null, required)

  - `data.cart` (array,null, required)

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

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

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

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

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

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

  - `data.paid_at` (string, required)
    Creation date in format: ISO 8601

  - `data.expires_at` (string, required)
    Creation date in format: ISO 8601

  - `data.created_at` (string, required)
    Creation date in format: ISO 8601

  - `data.updated_at` (string, required)
    Creation date in format: ISO 8601

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


