Skip to main content
POST
/
v1
/
orders
/
import
Import Orders
curl --request POST \
  --url https://{cluster}.voucherify.io/v1/orders/import \
  --header 'Authorization: Bearer <token>' \
  --header 'Content-Type: application/json' \
  --header 'X-App-Id: <api-key>' \
  --header 'X-App-Token: <api-key>' \
  --data '[
  {
    "source_id": "orderImport14",
    "status": "PAID",
    "metadata": {
      "location_id": [
        "L1",
        "L2"
      ],
      "payment_mean": [
        "paypal",
        "credit-card"
      ]
    },
    "customer": {
      "source_id": "bob2.smith@email.com",
      "name": "Bob Smith",
      "description": "A nice customer",
      "email": "bob.smith@email.com",
      "phone": "+1 933 222 3333",
      "address": {
        "city": "New York",
        "country": "United States",
        "line_1": "123 Main St.",
        "line_2": "APT 3 BLG 4",
        "postal_code": "10001",
        "state": "NY"
      },
      "metadata": {
        "lang": "en",
        "test": true
      },
      "birthdate": "2022-01-01"
    },
    "referrer": {
      "source_id": "jane.smith@email.com",
      "name": "Jane Smith",
      "description": "A really nice customer",
      "email": "jane.smith@email.com",
      "phone": "+1 933 222 3334",
      "address": {
        "city": "New York",
        "country": "United States",
        "line_1": "123 Main St.",
        "line_2": "APT 3 BLG 4",
        "postal_code": "10001",
        "state": "NY"
      },
      "metadata": {
        "lang": "en",
        "test": false
      },
      "birthday": "2022-03-03"
    },
    "items": [
      {
        "source_id": "prod_1",
        "related_object": "product",
        "quantity": 2,
        "product": {
          "name": "Apple iPhone 12",
          "price": 70000,
          "metadata": {
            "color": [
              "silver"
            ],
            "vendor": "mall"
          },
          "override": true
        }
      },
      {
        "source_id": "ComicBook_1",
        "related_object": "sku",
        "quantity": 1,
        "product": {
          "source_id": "Books",
          "name": "Comic Books1",
          "price": 1600,
          "metadata": {
            "color": [
              "silver"
            ],
            "vendor": "Bookstore1"
          },
          "override": true
        },
        "sku": {
          "sku": "Comics1",
          "source_id": "ComicBook_1",
          "price": 1600,
          "metadata": {
            "color": [
              "golden"
            ],
            "vendor": "islands"
          },
          "override": true
        }
      }
    ]
  },
  {
    "source_id": "orderImport15",
    "status": "PAID",
    "metadata": {
      "location_id": [
        "L3"
      ],
      "payment_mean": [
        "wire-transfer"
      ]
    },
    "customer": {
      "source_id": "bob2.smith@email.com"
    },
    "referrer": {
      "source_id": "jane.smith@email.com"
    },
    "items": [
      {
        "source_id": "ComicBook_1",
        "quantity": 4,
        "related_object": "sku",
        "sku": {
          "source_id": "ComicBook_1"
        }
      },
      {
        "source_id": "vase_1",
        "quantity": 1,
        "related_object": "product",
        "product": {
          "source_id": "vase_1"
        }
      }
    ]
  },
  {
    "source_id": "orderImport16",
    "status": "FULFILLED",
    "metadata": {
      "location_id": [
        "L3"
      ],
      "payment_mean": [
        "wire-transfer"
      ]
    },
    "customer": {
      "id": "cust_LMY4ZylSdUYB1J4tzqNcl5VV"
    },
    "referrer": {
      "id": "cust_Vzck5i8U3OhcEUFY6MKhN9Rv"
    },
    "items": [
      {
        "product_id": "prod_0b72b0bd64d198e3ae",
        "quantity": 2
      },
      {
        "sku_id": "sku_0b1621b319d248b79f",
        "quantity": 2
      }
    ]
  },
  {
    "source_id": "orderImport17",
    "status": "CANCELED",
    "amount": 7000,
    "metadata": {
      "location_id": [
        "L3"
      ],
      "payment_mean": [
        "wire-transfer"
      ]
    }
  },
  {
    "source_id": "orderImport18",
    "status": "CREATED",
    "metadata": {
      "location_id": [
        "L3"
      ],
      "payment_mean": [
        "wire-transfer"
      ]
    },
    "items": [
      {
        "source_id": "ComicBook_1",
        "amount": 900,
        "related_object": "sku"
      },
      {
        "source_id": "vase_1",
        "amount": 2000,
        "related_object": "product"
      }
    ]
  },
  {
    "source_id": "orderImport19",
    "status": "CREATED",
    "metadata": {
      "location_id": [
        "L3"
      ],
      "payment_mean": [
        "wire-transfer"
      ]
    },
    "items": [
      {
        "amount": 900
      },
      {
        "amount": 2000
      }
    ]
  },
  {
    "source_id": "orderImport20",
    "status": "CREATED",
    "metadata": {
      "location_id": [
        "L3"
      ],
      "payment_mean": [
        "wire-transfer"
      ]
    },
    "items": [
      {
        "price": 900,
        "quantity": 2
      },
      {
        "price": 2000,
        "quantity": 3
      }
    ]
  }
]'
{
  "async_action_id": "aa_0a875d56c805df6601"
}

Authorizations

X-App-Id
string
header
required
X-App-Token
string
header
required
Authorization
string
header
required

The access token received from the authorization server in the OAuth 2.0 flow.

Body

application/json · Order Customer And Referrer Ids Objects · object[]

The request body is sent in the form of an array of order objects.

Request body schema for POST /orders/import.

created_at
string<date-time>

Timestamp representing the date and time when the order was created. The value is shown in the ISO 8601 format.

Example:

"2021-12-22T10:13:06.487Z"

referrer_id
string | null

Unique referrer ID.

Example:

"cust_nM4jqPiaXUvQdVSA6vTRUnix"

customer
object
referrer
object
id
string

Unique ID assigned by Voucherify of an existing order that will be linked to the redemption of this request.

source_id
string | null

Unique source ID of an existing order that will be linked to the redemption of this request.

status
enum<string>

The order status.

Available options:
CREATED,
PAID,
CANCELED,
FULFILLED
amount
integer

A positive integer in the smallest currency unit (e.g. 100 cents for $1.00) representing the total amount of the order. This is the sum of the order items' amounts.

initial_amount
integer

A positive integer in the smallest currency unit (e.g. 100 cents for $1.00) representing the total amount of the order. This is the sum of the order items' amounts.

discount_amount
integer

Sum of all order-level discounts applied to the order. It is expressed as an integer in the smallest currency unit (e.g. 100 cents for $1.00).

items
Order Item · object[]

Array of items applied to the order. It can include up to 500 items.

metadata
object

A set of custom key/value pairs that you can attach to an order. It can be useful for storing additional information about the order in a structured format. It can be used to define business validation rules or discount formulas.

Response

Returns the ID of the scheduled asynchronous action, informing you that your request has been accepted and the order(s) will be added to the repository asynchronously. To check the status and result, copy the async_action_id from the response and pass it using <!-- [Get Async Action](OpenAPI.json/paths/~1async-actions~1{asyncActionId}/get) -->Get Async Action endpoint.

Response body schema for POST v1/orders/import. Response to requests that are processed asynchronously.

async_action_id
string
required

The ID of the scheduled asynchronous action.

Example:

"aa_0a875d56c805df6601"

I