Order

Order queries and mutations are used for working with orders and their information.

In the examples there are // comments serving as an additional information to specific part of the code. Remove them before sending a query. Otherwise, it will throw an error.

Queries

Get information about specific order

query findOrder($input: FindOrderQueryInput!){
  findOrder(input: $input) {
    order {
      hash
      parameters{key,value}
    }
  } 
}

with variables:

{
  "input": {
    "token": "__YOUR_STORE_TOKEN_HERE__",
    "orderHash": "__ORDER_HASH__"
  }
}

Mutations

Change order state

mutation changeOrderState($input: ChangeOrderStateMutationInput!){
  changeOrderState(input: $input) {
    result
  }
}

with variables:

{
  "input": {
    "token": "__YOUR_STORE_PRIVATE_TOKEN_HERE__",
    "orderHash": "__ORDER_HASH__",
    "orderStateCode": "paid"
  }
}

Adding parameters

mutation addOrderParameters($input: AddOrderParametersMutationInput!){
  addOrderParameters(input: $input) {
    message
    result
  }
}

with variables:

{
  "input": {
    "token": "__YOUR_STORE_PRIVATE_TOKEN_HERE__",
    "orderHash": "__ORDER_HASH__",
    "parameters": {
      "externalId": 4545,
      "billingAddress": {
        "firstName": "John",
        "lastName": "Doe",
        "zip": 11001
      },
      "shippingAddress": {
        "firstName": "John",
        "lastName": "Doe",
        "zip": 11001,
        "city": "Prague"
      },
      "paymentMethod": {
        "id": 1
      },
      "shippingMethod": {
        "id": 1
      }
    }
  }
}

Removing parameters

mutation removeOrderParameters($input: RemoveOrderParametersMutationInput!){
  removeOrderParameters(input: $input) {
    message
    result
  }
}

with variables:

{
  "input": {
    "token": "__YOUR_STORE_PRIVATE_TOKEN_HERE__",
    "orderHash": "__ORDER_HASH",
    "parameters": [
      "billingAddress", "paymentMethod", "externalId"
    ]
  }
}

 

Create E-commerce in 5 minutes

Try it. It is for free.