---
title: "Create an order"
method: POST
path: "/orders"
---

# Create an order

`POST /orders`

To create an order, you use orders resource. Order resources are used to handle customers' payments of previously defined offers. Orders expire after 24 hours unless the payment is captured. Payment method is required in order entity for payment but can be added in update order.

> You should add `paymentOperation` and `subscriptionId` parameters for recurring orders.

## Headers

- `Content-Type` string
- `X-Publisher-Token` string, required

## Request body

- object
  - `paymentMethodId` integer — provided by Cleeng
  - `customerId` integer, required — the identifier of Cleeng customer
  - `offerId` string, required — the identifier for Cleeng offer
  - `currency` string, required — customer currency (e.g. USD)
  - `country` string, required — 2-letter country code. It is the country code of the country where purchase is made.
  - `couponCode` string — coupon code
  - `taxRate` string — tax rate in float (e.g. '0.23')
  - `billingAddress` object
    - `billingStreetNumber` string — street number for billing address
    - `billingStreetName` string — street name for billing address
    - `billingPostalCode` string — postal code for billing address
  - `customerIP` string — IP address of customer current location. Required conditionally when currency or country not supplied
  - `paymentOperation` string — operation type, e.g. `recurring-payment` (required on pair with `subscriptionId`)
  - `subscriptionId` string — the identifier of Cleeng subscription, e.g. `123123123` (required on pair with `paymentOperation`)
  - `buyAsAGift` boolean — Whether an order refers to gift purchase
  - `deliveryDetails` object
    - `personalNote` string, required — A message for the person for whom we want to purchase a gift. It can be `null`.
    - `recipientEmail` string, required — Email address of the gift recipient (person reciving a gift).
    - `deliveryDate` integer, required — A date when the purchased gift should be delivered in unix timestamp.

## Response `200`

200

- object
  - `success` boolean
  - `order` object
    - `id` integer
    - `customerId` integer
    - `customer` object
      - `locale` string
      - `email` string
    - `publisherId` integer
    - `offerId` string
    - `offer` object
      - `title` string
      - `description` unknown
      - `price` number
      - `currency` string
    - `totalPrice` number
    - `priceBreakdown` object
      - `offerPrice` number
      - `discountAmount` number
      - `discountedPrice` number
      - `taxValue` number
      - `customerServiceFee` integer
      - `paymentMethodFee` number
    - `taxRate` number
    - `taxBreakdown` unknown
    - `currency` string
    - `country` string
    - `paymentMethodId` integer
    - `expirationDate` integer
    - `billingAddress` object
      - `billingStreetName` string
      - `billingStreetNumber` string
      - `billingPostalCode` string
    - `couponId` integer
    - `discount` object
      - `applied` boolean
      - `type` string
      - `periods` integer
    - `requiredPaymentDetails` boolean
  - `message` string

---

[API](https://skmtc.net/cleeng/apis/mediastore-api.md) · [All operations](https://skmtc.net/cleeng/apis/mediastore-api/llms.txt) · [OpenAPI document](https://skmtc-service-staging.skmtc.workers.dev/v1/apis/cleeng/mediastore-api/versions/00cbfe7998a4/schema)
