Currency

A currency is a system of monetary units in use in a country, in the form of banknotes and coins. In LS One all amounts are stored in the selected company currency and then each store can have it's own currency selected in the store setup to define to which currency the items are sold in the store. The currencies are identified by a 3 character currency code and have a currency symbol.

An exchange rate represents the value of one country's currency in relation to the set company currency at a given date. Each currency can have a standard exchange rate to convert amounts to the company currency and also a separate POS exchange rate. If a POS exchange rate exists then this will be used when calculating amounts on the ongoing transaction. The exchange rates also have validation dates.

LS One API allows defining new currencies besides the company's currency and exchange rates for selling or buying goods in different currencies.

The currency endpoint in LS One API allows management of currencies and related exchange rates.

Filtering

Using usageIntent filter, we can control how much extra data should be loaded for each currency.

UsageIntentEnum 
{
	Minimal = 1,
	Normal = 3,
	Reporting = 7
}

Actions

GET 

Get currency

GET 

Get all currencies
POST  Create a new currency

PUT 

Update a currency

DELETE 

Delete a currency

GET 

Get exchange rate

GET 

Get all exchange rates for currency

POST 

Create a new exchange rate

DELETE 

Delete an exchange rate

Properties

Currency

Field Data type Validation Description
id

string

Required

max length = 3

A 3-letter unique code for the currency (e.g. EUR, USD)
description string Required

max length = 30

Currency name (e.g. Euro)
salesRounding decimal Required

positive number

Currency rounding for sales
purchaseRounding decimal Required

positive number

Currency rounding for purchases
amountRounding decimal Required

positive number

Currency rounding for amount. This type of rounding works with all amounts apart from sales and balance
prefix string - Specifies a currency symbol appears to the left of the numeric amount (e.g. $100)
suffix string - Specifies a currency symbol that appears to the right of the numeric amount (e.g. 100 kr.)
roundOffTypeSales int

-

Sales rounding method:

  • 0 - round to next

  • 1 - always round up

  • 2 - always round down

roundOffTypePurchase int

-

Purchase rounding method:

  • 0 - round to next

  • 1 - always round up

  • 2 - always round down

roundOffTypeAmount int

-

Amount rounding method:

  • 0 - round to next

  • 1 - always round up

  • 2 - always round down

Exchange Rate

Field Data type Validation Description
currencyCode

string

Required

max. length = 3

A 3-letter unique code of an existing currency (e.g. EUR, USD)
fromDate datetime Required Start date of availability for the current exchange rate
exchangeRateValues decimal Required Actual value of the exchange rate
posExchangeRateValue decimal Required If this field is set then this exchange rate to be used when selling an item on the POS.

Examples

Get currency

Returns details of a single currency.

GET /api/currency/{id}

Permissions

  • Currency:Read

For more information on authenticating to LS One APIs, see Authentication.

Request

curl -X 'GET' \
	'https://lsoneapi.lsretail.com/api/currency/EUR' \
	-H 'accept: text/plain' \
	-H 'Authorization: Bearer {authentication_token}'		
Parameter Data type Validation Description
id string

Required

A 3-letter unique code for the currency (e.g. EUR, USD ...)

Response

{
	"id": "EUR",
	"description": "Euro",
	"salesRounding": 0.010000000000,
	"purchaseRounding": 0.010000000000,
	"amountRounding": 0.010000000000,
	"prefix": "€",
	"suffix": "",
	"roundOffTypeSales": 0,
	"roundOffTypePurchase": 0,
	"roundOffTypeAmount": 0,
}			

Status codes

Code Text Description
200 Success Success
401 Unauthorized LS One API client did not provide a valid authentication token or it does not have permissions to read currency(s)
404 Not Found The requested currency was not found

Get all currencies

Returns a list of all currencies.

GET /api/currency?usageIntent={usageIntent}

Permissions

  • Currency:Read

For more information on authenticating to LS One APIs, see Authentication.

Request

curl -X 'GET' \
				'https://lsoneapi.lsretail.com/api/currency/USD/usageIntent=1' \
				-H 'accept: text/plain' \
		-H 'Authorization: Bearer {authentication_token}'
Parameter Data type Validation Description
usageIntent int -

Amount of currency details to be loaded:

  • 1 - minimal. Only id and code are loaded

  • 3 - normal. All fields are returned

  • 7 - reporting. All fields are returned

Response

[
	{
		"id": "CAD",
		"description": "Canadian Dollar",
		"prefix": "",
		"suffix": "",
		"salesRounding": 0,
		"purchaseRounding": 0,
		"amountRounding": 0,
		"roundOffTypeSales": 0,
		"roundOffTypePurchase": 0,
		"roundOffTypeAmount": 0
	},
	{
		"id": "DKK",
		"description": "Danish Krona",
		"prefix": "",
		"suffix": "",
		"salesRounding": 0,
		"purchaseRounding": 0,
		"amountRounding": 0,
		"roundOffTypeSales": 0,
		"roundOffTypePurchase": 0,
		"roundOffTypeAmount": 0
	},
	...
]

Status codes

Code Text Description
200 Success Success
401 Unauthorized LS One API client did not provide a valid authentication token or it does not have permissions to read currency(s)

Create a new currency

Create a new currency.

POST /api/currency

To create a new currency, the following fields are required:

  • Id

  • Description

  • SalesRounding

  • PurchaseRounding

  • AmountRounding

Permissions

  • Currency:Write

For more information on authenticating to LS One APIs, see Authentication.

Request

curl -X 'POST' \
  'https://lsoneapi.lsretail.com/api/currency' \
  -H 'accept: text/plain' \
  -H 'Authorization: Bearer {authorization_token}' \
  -H 'Content-Type: application/json' \
  -d '{
		"id": "EUR",
		"description": "Euro",
		"salesRounding": 0.010000000000,
		"purchaseRounding": 0.010000000000,
		"amountRounding": 0.010000000000,
		"prefix": "€"
}'

Response

{
	"id": "EUR",
	"description": "Euro",
	"salesRounding": 0.010000000000,
	"purchaseRounding": 0.010000000000,
	"amountRounding": 0.010000000000,
	"prefix": "€",
	"suffix": "",
	"roundOffTypeSales": 0,
	"roundOffTypePurchase": 0,
	"roundOffTypeAmount": 0,
}

Status codes

Code Text Description
200 Success Success
401 Unauthorized LS One API client did not provide a valid authentication token or it does not have permissions to write currency(s)
400 Bad Request New currency could not be created

Update a currency

Updates an existing currency.

PUT /api/currency

To update an existing currency, the following fields are required:

  • Id

  • Description

  • SalesRounding

  • PurchaseRounding

  • AmountRounding

Permissions

  • Currency:Write

For more information on authenticating to LS One APIs, see Authentication.

Request

curl -X 'PUT' \
  'https://lsoneapi.lsretail.com/api/currency' \
  -H 'accept: text/plain' \
  -H 'Authorization: Bearer {authentication_token}' \
  -H 'Content-Type: application/json' \
  -d '{
		"id": "EUR",
		"description": "Euro",
		"salesRounding": 0.020000000000,
		"purchaseRounding": 0.020000000000,
		"amountRounding": 0.020000000000,
		"prefix": "€",
		"roundOffTypeSales": 1,
		"roundOffTypePurchase": 1,
		"roundOffTypeAmount": 1,
}'

Response

{
	"id": "EUR",
	"description": "Euro",
	"salesRounding": 0.020000000000,
	"purchaseRounding": 0.020000000000,
	"amountRounding": 0.020000000000,
	"prefix": "€",
	"suffix": "",
	"roundOffTypeSales": 1,
	"roundOffTypePurchase": 1,
	"roundOffTypeAmount": 1,
}

Status codes

Code Text Description
200 Success Success
401 Unauthorized LS One API client did not provide a valid authentication token or it does not have permissions to write currency(s)
400 Bad Request Currency could not be updated
404 Not Found Currency to be updated was not found

Delete a currency

Delete an existing currency.

DELETE /api/currency/{id}

Permissions

  • Currency:Write

For more information on authenticating to LS One APIs, see Authentication.

Request

curl -X 'DELETE' \
	'https://lsoneapi.lsretail.com/api/currency/EUR' \
	-H 'accept: text/plain' \
	-H 'Authorization: Bearer {authentication_token}'
Parameter Data type Validation Description
id string

Required

The ID of the currency

Response

HTTP/1.1 204 No Content	

Status codes

Code Text Description
204 No Content The currency was successfully deleted
401 Unauthorized LS One API client did not provide a valid authentication token or it does not have permissions to write currency(s)
404 Not Found The requested currency was not found

Get exchange rate

Returns details of a single exchange rate.

GET /api/currency/{currency_id}/{date:yyyy-MM-dd}/exchange-rate

Permissions

  • Currency:Read

For more information on authenticating to LS One APIs, see Authentication.

Request

curl -X 'GET' \
	'https://lsoneapi.lsretail.com/api/currency/EUR/2021-11-10/exchange-rate' \
	-H 'accept: text/plain' \
	-H 'Authorization: Bearer {authentication_token}'
Parameter Data type Validation Description
id string

Required

The exchange rate id of the exchange rate
date datetime

Required

The date of the exchange rate

Response

{
	"currencyCode": "EUR",
	"fromDate": "2021-11-10",
	"exchangeRateValues": 95.500000000000,
	"posExchangeRateValue": 95.500000000000
}		

Status codes

Code Text Description
200 Success Success
401 Unauthorized LS One API client did not provide a valid authentication token or it does not have permissions to read exchange rate(s)
404 Not Found The requested exchange rate was not found

Get all exchange rates for currency

Returns a list of all exchange rate for a given currency.

GET /api/currency/{currency_id}/exchange-rate

Permissions

  • Currency:Read

For more information on authenticating to LS One APIs, see Authentication.

Request

curl -X 'GET' \
	'https://lsoneapi.lsretail.com/api/currency/USD/exchange-rate' \
	-H 'accept: text/plain' \
	-H 'Authorization: Bearer {authentication_token}'
Parameter Data type Validation Description
id string

Required

The currency id for which to retrieve the exchange rate list

Response

[
	{
		"currencyCode": "USD",
		"fromDate": "2011-01-01T00:00:00",
		"exchangeRateValues": 75.500000000000,
		"posExchangeRateValue": 75.500000000000
	},
	{
		"currencyCode": "USD",
		"fromDate": "2012-01-01T00:00:00",
		"exchangeRateValues": 76.600000000000,
		"posExchangeRateValue": 76.600000000000
	},
	...
]

Status codes

Code Text Description
200 Success Success
401 Unauthorized LS One API client did not provide a valid authentication token or it does not have permissions to read exchange rate(s)
404 Not Found No exchange rates found

Create a new exchange rate

Create a new exchange rate.

POST /api/currency/exchange-rate

To create a new exchange rate, the following fields are required:

  • CurrencyCode

  • FromDate

  • ExchangeRateValues

  • POSExchangeRateValue

Permissions

  • Currency:Write

For more information on authenticating to LS One APIs, see Authentication.

Request

curl -X 'POST' \
  'https://lsoneapi.lsretail.com/api/currency/exchange-rate' \
  -H 'accept: text/plain' \
  -H 'Authorization: Bearer {authorization_token}' \
  -H 'Content-Type: application/json' \
  -d '{
		"currencyCode": "USD",
		"fromDate": "2021-11-10",
		"exchangeRateValues": 95.500000000000,
		"posExchangeRateValue": 95.500000000000
	}'

Response

{
	"currencyCode": "USD",
	"fromDate": "2021-11-10",
	"exchangeRateValues": 95.500000000000,
	"posExchangeRateValue": 95.500000000000
}

Status codes

Code Text Description
200 Success Success
401 Unauthorized LS One API client did not provide a valid authentication token or it does not have permissions to write exchange rate(s)
400 Bad Request New exchange rate could not be created

Delete an exchange rate

Delete an existing exchange rate.

DELETE /api/currency/{currency_id}/{date:yyyy-MM-dd}/exchange-rate

Permissions

  • Currency:Write

For more information on authenticating to LS One APIs, see Authentication.

Request

curl -X 'DELETE' \
	'https://lsoneapi.lsretail.com/api/currency/EUR/2021-11-10/exchange-rate' \
	-H 'accept: text/plain' \
	-H 'Authorization: Bearer {authentication_token}'		
Parameter Data type Validation Description
id string

Required

The currency id of the exchange rate
date DateTime

Required

The date of the exchange rate

Response

HTTP/1.1 204 No Content	

Status codes

Code Text Description
204 No Content The exchange rate was successfully deleted
401 Unauthorized LS One API client did not provide a valid authentication token or it does not have permissions to write exchange rate(s)
404 Not Found The requested exchange rate was not found