# Create Transaction

Endpoint used for inserting transactions into OIP.
It is recommended to send in a list/batch of transactions instead of sending multiple single transactions.
The maximum recommended items per batch is around 400 transactions/items.
To make a transaction be processed as a return, you have to do the following:
* Set the transactionType field on item level to 'RETURN'
* Set the quantity value to a negative value.

Example of transaction flagged as a return:

```
{
"ReceiptRequests": [
  {
    "Header": {
      "StoreId": "001",
      "ReceiptId": "9999258836",
      "TimeStamp": "2023-10-13T14:50:05",
      "ConsumerId": "9ae37ad3-8a55-4bb5-81fd-b08f00b684ed",
      "GrossAmount": 1817.8,
      "Vat": 363.56
    },
    "Items": [
      {
        "ReceiptId": "Id of receipt",
        "LineNo": 1,
        "Quantity": -1,
        "ProductId": "VR1722775",
        "ProductName": "MINI CHRISTMAS TREE WITH LED LIGHTS",
        "GrossAmount": 1817.8,
        "Vat": 363.56,
        "NetAmount": 1454.24,
        "TransactionType": "RETURN"
      }
    ]
  }
]
}
```

Endpoint: POST /transactions
Version: 4.3.4
Security: api_key

## Request fields (application/json):

  - `ReceiptRequests` (array)

  - `ReceiptRequests.Header` (object)

  - `ReceiptRequests.Header.StoreId` (string)
    Id of store where the transaction was made
    Example: 001

  - `ReceiptRequests.Header.EcrId` (string)
    Example: 1

  - `ReceiptRequests.Header.ReceiptId` (string)
    Id of the reciept
    Example: 9999258836

  - `ReceiptRequests.Header.TimeStamp` (string)
    Timestamp of the transaction in UTC time format
    Example: 2023-10-13T14:50:05

  - `ReceiptRequests.Header.ConsumerId` (string)
    Depending on configuration, this could be a unique id or the customers phone number.
    Example: 9ae37ad3-8a55-4bb5-81fd-b08f00b684ed

  - `ReceiptRequests.Header.GrossAmount` (number)
    The total amount of the transaction
    Example: 1817.8

  - `ReceiptRequests.Header.Vat` (number)
    The totalt VAT amount of the transaction
    Example: 363.56

  - `ReceiptRequests.Header.NetAmount` (number)
    The total amount of the transaction without VAT
    Example: 1454.24

  - `ReceiptRequests.Header.Discount` (number)
    Example: 0

  - `ReceiptRequests.Header.Currency` (number)
    The currency used. Use currency code as described in https://www.iban.com/currency-codes
    Example: NOK

  - `ReceiptRequests.Header.PaymentString` (string)
    Can contain a string with payment data sent from POS. Max length 4000 chars
    Example: Any type of string

  - `ReceiptRequests.Header.Ext1` (string)
    Extra field available for customizations

  - `ReceiptRequests.Header.Ext2` (string)
    Extra field available for customizations

  - `ReceiptRequests.Header.Ext3` (string)
    Extra field available for customizations

  - `ReceiptRequests.Header.Ext4` (string)
    Extra field available for customizations

  - `ReceiptRequests.Header.Ext5` (string)
    Extra field available for customizations

  - `ReceiptRequests.Items` (array)

  - `ReceiptRequests.Items.ReceiptId` (string)
    Example: Id of receipt

  - `ReceiptRequests.Items.LineNo` (string)
    Line number in transaction for item(s)
    Example: 1

  - `ReceiptRequests.Items.Quantity` (number)
    Number of products purchased
    Example: 1

  - `ReceiptRequests.Items.ProductGroupLevel1Id` (string)
    Id of top level product category
    Example: 45

  - `ReceiptRequests.Items.ProductGroupLevel1Name` (string)
    Name of top level product category
    Example: CHRISTMAS

  - `ReceiptRequests.Items.ProductGroupLevel2Id` (string)
    Id of second level product category where available
    Example: 4545

  - `ReceiptRequests.Items.ProductGroupLevel2Name` (string)
    Name of second level product category where available
    Example: DECORACTIONS

  - `ReceiptRequests.Items.ProductGroupLevel3Id` (string)
    Id of third level product category where available
    Example: 454545

  - `ReceiptRequests.Items.ProductGroupLevel3Name` (string)
    Name of third level product category where available
    Example: MINI TREES

  - `ReceiptRequests.Items.ProductId` (string)
    Id of product
    Example: VR1722775

  - `ReceiptRequests.Items.ProductName` (string)
    Name of product
    Example: MINI CHRISTMAS TREE WITH LED LIGHTS

  - `ReceiptRequests.Items.SupplierId` (string)
    Id of supplier
    Example: 9000

  - `ReceiptRequests.Items.SupplierName` (string)
    Example: The christmas company

  - `ReceiptRequests.Items.GrossAmount` (number)
    Total amount of item(s)
    Example: 1817.8

  - `ReceiptRequests.Items.Vat` (number)
    The total VAT amount of item(s)
    Example: 363.56

  - `ReceiptRequests.Items.NetAmount` (number)
    The totalt amount item(s) without VAT
    Example: 1454.24

  - `ReceiptRequests.Items.Discount` (number)
    Totalt discount given on item(s)
    Example: 0

  - `ReceiptRequests.Items.Cost` (number)
    The total cost of products where available
    Example: 0

  - `ReceiptRequests.Items.CampaignId` (string)
    Reference to campaign where available
    Example: EF5C352A-D8D8-431E-A8D6-22928F405F20

  - `ReceiptRequests.Items.TransactionType` (string)
    Type of transaction (PURCHASE or RETURN)
    Example: PURCHASE

  - `ReceiptRequests.Items.Ext1` (string)
    Extra field available for customizations

  - `ReceiptRequests.Items.Ext2` (string)
    Extra field available for customizations

  - `ReceiptRequests.Items.Ext3` (string)
    Extra field available for customizations

  - `ReceiptRequests.Items.Ext4` (string)
    Extra field available for customizations

  - `ReceiptRequests.Items.Ext5` (string)
    Extra field available for customizations

  - `ReceiptRequests.Items.Ext6` (string)
    Extra field available for customizations

  - `ReceiptRequests.Items.Ext7` (string)
    Extra field available for customizations

  - `ReceiptRequests.Items.Ext8` (string)
    Extra field available for customizations

  - `ReceiptRequests.Items.Ext9` (string)
    Extra field available for customizations

  - `ReceiptRequests.Items.Ext10` (string)
    Extra field available for customizations

