# Retrieving service details

Endpoint: GET /payment/{serviceId}
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

## Response 200 fields (application/json):

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

  - `data` (object, required)
    Fields with empty values are omitted from the response.
    Example: {"id":"d151e4f9","name":"Test service","status":"service_active","contact":"kontakt@simpay.pl","url":"https://simpay.pl","terms_url":"https://simpay.pl/regulamin","created_at":"2021-11-08T18:19:16+01:00","service_type":"SIMPAY","settlement_id":"d151e4f9"}

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

  - `data.name` (string, required)
    Service name
    Example: "Test service"

  - `data.status` (string, required)
    Service Status
    Enum: "service_new", "service_active", "service_blocked", "service_rejected", "service_verify", "service_ongoing_registration"

  - `data.contact` (string)
    Service contact email
    Example: "kontakt@simpay.pl"

  - `data.url` (string)
    Service URL
    Example: "https://simpay.pl"

  - `data.terms_url` (string)
    Service terms URL
    Example: "https://simpay.pl/regulamin"

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

  - `data.service_type` (string, required)
    Service type (FLOW for SimPay Flow submerchant services)
    Enum: "SIMPAY", "FLOW"

  - `data.settlement_id` (string, required)
    Service settlement ID. For FLOW services it is the parent service ID with the submerchant identifier appended.
    Example: "d151e4f9"

  - `data.flow` (object)
    Flow service data (only for service_type = FLOW)

  - `data.flow.parent_payment_service` (object)
    Online Payments service linked to the Flow service (same structure as data)

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


