# OrderSettlement

OrderSettlement

## List order settlements

> List all settlements for an order.

```json
{"openapi":"3.0.2","info":{"title":"Flow Retail API version 2","version":"2.0.0"},"tags":[{"name":"OrderSettlement","description":"OrderSettlement"}],"servers":[{"description":"Flow Retail Production","url":"https://api.flowretail.com/v2"},{"description":"Flow Retail Stage","url":"https://api.stage.flowretail.com/v2"}],"security":[{"accessToken":[]},{"authToken":[]},{"integrationToken":[]}],"components":{"securitySchemes":{"accessToken":{"description":"Accesstoken recevied after user login with a deviceToken","scheme":"bearer","type":"http"},"authToken":{"description":"Token received from the auth service","scheme":"bearer","type":"http"},"integrationToken":{"scheme":"bearer","type":"http"}},"parameters":{"pageNumberQuery":{"description":"Reference to a specific page in a result set.","in":"query","name":"pageNumber","required":false,"schema":{"type":"integer"}},"pageSizeQuery":{"description":"The number of items per page in a result set.","in":"query","name":"pageSize","required":false,"schema":{"type":"integer"}},"sortByQuery":{"description":"Defines which field the resource list is sorted by.","in":"query","name":"sortBy","required":false,"schema":{"type":"string"}},"sortDirectionQuery":{"description":"Reference to a sort direction","explode":false,"in":"query","name":"sortDirection","schema":{"$ref":"#/components/schemas/SortDirectionENUM"},"style":"form"}},"schemas":{"SortDirectionENUM":{"description":"|ENUM      | Description |\n| ---------------- | ------------ |\n| ASC | Sort in ascending order|\n| DESC | Sort in descending order|\n","enum":["ASC","DESC"],"title":"SortDirectionENUM","type":"string"},"SettlementResponseSchema":{"title":"SettlementResponseSchema","type":"object","required":["amount","createdAt","displayMessages","externalId","externalPaymentReference","idMethod","lastModifiedAt","parameters","settlementCode","settlementUid","settlementName","state","status","storeSettlementIssuerUid","tenantUserDisplayName","tenantUserUid","storePaymentMethodUid","currency","additionalDetails","paymentCount","paymentAmount","receiptUid","orderReceiptUid"],"properties":{"amount":{"type":"integer"},"createdAt":{"format":"date-time","type":"string"},"displayMessages":{"type":"array","items":{"$ref":"#/components/schemas/SettlementDisplayMessageSchema"}},"externalId":{"type":"string"},"externalPaymentReference":{"type":"string","description":"The external payment reference for this settlement.\nFor invoices, this could contain the KID"},"idMethod":{"$ref":"#/components/schemas/SettlementIdMethodENUM"},"lastModifiedAt":{"format":"date-time","type":"string"},"ledgerNumber":{"description":"Ledger number must be a valid number with possible leading zeros","type":"string"},"ledgerType":{"$ref":"#/components/schemas/LedgerTypeENUM"},"parameters":{"type":"array","items":{"$ref":"#/components/schemas/SettlementParameterSchema"}},"settledAt":{"format":"date-time","type":"string"},"settlementCode":{"type":"string"},"settlementUid":{"$ref":"#/components/schemas/UID"},"settlementName":{"type":"string"},"state":{"$ref":"#/components/schemas/SettlementStateENUM"},"status":{"$ref":"#/components/schemas/SettlementStatusENUM"},"storeSettlementIssuerUid":{"$ref":"#/components/schemas/UID"},"tenantUserDisplayName":{"type":"string"},"tenantUserUid":{"$ref":"#/components/schemas/UID"},"storePaymentMethodUid":{"$ref":"#/components/schemas/UID"},"currency":{"$ref":"#/components/schemas/SettlementCurrencySchema"},"additionalDetails":{"type":"array","items":{"$ref":"#/components/schemas/SettlementAdditionalDetailsSchema"}},"paymentCount":{"type":"integer"},"paymentAmount":{"type":"integer"},"paymentAomunt":{"type":"integer","deprecated":true},"orderReceiptUid":{"$ref":"#/components/schemas/OptionalUID"}}},"SettlementDisplayMessageSchema":{"description":"Settlement display messages","properties":{"key":{"type":"string"},"message":{"type":"string"},"timestamp":{"format":"date-time","type":"string"}},"required":["key","message","timestamp"],"title":"SettlementDisplayMessageSchema","type":"object"},"SettlementIdMethodENUM":{"enum":["NO_CVM_RULE_PERFORMED","SIGNATURE","PIN_ONLINE","PIN_OFFLINE","PIN_ONLINE_AND_SIGNATURE","PIN_OFFLINE_AND_SIGNATURE","NO_CVM","FAILED","ON_DEVICE","REFUND"],"title":"SettlementIdMethodENUM","type":"string"},"LedgerTypeENUM":{"description":"|ENUM      | Description |\n| ---------------- | ------------ |\n|LEDGER | Ledger |\n|GENERAL_LEDGER | General ledger |\n|CUSTOMER_LEDGER | Customer ledger |","enum":["LEDGER","GENERAL_LEDGER","CUSTOMER_LEDGER"],"title":"LedgerTypeENUM","type":"string"},"SettlementParameterSchema":{"description":"Create a new settlement","title":"SettlementParameterSchema","type":"object","required":["key","value"],"properties":{"key":{"type":"string"},"value":{"type":"string"}}},"UID":{"title":"UID","type":"string","pattern":"^[A-Za-z0-9-_]+"},"SettlementStateENUM":{"enum":["NOT_STARTED","IN_PROGRESS","COMPLETE","TERMINATED"],"title":"SettlementCodeENUM","type":"string"},"SettlementStatusENUM":{"enum":["NEW","PROCESSING","AUTHORIZED","CAPTURED","REFUNDED","PARTIALLY_REFUNDED","PENDING_REFUND","FAILED","CANCELLED_BY_MERCHANT","CANCELLED_BY_USER","CANCELLED_FORCE","DELETED","DENIED","REJECTED"],"title":"SettlementCodeENUM","type":"string"},"SettlementCurrencySchema":{"title":"SettlementCurrencySchema","type":"object","required":["amount","code","exchangeRate"],"properties":{"amount":{"type":"integer"},"code":{"type":"string"},"exchangeRate":{"type":"integer"}}},"SettlementAdditionalDetailsSchema":{"title":"SettlementAdditionalDetailsSchema","type":"object","required":["key","value"],"properties":{"key":{"type":"string"},"value":{"type":"string"}}},"OptionalUID":{"title":"OptionalUID","type":"string","pattern":"^[A-Za-z0-9-_]*"},"Paging":{"description":"totalCount The total number of items in the result set.\n\npageSize The number of items per page.\n\npageNumber The current page in the result set.","properties":{"pageNumber":{"type":"integer"},"pageSize":{"type":"integer"},"totalCount":{"type":"integer"}},"required":["totalCount","pageSize","pageNumber"],"title":"Paging","type":"object"}},"responses":{"SettlementListResponse":{"content":{"application/json":{"schema":{"properties":{"items":{"items":{"$ref":"#/components/schemas/SettlementResponseSchema"},"type":"array"},"paging":{"$ref":"#/components/schemas/Paging"}},"required":["items","paging"],"type":"object"}},"application/vnd.openxmlformats-officedocument.spreadsheetml.sheet":{"schema":{"type":"string","format":"binary"}}},"description":"Example response"}}},"paths":{"/tenants/{tenantUid}/stores/{storeUid}/orders/{orderUid}/settlements":{"get":{"description":"List all settlements for an order.","operationId":"get-tennants-stores-orders-settlements","parameters":[{"$ref":"#/components/parameters/pageNumberQuery"},{"$ref":"#/components/parameters/pageSizeQuery"},{"$ref":"#/components/parameters/sortByQuery"},{"$ref":"#/components/parameters/sortDirectionQuery"}],"responses":{"200":{"$ref":"#/components/responses/SettlementListResponse"}},"summary":"List order settlements","tags":["OrderSettlement"]}}}}
```

## Create a new order settlement

> Create a new settlement for an order.

```json
{"openapi":"3.0.2","info":{"title":"Flow Retail API version 2","version":"2.0.0"},"tags":[{"name":"OrderSettlement","description":"OrderSettlement"}],"servers":[{"description":"Flow Retail Production","url":"https://api.flowretail.com/v2"},{"description":"Flow Retail Stage","url":"https://api.stage.flowretail.com/v2"}],"security":[{"accessToken":[]},{"authToken":[]},{"integrationToken":[]}],"components":{"securitySchemes":{"accessToken":{"description":"Accesstoken recevied after user login with a deviceToken","scheme":"bearer","type":"http"},"authToken":{"description":"Token received from the auth service","scheme":"bearer","type":"http"},"integrationToken":{"scheme":"bearer","type":"http"}},"requestBodies":{"OrderSettlementCreateRequest":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/OrderSettlementCreateSchema"}}}}},"schemas":{"OrderSettlementCreateSchema":{"description":"Create a new settlement","title":"OrderSettlementCreateSchema","type":"object","required":["amount","storePaymentMethodUid"],"properties":{"amount":{"description":"in cents, e.g. 1,50 as 150","type":"integer"},"deviceIdentifier":{"type":"string"},"externalId":{"description":"External reference for the settlement","type":"string"},"parameters":{"description":"Refer to each payment type's options for available parameters, e.g. 'mobile' for VIPPS.","type":"array","items":{"$ref":"#/components/schemas/SettlementParameterSchema"}},"storePaymentMethodUid":{"$ref":"#/components/schemas/OptionalUID"},"settlementUid":{"$ref":"#/components/schemas/UID"}}},"SettlementParameterSchema":{"description":"Create a new settlement","title":"SettlementParameterSchema","type":"object","required":["key","value"],"properties":{"key":{"type":"string"},"value":{"type":"string"}}},"OptionalUID":{"title":"OptionalUID","type":"string","pattern":"^[A-Za-z0-9-_]*"},"UID":{"title":"UID","type":"string","pattern":"^[A-Za-z0-9-_]+"},"SettlementResponseSchema":{"title":"SettlementResponseSchema","type":"object","required":["amount","createdAt","displayMessages","externalId","externalPaymentReference","idMethod","lastModifiedAt","parameters","settlementCode","settlementUid","settlementName","state","status","storeSettlementIssuerUid","tenantUserDisplayName","tenantUserUid","storePaymentMethodUid","currency","additionalDetails","paymentCount","paymentAmount","receiptUid","orderReceiptUid"],"properties":{"amount":{"type":"integer"},"createdAt":{"format":"date-time","type":"string"},"displayMessages":{"type":"array","items":{"$ref":"#/components/schemas/SettlementDisplayMessageSchema"}},"externalId":{"type":"string"},"externalPaymentReference":{"type":"string","description":"The external payment reference for this settlement.\nFor invoices, this could contain the KID"},"idMethod":{"$ref":"#/components/schemas/SettlementIdMethodENUM"},"lastModifiedAt":{"format":"date-time","type":"string"},"ledgerNumber":{"description":"Ledger number must be a valid number with possible leading zeros","type":"string"},"ledgerType":{"$ref":"#/components/schemas/LedgerTypeENUM"},"parameters":{"type":"array","items":{"$ref":"#/components/schemas/SettlementParameterSchema"}},"settledAt":{"format":"date-time","type":"string"},"settlementCode":{"type":"string"},"settlementUid":{"$ref":"#/components/schemas/UID"},"settlementName":{"type":"string"},"state":{"$ref":"#/components/schemas/SettlementStateENUM"},"status":{"$ref":"#/components/schemas/SettlementStatusENUM"},"storeSettlementIssuerUid":{"$ref":"#/components/schemas/UID"},"tenantUserDisplayName":{"type":"string"},"tenantUserUid":{"$ref":"#/components/schemas/UID"},"storePaymentMethodUid":{"$ref":"#/components/schemas/UID"},"currency":{"$ref":"#/components/schemas/SettlementCurrencySchema"},"additionalDetails":{"type":"array","items":{"$ref":"#/components/schemas/SettlementAdditionalDetailsSchema"}},"paymentCount":{"type":"integer"},"paymentAmount":{"type":"integer"},"paymentAomunt":{"type":"integer","deprecated":true},"orderReceiptUid":{"$ref":"#/components/schemas/OptionalUID"}}},"SettlementDisplayMessageSchema":{"description":"Settlement display messages","properties":{"key":{"type":"string"},"message":{"type":"string"},"timestamp":{"format":"date-time","type":"string"}},"required":["key","message","timestamp"],"title":"SettlementDisplayMessageSchema","type":"object"},"SettlementIdMethodENUM":{"enum":["NO_CVM_RULE_PERFORMED","SIGNATURE","PIN_ONLINE","PIN_OFFLINE","PIN_ONLINE_AND_SIGNATURE","PIN_OFFLINE_AND_SIGNATURE","NO_CVM","FAILED","ON_DEVICE","REFUND"],"title":"SettlementIdMethodENUM","type":"string"},"LedgerTypeENUM":{"description":"|ENUM      | Description |\n| ---------------- | ------------ |\n|LEDGER | Ledger |\n|GENERAL_LEDGER | General ledger |\n|CUSTOMER_LEDGER | Customer ledger |","enum":["LEDGER","GENERAL_LEDGER","CUSTOMER_LEDGER"],"title":"LedgerTypeENUM","type":"string"},"SettlementStateENUM":{"enum":["NOT_STARTED","IN_PROGRESS","COMPLETE","TERMINATED"],"title":"SettlementCodeENUM","type":"string"},"SettlementStatusENUM":{"enum":["NEW","PROCESSING","AUTHORIZED","CAPTURED","REFUNDED","PARTIALLY_REFUNDED","PENDING_REFUND","FAILED","CANCELLED_BY_MERCHANT","CANCELLED_BY_USER","CANCELLED_FORCE","DELETED","DENIED","REJECTED"],"title":"SettlementCodeENUM","type":"string"},"SettlementCurrencySchema":{"title":"SettlementCurrencySchema","type":"object","required":["amount","code","exchangeRate"],"properties":{"amount":{"type":"integer"},"code":{"type":"string"},"exchangeRate":{"type":"integer"}}},"SettlementAdditionalDetailsSchema":{"title":"SettlementAdditionalDetailsSchema","type":"object","required":["key","value"],"properties":{"key":{"type":"string"},"value":{"type":"string"}}}},"responses":{"SettlementResponse":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/SettlementResponseSchema"}}},"description":"Example response"}}},"paths":{"/tenants/{tenantUid}/stores/{storeUid}/orders/{orderUid}/settlements":{"post":{"description":"Create a new settlement for an order.","operationId":"post-tennants-stores-orders-settlements","requestBody":{"$ref":"#/components/requestBodies/OrderSettlementCreateRequest"},"responses":{"200":{"$ref":"#/components/responses/SettlementResponse"}},"summary":"Create a new order settlement","tags":["OrderSettlement"]}}}}
```

## Get order settlement details

> Get details for a specific settlement on an order.

```json
{"openapi":"3.0.2","info":{"title":"Flow Retail API version 2","version":"2.0.0"},"tags":[{"name":"OrderSettlement","description":"OrderSettlement"}],"servers":[{"description":"Flow Retail Production","url":"https://api.flowretail.com/v2"},{"description":"Flow Retail Stage","url":"https://api.stage.flowretail.com/v2"}],"security":[{"accessToken":[]},{"authToken":[]},{"integrationToken":[]}],"components":{"securitySchemes":{"accessToken":{"description":"Accesstoken recevied after user login with a deviceToken","scheme":"bearer","type":"http"},"authToken":{"description":"Token received from the auth service","scheme":"bearer","type":"http"},"integrationToken":{"scheme":"bearer","type":"http"}},"parameters":{"checkStatusQuery":{"description":"Check external payment gateways and fetch status","in":"query","name":"checkStatus","schema":{"type":"boolean"}},"includeDisplayMessagesQuery":{"description":"Include display messages in the response","in":"query","name":"includeDisplayMessages","schema":{"type":"boolean"}}},"responses":{"SettlementResponse":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/SettlementResponseSchema"}}},"description":"Example response"}},"schemas":{"SettlementResponseSchema":{"title":"SettlementResponseSchema","type":"object","required":["amount","createdAt","displayMessages","externalId","externalPaymentReference","idMethod","lastModifiedAt","parameters","settlementCode","settlementUid","settlementName","state","status","storeSettlementIssuerUid","tenantUserDisplayName","tenantUserUid","storePaymentMethodUid","currency","additionalDetails","paymentCount","paymentAmount","receiptUid","orderReceiptUid"],"properties":{"amount":{"type":"integer"},"createdAt":{"format":"date-time","type":"string"},"displayMessages":{"type":"array","items":{"$ref":"#/components/schemas/SettlementDisplayMessageSchema"}},"externalId":{"type":"string"},"externalPaymentReference":{"type":"string","description":"The external payment reference for this settlement.\nFor invoices, this could contain the KID"},"idMethod":{"$ref":"#/components/schemas/SettlementIdMethodENUM"},"lastModifiedAt":{"format":"date-time","type":"string"},"ledgerNumber":{"description":"Ledger number must be a valid number with possible leading zeros","type":"string"},"ledgerType":{"$ref":"#/components/schemas/LedgerTypeENUM"},"parameters":{"type":"array","items":{"$ref":"#/components/schemas/SettlementParameterSchema"}},"settledAt":{"format":"date-time","type":"string"},"settlementCode":{"type":"string"},"settlementUid":{"$ref":"#/components/schemas/UID"},"settlementName":{"type":"string"},"state":{"$ref":"#/components/schemas/SettlementStateENUM"},"status":{"$ref":"#/components/schemas/SettlementStatusENUM"},"storeSettlementIssuerUid":{"$ref":"#/components/schemas/UID"},"tenantUserDisplayName":{"type":"string"},"tenantUserUid":{"$ref":"#/components/schemas/UID"},"storePaymentMethodUid":{"$ref":"#/components/schemas/UID"},"currency":{"$ref":"#/components/schemas/SettlementCurrencySchema"},"additionalDetails":{"type":"array","items":{"$ref":"#/components/schemas/SettlementAdditionalDetailsSchema"}},"paymentCount":{"type":"integer"},"paymentAmount":{"type":"integer"},"paymentAomunt":{"type":"integer","deprecated":true},"orderReceiptUid":{"$ref":"#/components/schemas/OptionalUID"}}},"SettlementDisplayMessageSchema":{"description":"Settlement display messages","properties":{"key":{"type":"string"},"message":{"type":"string"},"timestamp":{"format":"date-time","type":"string"}},"required":["key","message","timestamp"],"title":"SettlementDisplayMessageSchema","type":"object"},"SettlementIdMethodENUM":{"enum":["NO_CVM_RULE_PERFORMED","SIGNATURE","PIN_ONLINE","PIN_OFFLINE","PIN_ONLINE_AND_SIGNATURE","PIN_OFFLINE_AND_SIGNATURE","NO_CVM","FAILED","ON_DEVICE","REFUND"],"title":"SettlementIdMethodENUM","type":"string"},"LedgerTypeENUM":{"description":"|ENUM      | Description |\n| ---------------- | ------------ |\n|LEDGER | Ledger |\n|GENERAL_LEDGER | General ledger |\n|CUSTOMER_LEDGER | Customer ledger |","enum":["LEDGER","GENERAL_LEDGER","CUSTOMER_LEDGER"],"title":"LedgerTypeENUM","type":"string"},"SettlementParameterSchema":{"description":"Create a new settlement","title":"SettlementParameterSchema","type":"object","required":["key","value"],"properties":{"key":{"type":"string"},"value":{"type":"string"}}},"UID":{"title":"UID","type":"string","pattern":"^[A-Za-z0-9-_]+"},"SettlementStateENUM":{"enum":["NOT_STARTED","IN_PROGRESS","COMPLETE","TERMINATED"],"title":"SettlementCodeENUM","type":"string"},"SettlementStatusENUM":{"enum":["NEW","PROCESSING","AUTHORIZED","CAPTURED","REFUNDED","PARTIALLY_REFUNDED","PENDING_REFUND","FAILED","CANCELLED_BY_MERCHANT","CANCELLED_BY_USER","CANCELLED_FORCE","DELETED","DENIED","REJECTED"],"title":"SettlementCodeENUM","type":"string"},"SettlementCurrencySchema":{"title":"SettlementCurrencySchema","type":"object","required":["amount","code","exchangeRate"],"properties":{"amount":{"type":"integer"},"code":{"type":"string"},"exchangeRate":{"type":"integer"}}},"SettlementAdditionalDetailsSchema":{"title":"SettlementAdditionalDetailsSchema","type":"object","required":["key","value"],"properties":{"key":{"type":"string"},"value":{"type":"string"}}},"OptionalUID":{"title":"OptionalUID","type":"string","pattern":"^[A-Za-z0-9-_]*"}}},"paths":{"/tenants/{tenantUid}/stores/{storeUid}/orders/{orderUid}/settlements/{settlementUid}":{"get":{"description":"Get details for a specific settlement on an order.","operationId":"get-tennants-stores-orders-settlements-details","parameters":[{"$ref":"#/components/parameters/checkStatusQuery"},{"$ref":"#/components/parameters/includeDisplayMessagesQuery"}],"responses":{"200":{"$ref":"#/components/responses/SettlementResponse"}},"summary":"Get order settlement details","tags":["OrderSettlement"]}}}}
```

## Delete an order settlement

> Delete a settlement on an order.

```json
{"openapi":"3.0.2","info":{"title":"Flow Retail API version 2","version":"2.0.0"},"tags":[{"name":"OrderSettlement","description":"OrderSettlement"}],"servers":[{"description":"Flow Retail Production","url":"https://api.flowretail.com/v2"},{"description":"Flow Retail Stage","url":"https://api.stage.flowretail.com/v2"}],"security":[{"accessToken":[]},{"authToken":[]},{"integrationToken":[]}],"components":{"securitySchemes":{"accessToken":{"description":"Accesstoken recevied after user login with a deviceToken","scheme":"bearer","type":"http"},"authToken":{"description":"Token received from the auth service","scheme":"bearer","type":"http"},"integrationToken":{"scheme":"bearer","type":"http"}},"parameters":{"forceDeleteQuery":{"description":"Force Delete on a settlement","in":"query","name":"forceDelete","schema":{"type":"boolean"}}}},"paths":{"/tenants/{tenantUid}/stores/{storeUid}/orders/{orderUid}/settlements/{settlementUid}":{"delete":{"description":"Delete a settlement on an order.","operationId":"delete-tennants-stores-orders-settlements-details","parameters":[{"$ref":"#/components/parameters/forceDeleteQuery"}],"responses":{"204":{"description":"No Content"},"403":{"description":"Forbidden"}},"summary":"Delete an order settlement","tags":["OrderSettlement"]}}}}
```

## List payments for settlement

> A payment belongs to an order settlement with payment method \`INVOICE\`.\
> Normally invoices are paid via bank and the payments imported or also registered by hand.\
> But if a customer pays the invoice by another method in the store (e.g. cash or card), \
> it is made as a settlement on a new order without any lines, and then shown as \`paymentSettlement\`.

```json
{"openapi":"3.0.2","info":{"title":"Flow Retail API version 2","version":"2.0.0"},"tags":[{"name":"OrderSettlement","description":"OrderSettlement"}],"servers":[{"description":"Flow Retail Production","url":"https://api.flowretail.com/v2"},{"description":"Flow Retail Stage","url":"https://api.stage.flowretail.com/v2"}],"security":[{"accessToken":[]},{"authToken":[]},{"integrationToken":[]}],"components":{"securitySchemes":{"accessToken":{"description":"Accesstoken recevied after user login with a deviceToken","scheme":"bearer","type":"http"},"authToken":{"description":"Token received from the auth service","scheme":"bearer","type":"http"},"integrationToken":{"scheme":"bearer","type":"http"}},"responses":{"PaymentListResponse":{"description":"Example response","content":{"application/json":{"schema":{"type":"object","required":["items"],"properties":{"items":{"type":"array","items":{"$ref":"#/components/schemas/PaymentResponseSchema"}}}}}}}},"schemas":{"PaymentResponseSchema":{"title":"PaymentResponseSchema","type":"object","required":["paymentUid","amount","paidAt","externalReference","paymentSettlementUid","createdAt","createdBy"],"properties":{"paymentUid":{"$ref":"#/components/schemas/UID"},"amount":{"type":"integer"},"paidAt":{"type":"string","format":"date-time"},"externalReference":{"type":"string"},"paymentSettlementUid":{"$ref":"#/components/schemas/OptionalUID"},"createdAt":{"type":"string","format":"date-time"},"createdBy":{"type":"string"}}},"UID":{"title":"UID","type":"string","pattern":"^[A-Za-z0-9-_]+"},"OptionalUID":{"title":"OptionalUID","type":"string","pattern":"^[A-Za-z0-9-_]*"}}},"paths":{"/tenants/{tenantUid}/stores/{storeUid}/orders/{orderUid}/settlements/{settlementUid}/payments":{"get":{"summary":"List payments for settlement","tags":["OrderSettlement"],"responses":{"200":{"$ref":"#/components/responses/PaymentListResponse"}},"operationId":"list-settlements-payments","description":"A payment belongs to an order settlement with payment method `INVOICE`.\nNormally invoices are paid via bank and the payments imported or also registered by hand.\nBut if a customer pays the invoice by another method in the store (e.g. cash or card), \nit is made as a settlement on a new order without any lines, and then shown as `paymentSettlement`."}}}}
```

## Add payment for settlement

> Add a payment for a settlement.  \
> \`amount\` is in cents.  \
> If \`paidAt\` is nil, it is set to \`now\`.

```json
{"openapi":"3.0.2","info":{"title":"Flow Retail API version 2","version":"2.0.0"},"tags":[{"name":"OrderSettlement","description":"OrderSettlement"}],"servers":[{"description":"Flow Retail Production","url":"https://api.flowretail.com/v2"},{"description":"Flow Retail Stage","url":"https://api.stage.flowretail.com/v2"}],"security":[{"accessToken":[]},{"authToken":[]},{"integrationToken":[]}],"components":{"securitySchemes":{"accessToken":{"description":"Accesstoken recevied after user login with a deviceToken","scheme":"bearer","type":"http"},"authToken":{"description":"Token received from the auth service","scheme":"bearer","type":"http"},"integrationToken":{"scheme":"bearer","type":"http"}},"responses":{"PaymentResponse":{"description":"Example response","content":{"application/json":{"schema":{"$ref":"#/components/schemas/PaymentResponseSchema"}}}}},"schemas":{"PaymentResponseSchema":{"title":"PaymentResponseSchema","type":"object","required":["paymentUid","amount","paidAt","externalReference","paymentSettlementUid","createdAt","createdBy"],"properties":{"paymentUid":{"$ref":"#/components/schemas/UID"},"amount":{"type":"integer"},"paidAt":{"type":"string","format":"date-time"},"externalReference":{"type":"string"},"paymentSettlementUid":{"$ref":"#/components/schemas/OptionalUID"},"createdAt":{"type":"string","format":"date-time"},"createdBy":{"type":"string"}}},"UID":{"title":"UID","type":"string","pattern":"^[A-Za-z0-9-_]+"},"OptionalUID":{"title":"OptionalUID","type":"string","pattern":"^[A-Za-z0-9-_]*"}},"requestBodies":{"PaymentCreateRequest":{"content":{"application/json":{"schema":{"type":"object","required":["amount"],"properties":{"amount":{"type":"integer"},"paidAt":{"type":"string","format":"date-time"},"externalReference":{"type":"string"},"paymentUid":{"$ref":"#/components/schemas/OptionalUID"}}}}}}}},"paths":{"/tenants/{tenantUid}/stores/{storeUid}/orders/{orderUid}/settlements/{settlementUid}/payments":{"post":{"summary":"Add payment for settlement","tags":["OrderSettlement"],"responses":{"201":{"$ref":"#/components/responses/PaymentResponse"}},"operationId":"post-settlements-payments","description":"Add a payment for a settlement.  \n`amount` is in cents.  \nIf `paidAt` is nil, it is set to `now`.","requestBody":{"$ref":"#/components/requestBodies/PaymentCreateRequest"}}}}}
```

## Create new payment-settlement

> A payment belongs to an order settlement with payment method \`INVOICE\`.\
> Normally invoices are paid via bank and the payments imported or also registered by hand.\
> But if a customer pays the invoice by another method in store (e.g. cash or card) \
> it is made as a settlement on a new order without any lines, and this is what we do here, \
> meaning the path parameters must refer to the order and settlement for which this is a payment.

```json
{"openapi":"3.0.2","info":{"title":"Flow Retail API version 2","version":"2.0.0"},"tags":[{"name":"OrderSettlement","description":"OrderSettlement"}],"servers":[{"description":"Flow Retail Production","url":"https://api.flowretail.com/v2"},{"description":"Flow Retail Stage","url":"https://api.stage.flowretail.com/v2"}],"security":[{"accessToken":[]},{"authToken":[]},{"integrationToken":[]}],"components":{"securitySchemes":{"accessToken":{"description":"Accesstoken recevied after user login with a deviceToken","scheme":"bearer","type":"http"},"authToken":{"description":"Token received from the auth service","scheme":"bearer","type":"http"},"integrationToken":{"scheme":"bearer","type":"http"}},"responses":{"OrderResponse":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/OrderResponseSchema"}}},"description":"Example response"}},"schemas":{"OrderResponseSchema":{"description":"Use invoiceAddress only if an order has a different invoice  than orderAddress.","title":"OrderResponseSchema","type":"object","required":["createdAt","customerAddress","customerUid","customerContact","deliveryState","externalOrderNumber","externalVoucherNumber","invoiceAddress","items","lastModifiedAt","note","orderUid","orderNumber","orderState","orderTotals","orderhandlingState","orderhandlings","settleState","settlementTotals","settlements","storeUid","storeName","systemOrigin","tenantUserDisplayName","tenantUserUid","tillUid","type","vatFree","vatPrint","voucherNumber","deliveryDate","discounts","compensationReasonUid","lastModifiedBy"],"properties":{"customerContactUid":{"$ref":"#/components/schemas/DeprecatedOptionalUID"},"shippingAddress":{"$ref":"#/components/schemas/DeprecatedOrderAddressResponseSchema"},"createdAt":{"format":"date-time","type":"string"},"customerAddress":{"$ref":"#/components/schemas/OrderAddressResponseSchema"},"customerUid":{"$ref":"#/components/schemas/OptionalUID"},"customerContact":{"$ref":"#/components/schemas/OrderCustomerContactResponseSchema"},"deliveryState":{"$ref":"#/components/schemas/OrderDeliveryStateENUM"},"externalOrderNumber":{"type":"string"},"externalVoucherNumber":{"type":"string"},"invoiceAddress":{"$ref":"#/components/schemas/InvoiceAddressResponseSchema"},"items":{"type":"array","items":{"$ref":"#/components/schemas/OrderItemResponseSchema"}},"lastModifiedAt":{"format":"date-time","type":"string"},"note":{"description":"Note visible on the receipt.","type":"string"},"orderUid":{"$ref":"#/components/schemas/UID"},"orderNumber":{"type":"string"},"orderState":{"$ref":"#/components/schemas/OrderOrderStateENUM"},"orderTotals":{"$ref":"#/components/schemas/OrderTotalsResponseSchema"},"orderhandlingState":{"$ref":"#/components/schemas/HandlingStateENUM"},"orderhandlings":{"type":"array","items":{"$ref":"#/components/schemas/OrderHandlingResponseSchema"}},"settleState":{"$ref":"#/components/schemas/OrderSettleStateENUM"},"settledAt":{"description":"When the settleState is set COMPLETE.","format":"date-time","type":"string","nullable":true},"settlementTotals":{"$ref":"#/components/schemas/OrderSettlementTotalsSchema"},"settlements":{"type":"array","items":{"$ref":"#/components/schemas/SettlementResponseSchema"}},"storeUid":{"$ref":"#/components/schemas/UID"},"storeName":{"type":"string"},"systemOrigin":{"type":"string"},"tenantUserDisplayName":{"type":"string"},"tenantUserUid":{"$ref":"#/components/schemas/UID"},"tillUid":{"$ref":"#/components/schemas/OptionalUID"},"type":{"$ref":"#/components/schemas/OrderTypeENUM"},"validUntil":{"format":"date-time","type":"string","nullable":true},"vatFree":{"type":"boolean"},"vatPrint":{"$ref":"#/components/schemas/VatPrintENUM"},"voucherNumber":{"description":"A reference to a fully settled order.","type":"string"},"deliveryDate":{"type":"string","format":"date"},"discounts":{"type":"array","items":{"$ref":"#/components/schemas/OrderDiscountResponseSchema"}},"compensationReasonUid":{"$ref":"#/components/schemas/OptionalUID"},"lastModifiedBy":{"type":"string"}}},"DeprecatedOptionalUID":{"title":"DeprecatedOptionalUID","type":"string","pattern":"^[A-Za-z0-9-_]*","deprecated":true},"DeprecatedOrderAddressResponseSchema":{"description":"This field will be removed. Use the information on the delivery instead.","allOf":[{"type":"object","deprecated":true},{"$ref":"#/components/schemas/OrderAddressResponseSchema"}]},"OrderAddressResponseSchema":{"title":"OrderAddressResponseSchema","type":"object","required":["address","city","companyName","countryCode","email","firstname","lastname","mobile","postalCode","displayName"],"properties":{"address":{"type":"string"},"city":{"type":"string"},"companyName":{"type":"string"},"countryCode":{"type":"string"},"email":{"$ref":"#/components/schemas/EmailTYPE"},"firstname":{"type":"string"},"lastname":{"type":"string"},"mobile":{"type":"string"},"postalCode":{"type":"string"},"vatNumber":{"$ref":"#/components/schemas/VatNumberTYPE"},"displayName":{"type":"string"}},"description":""},"EmailTYPE":{"title":"Email","type":"string"},"VatNumberTYPE":{"description":"VAT identification number for value added tax reporting purposes.","title":"VatNumber","type":"string"},"OptionalUID":{"title":"OptionalUID","type":"string","pattern":"^[A-Za-z0-9-_]*"},"OrderCustomerContactResponseSchema":{"type":"object","title":"OrderCustomerContactResponseSchema","required":["customerContactUid","firstname","lastname","email","mobile","displayName"],"properties":{"customerContactUid":{"type":"string"},"firstname":{"type":"string"},"lastname":{"type":"string"},"email":{"$ref":"#/components/schemas/EmailTYPE"},"mobile":{"type":"string"},"displayName":{"type":"string"}}},"OrderDeliveryStateENUM":{"description":"|ENUM      | Description |\n| ---------------- | ------------ |\n| NOT_STARTED | Delivery not started|\n| IN_PROGRESS | Delivery is in progress. Some order lines are still reserved|\n| COMPLETE | Delivery is complete. All order lines are delivered|","enum":["NOT_STARTED","IN_PROGRESS","COMPLETE"],"title":"OrderDeliveryStateENUM","type":"string"},"InvoiceAddressResponseSchema":{"title":"InvoiceAddressResponseSchema","allOf":[{"$ref":"#/components/schemas/BaseAddressSchema"},{"required":["displayName","customerAddressUid","address","city","companyName","countryCode","email","mobile","firstname","lastname","postalCode"],"properties":{"displayName":{"type":"string"},"customerAddressUid":{"$ref":"#/components/schemas/OptionalUID"}}}],"type":"object"},"BaseAddressSchema":{"title":"BaseAddressSchema","type":"object","properties":{"address":{"type":"string"},"city":{"type":"string"},"companyName":{"type":"string"},"countryCode":{"type":"string"},"email":{"$ref":"#/components/schemas/EmailTYPE"},"mobile":{"type":"string"},"firstname":{"type":"string"},"lastname":{"type":"string"},"postalCode":{"type":"string"}}},"OrderItemResponseSchema":{"title":"OrderItemResponseSchema","type":"object","required":["actions","allowedActions","createdAt","discountReasonCode","externalId","itemCost","itemDiscountAmount","itemDiscountPercentage","itemGrossProfitAmount","itemGrossProfitPercentage","itemPrice","itemVatAmount","lastModifiedAt","ledgerNumber","name","note","orderItemUid","originalItemPrice","productUid","productType","properties","quantityCredited","quantityDelivered","quantityOrdered","quantityReserved","returnReasonCode","serialnumber","sku","sortOrder","tenantUserDisplayName","tenantUserUid","totalCost","totalDiscountAmount","totalGrossProfitAmount","totalPrice","totalVatAmount","vatCodeUid","warehouseUid","warehouseName","internalInfo","productProperties","coverImage","deliveryUid","compensationReasonCode","orderReceiptUid","allowDeliveryFromDate","reservationType","reservationDetails"],"properties":{"actions":{"type":"array","items":{"$ref":"#/components/schemas/OrderItemActionResponseSchema"}},"allowedActions":{"description":"Indicate what fields are allowed to change or what action is allowed on an orderline","type":"array","items":{"$ref":"#/components/schemas/AllowedActionENUM"}},"createdAt":{"format":"date-time","type":"string"},"discountReasonCode":{"type":"string"},"externalId":{"type":"string"},"itemCost":{"description":"Item cost for a single product.","type":"integer"},"itemDiscountAmount":{"description":"Discount amount for a single product.","type":"integer"},"itemDiscountPercentage":{"type":"integer"},"itemGrossProfitAmount":{"description":"Profit amount for a single product.","type":"integer"},"itemGrossProfitPercentage":{"description":"Profit for a single product in percentage.","type":"integer"},"itemPrice":{"type":"integer"},"itemVatAmount":{"description":"Vat amount for a single product.","type":"integer"},"lastModifiedAt":{"format":"date-time","type":"string"},"ledgerNumber":{"description":"Ledger number must be a valid number with possible leading zeros","type":"string"},"name":{"type":"string"},"note":{"type":"string"},"orderItemUid":{"$ref":"#/components/schemas/UID"},"orderLinks":{"description":"List of references on the order product item.\nTypically a list of credit operations.","type":"array","items":{"$ref":"#/components/schemas/OrderLinkTypeSchema"}},"originalItemPrice":{"type":"integer"},"productUid":{"$ref":"#/components/schemas/UID"},"productType":{"$ref":"#/components/schemas/ProductTypeENUM"},"properties":{"type":"array","items":{"$ref":"#/components/schemas/OrderProductLinePropertyResponseSchema"}},"quantityCredited":{"type":"integer"},"quantityDelivered":{"type":"integer"},"quantityOrdered":{"type":"integer"},"quantityReserved":{"type":"integer"},"returnReasonCode":{"type":"string"},"serialnumber":{"type":"string"},"sku":{"type":"string"},"sortOrder":{"type":"integer"},"tenantUserDisplayName":{"type":"string"},"tenantUserUid":{"$ref":"#/components/schemas/UID"},"totalCost":{"description":"Total cost for all products on this OrderItem.","type":"integer"},"totalDiscountAmount":{"description":"Discount amount for all products on this OrderItem.","type":"integer"},"totalGrossProfitAmount":{"description":"Profit amount for all products on this OrderItem.","type":"integer"},"totalPrice":{"description":"Total price for all products on this OrderItem.","type":"integer"},"totalVatAmount":{"description":"Vat amount for all products on this OrderItem.","type":"integer"},"vatCodeUid":{"$ref":"#/components/schemas/UID"},"warehouseUid":{"$ref":"#/components/schemas/OptionalUID"},"warehouseName":{"type":"string"},"internalInfo":{"type":"string"},"productProperties":{"type":"array","items":{"$ref":"#/components/schemas/ProductPropertyResponseSchema"}},"coverImage":{"$ref":"#/components/schemas/CoverImageSchema"},"deliveryUid":{"$ref":"#/components/schemas/OptionalUID"},"compensationReasonCode":{"type":"string"},"orderReceiptUid":{"$ref":"#/components/schemas/OptionalUID"},"allowDeliveryFromDate":{"type":"string","format":"date-time","nullable":true},"reservationType":{"$ref":"#/components/schemas/SalesReservationTypeENUM"},"reservationDetails":{"$ref":"#/components/schemas/SalesReservationDetailsSchema"}}},"OrderItemActionResponseSchema":{"properties":{"comment":{"type":"string"},"createdAt":{"format":"date-time","type":"string"},"createdBy":{"type":"string"},"handlingActionUid":{"$ref":"#/components/schemas/UID"},"handlingActionName":{"type":"string"},"handlingDescription":{"type":"string"},"handlingUid":{"$ref":"#/components/schemas/UID"},"handlingName":{"type":"string"},"lastModifiedAt":{"format":"date-time","type":"string"},"lastModifiedBy":{"type":"string"},"orderHandlingActionUid":{"$ref":"#/components/schemas/UID"}},"required":["orderHandlingActionUid","handlingUid","handlingName","handlingActionUid","handlingActionName","comment","handlingDescription","createdAt","createdBy","lastModifiedAt","lastModifiedBy"],"title":"OrderItemActionResponseSchema","type":"object"},"UID":{"title":"UID","type":"string","pattern":"^[A-Za-z0-9-_]+"},"AllowedActionENUM":{"description":"|ENUM      | Description |\n| ---------------- | ------------ |\n| QUANTITY_SOLD | Can change quantity on order item|\n| PRICE_SALE | Can change price on order item|\n| DISCOUNT | Can set discount on order item|\n| SERIALNUMBER | Can set serial number on order item|\n| SERIALNUMBER_REQUIRED | MUST set serial number on order item|\n| CREDIT | Order item can be credited|\n| ADDON | Product on order item has addons|\n| CUSTOMER_REQUIRED | Order item requires customer on settlement|\n| CUSTOMER_MOBILE_REQUIRED | Order item requires customer mobile number on settlement|\n| CUSTOMER_EMAIL_REQUIRED  - Order item requires customer email on settlement|\n| DELIVERY_POSTAL_ADDRESS_REQUIRED | Order item requires delivery address on settlement|\n| INSURANCE | Order item can be insured|\n| DELETE | Order item can be deleted|   \n| DELIVER | Order item can be delivered|\n| PURCHASE | Order item can be marked as purchase from supplier |","enum":["QUANTITY_SOLD","PRICE_SALE","DISCOUNT","SERIALNUMBER","SERIALNUMBER_REQUIRED","CREDIT","ADDON","CUSTOMER_REQUIRED","INSURANCE","CUSTOMER_MOBILE_REQUIRED","CUSTOMER_EMAIL_REQUIRED","DELIVERY_POSTAL_ADDRESS_REQUIRED","DELETE","DELIVER","PURCHASE"],"title":"AllowedActionENUM","type":"string"},"OrderLinkTypeSchema":{"description":"Order reference for an order product item","properties":{"orderUid":{"$ref":"#/components/schemas/UID"},"orderItemUid":{"$ref":"#/components/schemas/UID"},"orderNumber":{"description":"Order number for the order","type":"string"},"storeUid":{"$ref":"#/components/schemas/UID"},"type":{"$ref":"#/components/schemas/OrderLinkTypeResponseENUM"}},"required":["storeUid","orderUid","orderNumber","orderItemUid","type"],"title":"OrderLinkTypeSchema","type":"object"},"OrderLinkTypeResponseENUM":{"description":"Describes the type of link on an order product item\n\n|ENUM | Description |\n| --- | --- |\n| CREDIT | Reference is a credit link|\n| INSURANCE | Reference to orderline with product to insure|\n| INSURED | Reference to orderline with insurance |\n| COMPENSATION | Reference to orderline with product to compensate|\n| COMPENSATED | Reference to orderline with compensation |\n| PACKAGE | Reference to orderline with main package product |\n| PACKAGE_COMPONENT | Reference to orderline with package component product |\n","enum":["CREDIT","INSURANCE","INSURED","COMPENSATION","COMPENSATED","PACKAGE","PACKAGE_COMPONENT"],"title":"OrderLinkTypeResponseENUM","type":"string"},"ProductTypeENUM":{"description":"|ENUM      | Description |\n| ---------------- | ------------ |\n| STOCK | Price*quantity|\n| NO_STOCK | No quantity|\n| CONFIGURABLE | Master configurable product|\n| FLOWGIFTCARD | Flow Giftcard product|\n| NON_PHYSICAL | Non physical product|\n| PACKAGE_FIXED | Packaged product with fixed content|\n| PACKAGE_DYNAMIC | Packaged product with dynamic content|","enum":["STOCK","NO_STOCK","CONFIGURABLE","FLOWGIFTCARD","NON_PHYSICAL","PACKAGE_FIXED","PACKAGE_DYNAMIC"],"minLength":1,"title":"ProductTypeENUM","type":"string"},"OrderProductLinePropertyResponseSchema":{"allOf":[{"properties":{"uid":{"$ref":"#/components/schemas/UID"}},"required":["uid"],"type":"object"},{"$ref":"#/components/schemas/OrderProductLinePropertySchema"}],"title":"OrderProductLinePropertyResponseSchema"},"OrderProductLinePropertySchema":{"properties":{"key":{"type":"string"},"value":{"type":"string"}},"required":["key","value"],"title":"OrderProductLinePropertySchema","type":"object"},"ProductPropertyResponseSchema":{"title":"ProductPropertyResponseSchema","type":"object","required":["productPropertyUid","propertyName","propertyOptionName","propertyType","propertyUid","propertyOptionUid","required"],"properties":{"productPropertyUid":{"$ref":"#/components/schemas/UID"},"propertyName":{"type":"string"},"propertyOptionName":{"type":"string"},"propertyType":{"$ref":"#/components/schemas/PropertyTypeENUM"},"propertyText":{"type":"string","description":"Only in use with TEXT properties."},"propertyUid":{"$ref":"#/components/schemas/UID"},"propertyOptionUid":{"$ref":"#/components/schemas/UID"},"required":{"type":"boolean"}}},"PropertyTypeENUM":{"description":"Describes the type of property a product can have.\n\n|ENUM      | Description |\n| ---------------- | ------------ |\n| TEXT | A single text line such as an URL to a product manual or a reminder to the cashier/salesperson.|\n| SINGLESELECT | A list of values where a product can only have one at any given time.|\n| MULTISELECT | A list of values where a product can have none or several at any given time.|","enum":["TEXT","SINGLESELECT","MULTISELECT"],"title":"PropertyTypeENUM","type":"string"},"CoverImageSchema":{"title":"CoverImageSchema","type":"object","properties":{"productMediaUid":{"$ref":"#/components/schemas/UID"},"mainUrl":{"type":"string"},"thumbnailUrl":{"type":"string"}},"required":["productMediaUid","mainUrl","thumbnailUrl"]},"SalesReservationTypeENUM":{"title":"SalesReservationTypeENUM","type":"string","enum":["NONE","WAREHOUSE","PURCHASEORDER","REQUEST_PURCHASEORDER"],"description":""},"SalesReservationDetailsSchema":{"title":"SalesReservationDetailsSchema","type":"object","properties":{"warehouse":{"$ref":"#/components/schemas/SalesReservationWarehouseSchema"},"purchaseOrder":{"$ref":"#/components/schemas/SalesReservationPurchaseOrderSchema"}}},"SalesReservationWarehouseSchema":{"title":"SalesReservationWarehouseSchema","type":"object","nullable":true,"required":["warehouseName"],"properties":{"warehouseName":{"type":"string"}}},"SalesReservationPurchaseOrderSchema":{"title":"SalesReservationPurchaseOrderSchema","type":"object","nullable":true,"required":["purchaseOrderUid","purchaseOrderItemUid","purchaseOrderNumber","quantityOrdered"],"properties":{"purchaseOrderUid":{"$ref":"#/components/schemas/UID"},"purchaseOrderItemUid":{"$ref":"#/components/schemas/UID"},"expectedDeliveryDate":{"type":"string","format":"date-time"},"purchaseOrderNumber":{"type":"string"},"quantityOrdered":{"type":"integer","description":"The quantity ordered on this purchase order line."}}},"OrderOrderStateENUM":{"description":"|ENUM | Description |\n| --- | --- |\n| OPEN | Order is open and beeing edited by someone|\n| PARKED | Order is parked|\n| CANCELED | Order is canceled/deleted|\n| COMPLETE | Order is complete|\n","enum":["OPEN","PARKED","CANCELED","COMPLETE"],"title":"OrderOrderStateENUM","type":"string"},"OrderTotalsResponseSchema":{"description":"","properties":{"costTotal":{"type":"integer"},"grandTotal":{"type":"integer"},"grossProfitAmount":{"description":"Sum of all totalGrossProfitAmount on each product item.","type":"integer"},"grossProfitPercentage":{"description":"","type":"integer"},"specifiedVat":{"items":{"$ref":"#/components/schemas/OrderTotalsVatSpecificationSchema"},"type":"array"},"subtotal":{"type":"integer"},"totalDiscount":{"type":"integer"},"totalVat":{"type":"integer"}},"required":["subtotal","totalDiscount","specifiedVat","totalVat","grandTotal","grossProfitAmount","grossProfitPercentage","costTotal"],"title":"OrderTotals","type":"object"},"OrderTotalsVatSpecificationSchema":{"description":"","properties":{"vatAmount":{"description":"Total amount with this vatRate.","type":"integer"},"vatDescription":{"description":"Description of vat rate.","type":"string"},"vatRate":{"description":"VatRate in percentage.","type":"integer"}},"required":["vatRate","vatAmount","vatDescription"],"title":"OrderTotalsVatSpecificationSchema","type":"object"},"HandlingStateENUM":{"enum":["NOT_STARTED","IN_PROGRESS","COMPLETE"],"title":"HandlingStateENUM","type":"string"},"OrderHandlingResponseSchema":{"properties":{"active":{"type":"boolean"},"createdAt":{"format":"date-time","type":"string"},"createdBy":{"type":"string"},"description":{"type":"string"},"handlingUid":{"$ref":"#/components/schemas/UID"},"lastModifiedAt":{"format":"date-time","type":"string"},"lastModifiedBy":{"type":"string"},"name":{"maxLength":20,"type":"string"},"orderHandlingUid":{"$ref":"#/components/schemas/UID"},"state":{"$ref":"#/components/schemas/HandlingStateENUM"}},"required":["orderHandlingUid","handlingUid","active","description","name","state","createdAt","createdBy","lastModifiedAt","lastModifiedBy"],"title":"OrderHandlingResponseSchema","type":"object"},"OrderSettleStateENUM":{"description":"|ENUM      | Description |\n| ---------------- | ------------ |\n| NOT_STARTED | Settlement not started|\n| IN_PROGRESS | Settlement is in progress and the order cannot be changed|\n| COMPLETE | Settlement is complete|","enum":["NOT_STARTED","IN_PROGRESS","COMPLETE"],"title":"OrderSettleStateENUM","type":"string"},"OrderSettlementTotalsSchema":{"title":"OrderSettlementTotalsSchema","type":"object","required":["change","remaining","remainingRounded","totals","remainingPrePayment"],"properties":{"change":{"description":"Total change amount returned to customer.","type":"integer"},"remaining":{"type":"integer","description":"Remaining amount to be paid "},"remainingRounded":{"description":"Rounded value of remaining amount. For use with CASH","type":"integer"},"totals":{"type":"integer","description":"Sum of all approved settlements"},"remainingPrePayment":{"type":"integer"}}},"SettlementResponseSchema":{"title":"SettlementResponseSchema","type":"object","required":["amount","createdAt","displayMessages","externalId","externalPaymentReference","idMethod","lastModifiedAt","parameters","settlementCode","settlementUid","settlementName","state","status","storeSettlementIssuerUid","tenantUserDisplayName","tenantUserUid","storePaymentMethodUid","currency","additionalDetails","paymentCount","paymentAmount","receiptUid","orderReceiptUid"],"properties":{"amount":{"type":"integer"},"createdAt":{"format":"date-time","type":"string"},"displayMessages":{"type":"array","items":{"$ref":"#/components/schemas/SettlementDisplayMessageSchema"}},"externalId":{"type":"string"},"externalPaymentReference":{"type":"string","description":"The external payment reference for this settlement.\nFor invoices, this could contain the KID"},"idMethod":{"$ref":"#/components/schemas/SettlementIdMethodENUM"},"lastModifiedAt":{"format":"date-time","type":"string"},"ledgerNumber":{"description":"Ledger number must be a valid number with possible leading zeros","type":"string"},"ledgerType":{"$ref":"#/components/schemas/LedgerTypeENUM"},"parameters":{"type":"array","items":{"$ref":"#/components/schemas/SettlementParameterSchema"}},"settledAt":{"format":"date-time","type":"string"},"settlementCode":{"type":"string"},"settlementUid":{"$ref":"#/components/schemas/UID"},"settlementName":{"type":"string"},"state":{"$ref":"#/components/schemas/SettlementStateENUM"},"status":{"$ref":"#/components/schemas/SettlementStatusENUM"},"storeSettlementIssuerUid":{"$ref":"#/components/schemas/UID"},"tenantUserDisplayName":{"type":"string"},"tenantUserUid":{"$ref":"#/components/schemas/UID"},"storePaymentMethodUid":{"$ref":"#/components/schemas/UID"},"currency":{"$ref":"#/components/schemas/SettlementCurrencySchema"},"additionalDetails":{"type":"array","items":{"$ref":"#/components/schemas/SettlementAdditionalDetailsSchema"}},"paymentCount":{"type":"integer"},"paymentAmount":{"type":"integer"},"paymentAomunt":{"type":"integer","deprecated":true},"orderReceiptUid":{"$ref":"#/components/schemas/OptionalUID"}}},"SettlementDisplayMessageSchema":{"description":"Settlement display messages","properties":{"key":{"type":"string"},"message":{"type":"string"},"timestamp":{"format":"date-time","type":"string"}},"required":["key","message","timestamp"],"title":"SettlementDisplayMessageSchema","type":"object"},"SettlementIdMethodENUM":{"enum":["NO_CVM_RULE_PERFORMED","SIGNATURE","PIN_ONLINE","PIN_OFFLINE","PIN_ONLINE_AND_SIGNATURE","PIN_OFFLINE_AND_SIGNATURE","NO_CVM","FAILED","ON_DEVICE","REFUND"],"title":"SettlementIdMethodENUM","type":"string"},"LedgerTypeENUM":{"description":"|ENUM      | Description |\n| ---------------- | ------------ |\n|LEDGER | Ledger |\n|GENERAL_LEDGER | General ledger |\n|CUSTOMER_LEDGER | Customer ledger |","enum":["LEDGER","GENERAL_LEDGER","CUSTOMER_LEDGER"],"title":"LedgerTypeENUM","type":"string"},"SettlementParameterSchema":{"description":"Create a new settlement","title":"SettlementParameterSchema","type":"object","required":["key","value"],"properties":{"key":{"type":"string"},"value":{"type":"string"}}},"SettlementStateENUM":{"enum":["NOT_STARTED","IN_PROGRESS","COMPLETE","TERMINATED"],"title":"SettlementCodeENUM","type":"string"},"SettlementStatusENUM":{"enum":["NEW","PROCESSING","AUTHORIZED","CAPTURED","REFUNDED","PARTIALLY_REFUNDED","PENDING_REFUND","FAILED","CANCELLED_BY_MERCHANT","CANCELLED_BY_USER","CANCELLED_FORCE","DELETED","DENIED","REJECTED"],"title":"SettlementCodeENUM","type":"string"},"SettlementCurrencySchema":{"title":"SettlementCurrencySchema","type":"object","required":["amount","code","exchangeRate"],"properties":{"amount":{"type":"integer"},"code":{"type":"string"},"exchangeRate":{"type":"integer"}}},"SettlementAdditionalDetailsSchema":{"title":"SettlementAdditionalDetailsSchema","type":"object","required":["key","value"],"properties":{"key":{"type":"string"},"value":{"type":"string"}}},"OrderTypeENUM":{"enum":["OFFER","ORDER","PAYMENT"],"title":"OrderTypeENUM","type":"string"},"VatPrintENUM":{"description":"|ENUM      | Description |\n| ---------------- | ------------ |\n|SUM| Print as a part of orderlines.|\n|SEPARATE| Print as a separate field.|\n","enum":["SUM","SEPARATE"],"title":"vatPrintENUM","type":"string"},"OrderDiscountResponseSchema":{"title":"OrderDiscountResponseSchema","type":"object","required":["orderDiscountUid","discountCode","type","amount","name","origin","validTo","maxUsage","productSkus","orderItemUids","externalTransactionId","scope","createdAt","createdBy","lastModifiedAt","lastModifiedBy","campaignUid"],"properties":{"orderDiscountUid":{"$ref":"#/components/schemas/UID"},"discountCode":{"type":"string"},"type":{"$ref":"#/components/schemas/DiscountTypeENUM"},"amount":{"type":"integer"},"name":{"type":"string"},"origin":{"$ref":"#/components/schemas/DiscountOriginENUM"},"validTo":{"type":"string","format":"date-time"},"maxUsage":{"type":"integer"},"productSkus":{"type":"array","items":{"type":"string"}},"orderItemUids":{"type":"array","items":{"$ref":"#/components/schemas/UID"}},"externalTransactionId":{"type":"string"},"scope":{"$ref":"#/components/schemas/DiscountScopeENUM"},"discountReasonCode":{"type":"string"},"createdAt":{"type":"string","format":"date-time"},"createdBy":{"type":"string"},"lastModifiedAt":{"type":"string","format":"date-time"},"lastModifiedBy":{"type":"string"},"campaignUid":{"$ref":"#/components/schemas/OptionalUID"}}},"DiscountTypeENUM":{"title":"DiscountTypeENUM","type":"string","enum":["PERCENTAGE","AMOUNT"]},"DiscountOriginENUM":{"title":"DiscountOriginENUM","type":"string","enum":["LOYALTY","MANUAL","CAMPAIGN"]},"DiscountScopeENUM":{"title":"DiscountScopeENUM","type":"string","enum":["WHOLE_ORDER","SPECIFIC_LINE","PRODUCT_LIST","SPECIFIC_LINE_LIST"]},"OrderSettlementCreateSchema":{"description":"Create a new settlement","title":"OrderSettlementCreateSchema","type":"object","required":["amount","storePaymentMethodUid"],"properties":{"amount":{"description":"in cents, e.g. 1,50 as 150","type":"integer"},"deviceIdentifier":{"type":"string"},"externalId":{"description":"External reference for the settlement","type":"string"},"parameters":{"description":"Refer to each payment type's options for available parameters, e.g. 'mobile' for VIPPS.","type":"array","items":{"$ref":"#/components/schemas/SettlementParameterSchema"}},"storePaymentMethodUid":{"$ref":"#/components/schemas/OptionalUID"},"settlementUid":{"$ref":"#/components/schemas/UID"}}}},"requestBodies":{"OrderSettlementCreateRequest":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/OrderSettlementCreateSchema"}}}}}},"paths":{"/tenants/{tenantUid}/stores/{storeUid}/orders/{orderUid}/settlements/{settlementUid}/payment-settlements":{"post":{"summary":"Create new payment-settlement","tags":["OrderSettlement"],"responses":{"201":{"$ref":"#/components/responses/OrderResponse"}},"operationId":"post-settlements-payment-settlements","description":"A payment belongs to an order settlement with payment method `INVOICE`.\nNormally invoices are paid via bank and the payments imported or also registered by hand.\nBut if a customer pays the invoice by another method in store (e.g. cash or card) \nit is made as a settlement on a new order without any lines, and this is what we do here, \nmeaning the path parameters must refer to the order and settlement for which this is a payment.","requestBody":{"$ref":"#/components/requestBodies/OrderSettlementCreateRequest"}}}}}
```

## Search in settlements

> Retrieves a filtered list of settlements for the organization.  \
> Results are sorted by \`createdAt\` in descending order when no sorting parameter is specified.  \
> The spreadsheet response is a report containing only key settlement fields\
> (pagination does not apply to spreadsheet responses).

```json
{"openapi":"3.0.2","info":{"title":"Flow Retail API version 2","version":"2.0.0"},"tags":[{"name":"OrderSettlement","description":"OrderSettlement"}],"servers":[{"description":"Flow Retail Production","url":"https://api.flowretail.com/v2"},{"description":"Flow Retail Stage","url":"https://api.stage.flowretail.com/v2"}],"security":[{"accessToken":[]},{"authToken":[]},{"integrationToken":[]}],"components":{"securitySchemes":{"accessToken":{"description":"Accesstoken recevied after user login with a deviceToken","scheme":"bearer","type":"http"},"authToken":{"description":"Token received from the auth service","scheme":"bearer","type":"http"},"integrationToken":{"scheme":"bearer","type":"http"}},"responses":{"SettlementListResponse":{"content":{"application/json":{"schema":{"properties":{"items":{"items":{"$ref":"#/components/schemas/SettlementResponseSchema"},"type":"array"},"paging":{"$ref":"#/components/schemas/Paging"}},"required":["items","paging"],"type":"object"}},"application/vnd.openxmlformats-officedocument.spreadsheetml.sheet":{"schema":{"type":"string","format":"binary"}}},"description":"Example response"}},"schemas":{"SettlementResponseSchema":{"title":"SettlementResponseSchema","type":"object","required":["amount","createdAt","displayMessages","externalId","externalPaymentReference","idMethod","lastModifiedAt","parameters","settlementCode","settlementUid","settlementName","state","status","storeSettlementIssuerUid","tenantUserDisplayName","tenantUserUid","storePaymentMethodUid","currency","additionalDetails","paymentCount","paymentAmount","receiptUid","orderReceiptUid"],"properties":{"amount":{"type":"integer"},"createdAt":{"format":"date-time","type":"string"},"displayMessages":{"type":"array","items":{"$ref":"#/components/schemas/SettlementDisplayMessageSchema"}},"externalId":{"type":"string"},"externalPaymentReference":{"type":"string","description":"The external payment reference for this settlement.\nFor invoices, this could contain the KID"},"idMethod":{"$ref":"#/components/schemas/SettlementIdMethodENUM"},"lastModifiedAt":{"format":"date-time","type":"string"},"ledgerNumber":{"description":"Ledger number must be a valid number with possible leading zeros","type":"string"},"ledgerType":{"$ref":"#/components/schemas/LedgerTypeENUM"},"parameters":{"type":"array","items":{"$ref":"#/components/schemas/SettlementParameterSchema"}},"settledAt":{"format":"date-time","type":"string"},"settlementCode":{"type":"string"},"settlementUid":{"$ref":"#/components/schemas/UID"},"settlementName":{"type":"string"},"state":{"$ref":"#/components/schemas/SettlementStateENUM"},"status":{"$ref":"#/components/schemas/SettlementStatusENUM"},"storeSettlementIssuerUid":{"$ref":"#/components/schemas/UID"},"tenantUserDisplayName":{"type":"string"},"tenantUserUid":{"$ref":"#/components/schemas/UID"},"storePaymentMethodUid":{"$ref":"#/components/schemas/UID"},"currency":{"$ref":"#/components/schemas/SettlementCurrencySchema"},"additionalDetails":{"type":"array","items":{"$ref":"#/components/schemas/SettlementAdditionalDetailsSchema"}},"paymentCount":{"type":"integer"},"paymentAmount":{"type":"integer"},"paymentAomunt":{"type":"integer","deprecated":true},"orderReceiptUid":{"$ref":"#/components/schemas/OptionalUID"}}},"SettlementDisplayMessageSchema":{"description":"Settlement display messages","properties":{"key":{"type":"string"},"message":{"type":"string"},"timestamp":{"format":"date-time","type":"string"}},"required":["key","message","timestamp"],"title":"SettlementDisplayMessageSchema","type":"object"},"SettlementIdMethodENUM":{"enum":["NO_CVM_RULE_PERFORMED","SIGNATURE","PIN_ONLINE","PIN_OFFLINE","PIN_ONLINE_AND_SIGNATURE","PIN_OFFLINE_AND_SIGNATURE","NO_CVM","FAILED","ON_DEVICE","REFUND"],"title":"SettlementIdMethodENUM","type":"string"},"LedgerTypeENUM":{"description":"|ENUM      | Description |\n| ---------------- | ------------ |\n|LEDGER | Ledger |\n|GENERAL_LEDGER | General ledger |\n|CUSTOMER_LEDGER | Customer ledger |","enum":["LEDGER","GENERAL_LEDGER","CUSTOMER_LEDGER"],"title":"LedgerTypeENUM","type":"string"},"SettlementParameterSchema":{"description":"Create a new settlement","title":"SettlementParameterSchema","type":"object","required":["key","value"],"properties":{"key":{"type":"string"},"value":{"type":"string"}}},"UID":{"title":"UID","type":"string","pattern":"^[A-Za-z0-9-_]+"},"SettlementStateENUM":{"enum":["NOT_STARTED","IN_PROGRESS","COMPLETE","TERMINATED"],"title":"SettlementCodeENUM","type":"string"},"SettlementStatusENUM":{"enum":["NEW","PROCESSING","AUTHORIZED","CAPTURED","REFUNDED","PARTIALLY_REFUNDED","PENDING_REFUND","FAILED","CANCELLED_BY_MERCHANT","CANCELLED_BY_USER","CANCELLED_FORCE","DELETED","DENIED","REJECTED"],"title":"SettlementCodeENUM","type":"string"},"SettlementCurrencySchema":{"title":"SettlementCurrencySchema","type":"object","required":["amount","code","exchangeRate"],"properties":{"amount":{"type":"integer"},"code":{"type":"string"},"exchangeRate":{"type":"integer"}}},"SettlementAdditionalDetailsSchema":{"title":"SettlementAdditionalDetailsSchema","type":"object","required":["key","value"],"properties":{"key":{"type":"string"},"value":{"type":"string"}}},"OptionalUID":{"title":"OptionalUID","type":"string","pattern":"^[A-Za-z0-9-_]*"},"Paging":{"description":"totalCount The total number of items in the result set.\n\npageSize The number of items per page.\n\npageNumber The current page in the result set.","properties":{"pageNumber":{"type":"integer"},"pageSize":{"type":"integer"},"totalCount":{"type":"integer"}},"required":["totalCount","pageSize","pageNumber"],"title":"Paging","type":"object"},"DateTimeRangeSchema":{"title":"DateTimeRangeSchema","type":"object","required":["from","to"],"properties":{"from":{"type":"string","format":"date-time"},"to":{"type":"string","format":"date-time"}}},"SortDirectionENUM":{"description":"|ENUM      | Description |\n| ---------------- | ------------ |\n| ASC | Sort in ascending order|\n| DESC | Sort in descending order|\n","enum":["ASC","DESC"],"title":"SortDirectionENUM","type":"string"}},"requestBodies":{"SettlementSearchRequest":{"content":{"application/json":{"schema":{"type":"object","properties":{"storeUids":{"type":"array","items":{"$ref":"#/components/schemas/UID"}},"storePaymentMethodUids":{"type":"array","items":{"$ref":"#/components/schemas/UID"}},"settlementCode":{"type":"string"},"createdAt":{"$ref":"#/components/schemas/DateTimeRangeSchema"},"states":{"type":"array","items":{"$ref":"#/components/schemas/SettlementStateENUM"}},"statuses":{"type":"array","items":{"$ref":"#/components/schemas/SettlementStatusENUM"}},"externalIds":{"type":"array","items":{"type":"string"}},"externalPaymentReferences":{"type":"array","items":{"type":"string"}},"hasEhfInvoice":{"type":"boolean","description":"EHF = \"Elektronisk handelsformat\""},"hasPaymentBalanceOutstanding":{"type":"boolean"}}}}}}},"parameters":{"pageNumberQuery":{"description":"Reference to a specific page in a result set.","in":"query","name":"pageNumber","required":false,"schema":{"type":"integer"}},"pageSizeQuery":{"description":"The number of items per page in a result set.","in":"query","name":"pageSize","required":false,"schema":{"type":"integer"}},"sortByQuery":{"description":"Defines which field the resource list is sorted by.","in":"query","name":"sortBy","required":false,"schema":{"type":"string"}},"sortDirectionQuery":{"description":"Reference to a sort direction","explode":false,"in":"query","name":"sortDirection","schema":{"$ref":"#/components/schemas/SortDirectionENUM"},"style":"form"}}},"paths":{"/tenants/{tenantUid}/organizations/{organizationUid}/settlements/search":{"post":{"summary":"Search in settlements","tags":["OrderSettlement"],"responses":{"200":{"$ref":"#/components/responses/SettlementListResponse"}},"operationId":"post-settlements-search","description":"Retrieves a filtered list of settlements for the organization.  \nResults are sorted by `createdAt` in descending order when no sorting parameter is specified.  \nThe spreadsheet response is a report containing only key settlement fields\n(pagination does not apply to spreadsheet responses).","requestBody":{"$ref":"#/components/requestBodies/SettlementSearchRequest"},"parameters":[{"$ref":"#/components/parameters/pageNumberQuery"},{"$ref":"#/components/parameters/pageSizeQuery"},{"$ref":"#/components/parameters/sortByQuery"},{"$ref":"#/components/parameters/sortDirectionQuery"}]}}}}
```


---

# Agent Instructions: Querying This Documentation

If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://docs.flowretail.com/docs/developers/api-documentation/ordersettlement.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
