Skip to content

Orders API

The Orders API allows you to create orders and retrieve order history for your account.

Get All Orders

GET/api/orders

Retrieves a list of all orders for your account.

Response

json
[
  {
    "orderNumber": 1001,
    "orderDate": "2023-05-01T10:00:00Z",
    "status": "completed",
    "items": [
      {
        "product": {
          "displayName": "Microsoft Office 2021 Home & Business",
          "_id": "507f1f77bcf86cd799439011"
        },
        "quantity": 2,
        "price": 89.99,
        "subtotal": 179.98,
        "isReplacement": false,
        "licenses": [
          {
            "licenseKey": "ABCD-EFGH-IJKL-MNOP"
          },
          {
            "licenseKey": "QRST-UVWX-YZAB-CDEF"
          }
        ]
      }
    ],
    "subTotal": 179.98,
    "discountPercentage": null,
    "discountAmount": 20.00,
    "discountType": 0,
    "discountTotal": 20.00,
    "grandTotal": 179.98,
    "paymentMethod": "N/A",
    "orderFrom": 2
  }
]
bash
curl -X GET https://api.attivita.de/api/orders \
  -H "Authorization: Bearer YOUR_API_ACCESS_TOKEN"

Get Order by Number

GET/api/orders/:orderNumber

Retrieves details of a specific order.

Parameters

ParameterTypeRequiredDescription
orderNumbernumberYesThe order number

Response

The response format is identical to a single order object from the "Get All Orders" endpoint.

Create Order

POST/api/orders

Creates a new order with automatic discount application.

Request Body

json
{
  "products": [
    {
      "productId": "507f1f77bcf86cd799439011",
      "amount": 2
    },
    {
      "productId": "507f191e810c19729de860ea",
      "amount": 1
    }
  ]
}
bash
curl -X POST https://api.attivita.de/api/orders \
  -H "Authorization: Bearer YOUR_API_ACCESS_TOKEN" \
  -H "Content-Type: application/json" \
  -d '{
    "products": [
      {
        "productId": "507f1f77bcf86cd799439011",
        "amount": 2
      }
    ]
  }'
javascript
const order = {
  products: [
    {
      productId: "507f1f77bcf86cd799439011",
      amount: 2
    }
  ]
};

const response = await fetch('https://api.attivita.de/api/orders', {
  method: 'POST',
  headers: {
    'Authorization': 'Bearer YOUR_API_ACCESS_TOKEN',
    'Content-Type': 'application/json'
  },
  body: JSON.stringify(order)
});

const result = await response.json();

Response

json
{
  "customer": 7,
  "orderNumber": 1002,
  "orderDate": "2023-05-02T11:00:00Z",
  "status": "completed",
  "items": [
    {
      "product": "Microsoft Office 2021 Home & Business",
      "quantity": 2,
      "price": 89.99,
      "isReplacement": false,
      "licenses": [
        {
          "licenseKey": "ABCD-EFGH-IJKL-MNOP"
        },
        {
          "licenseKey": "QRST-UVWX-YZAB-CDEF"
        }
      ],
      "productId": "507f1f77bcf86cd799439011"
    }
  ],
  "subTotal": 179.98,
  "discountTotal": 20.00,
  "grandTotal": 179.98,
  "paymentMethod": "N/A",
  "orderFrom": 2
}
json
{
  "error": "Some products are not available",
  "unavailableItems": [
    {
      "productId": "507f1f77bcf86cd799439011",
      "productName": "Microsoft Office 2021",
      "requestedQuantity": 10,
      "availableQuantity": 5
    }
  ]
}
json
{
  "error": "You have reached your credit limit. For assistance, please reach out to our support team."
}

Important Notes

Automatic Discounts

Customer-specific discounts are automatically applied during order creation. The price field shows the final discounted price.

German VAT

For German customers, 19% VAT is automatically added to the order total.

Credit Limits

Orders that exceed your credit limit will be rejected. Contact support to increase your limit.

Order Response Fields

FieldTypeDescription
orderNumbernumberUnique order identifier
orderDatestringISO 8601 timestamp
statusstringOrder status (completed/pending/failed)
itemsarrayOrder line items
items[].productstring/objectProduct name or details
items[].quantitynumberQuantity ordered
items[].pricenumberFinal price per unit (after discounts)
items[].licensesarrayLicense keys (for digital products)
items[].productIdstringProduct identifier
subTotalnumberTotal before discounts
discountTotalnumberTotal discount amount
grandTotalnumberFinal total (including VAT if applicable)

Testing with Sandbox Mode

You can test order creation without affecting production by using Sandbox Mode:

bash
curl -X POST https://api.attivita.de/api/orders \
  -H "Authorization: Bearer YOUR_API_ACCESS_TOKEN" \
  -H "X-Sandbox-Mode: true" \
  -H "Content-Type: application/json" \
  -d '{"products": [{"productId": "...", "amount": 1}]}'

Next Steps

The usage of this API is at your own risk. Attivita GmbH is not responsible for any damages or losses.