Orders

Accepted methods

  • GET: Retrieve the list of all orders.
  • POST: Place a new order.

Accepted query parameters

Field name Description
event Event URI exact match
event__in Event URI in (list)
external_reference Event UID exact match
state Order state exact match
state__ne Order state not equal
state__in Order state in (list)
created__lt Created less-than
created__lte Created less-than or equal
created__gt Created greater than
created__gte Created greater than or equal

Data

Field name Type Description
item_count Integer The number of orders in the collection

Embedded resources

Example representation

[GET] https://shopping-api.paylogic.com/orders
{
    "_links": {
        "self": { "href": "https://shopping-api.paylogic.com/orders?page=2" },
        "curies": [
            { "name": "shop", "href": "https://shopping-api-docs.paylogic.com/documentation/{rel}.html", "templated": true, "type": "text/html" },
        ],
        "profile": { "href": "https://shopping-api-docs.paylogic.com/documentation/orders.html", "type": "text/html" },
        "search": { "href": "https://shopping-api.paylogic.com/orders{?event,status,total,created}", "templated": true },
        "first": { "href": "https://shopping-api.paylogic.com/products" },
        "prev": { "href": "https://shopping-api.paylogic.com/products?page=1" },
        "next": { "href": "https://shopping-api.paylogic.com/products?page=3" },
        "last": { "href": "https://shopping-api.paylogic.com/products?page=7" }
    },
    "item_count": 128,
    "_embedded": {
        "shop:order": [
            // ...
        ]
    }
}

POST behaviour

When POSTing to this resource, you are placing a new Order.

Request body schema

Field name Type   Description
products List of Product selection List of products with a quantity. Optionally you can provide a List of Ticket consumer objects. Note that the length of the list should be equal to the quantity of the products.
tickets List of Ticket references List of tickets to resell.
consumer Consumer A consumer object, describing the information of the consumer for whom the order is being placed.
payment_method String The selected payment method. Optional for free orders.
shipping_method String or Shipping The selected shipping method uid. Optional. Optionally you can also provide a Consumer Consumer object in case the delivery address is different from the consumer address. Consumer must have all required fields filled out but only Address related fields will be persisted.
external_purchases List of External purchase A list of external purchases. Optional.
external_reference String(32) 32 characters to use as your own reference. Optional.
redirect_url String(255) 255 character field for redirecting clients back to your site, this overrides the default redirect_url set in the backoffice. Optional.
check_consecutive_seats Boolean Whether or not the seats should only be next to each other. Defaults to False. See Consecutive seats.
vouchers List of strings List of voucher codes that open an access to specific sales or provide discounts.
currency String (ISO 4217) Currency code (See Amount). Optional.
opt_in Boolean Opt-in choice (See Event).

Constraints

Consecutive seats

If consecutive seats is turned on, and the event has seats, an exception will be raised when there are not enough seats available in the same row. This ensures that people that want to sit next to each other don’t end up in different rows.

Example - Create order from product selection.

[POST] https://shopping-api.paylogic.com/orders
{
    "products": [
        {
            "product": "https://shopping-api.paylogic.com/products/12365478654238976585643567854323",
            "quantity": 3
        },
        {
            "product": "https://shopping-api.paylogic.com/products/456ghtr45tg678fe5rf456yhgbvsw3lh",
            "quantity": 1,
            "consumer": {
                "address": "Some street 31",
                "city": "Some city",
                "country": "US",
                "date_of_birth": "1990-01-01",
                "email": "john.smith@example.com",
                "first_name": "John",
                "last_name": "Smith",
                "gender": 1,
                "postal_code": "1234",
                "state": "UT",
                "language": "en"
            }
        }
    ],
    "consumer": {
        "first_name": "John",
        "last_name": "Doe",
        "date_of_birth": "1986-12-30",
        "email": "john.doe@paylogic.eu",
        "gender": "1",
        "address": "Nieuwe Boteringestraat 28",
        "postal_code": "9716 JJ",
        "city": "Groningen",
        "country": "NL",
        "ip": "192.168.1.1"
    },
    "payment_method": "ghr57d5h3gd162fb35c5a3db57ghrydg",
    "shipping_method": {
        "uid": "87a5quvndhe162fb357alt872705zr2j",
        "consumer" : {
            "first_name": "John",
            "last_name": "Doe",
            "email": "john.doe@paylogic.com",
            "gender": 1,
            "address": "Some street for shipping 2",
            "city": "Some other city",
            "country": "US",
            "postal_code": "02145",
            "state": "MA"
        }
    },
    "external_purchases": [
        {
            "title": {
                "en": "External purchase"
            },
            "product_reference": "External purchase product A",
            "quantity": 3,
            "unit_price": {
                "currency": "EUR",
                "amount": 50.00
            }
        }
    ],
    "external_reference": "CO-118",
    "redirect_url": "http://www.example.com/redirect_url/",
    "check_consecutive_seats": "true"
}

Example - Create order from existing ticket.

[POST] https://shopping-api.paylogic.com/orders
{
    "tickets": ["https://shopping-api.paylogic.com/tickets/a2e37ee17474417a87259b02b674da9a"],
    "consumer": {
        "first_name": "John",
        "last_name": "Doe",
        "date_of_birth": "1986-12-30",
        "email": "john.doe@paylogic.eu",
        "gender": "1",
        "address": "Nieuwe Boteringestraat 28",
        "postal_code": "9716 JJ",
        "city": "Groningen",
        "country": "NL",
        "ip": "192.168.1.1"
    },
    "payment_method": "ghr57d5h3gd162fb35c5a3db57ghrydg",
    "shipping_method": "87a5quvndhe162fb357alt872705zr2j",
}

POST error handling

Most of the order creation errors can be validated by generating the bill. The bill related error types are defined here: Error types.

Validation error

Request validation errors like “No products and associated quantities specified” are returned as a Bad Request with the specific field errors in the error details.

HTTP/1.1 400 Bad Request
{
    "logref": "<UID>",
    "message": "Bad request.",
    "_links": {
        "help": {
            "href": "http://shopping-api-docs.paylogic.com/documentation/orders.html"
        }
    },
    "error_type": "BAD_REQUEST",
    "details": {
        "errors": [
            "attr": "products",
            "error": "No product selection found. To place an order, you have to indicate for which products you want to place it. To find products, visit the events and products resources."
        ]
    }
}

Error types

Error type codes can be used to dispatch the errors on the client side. These errors are related to the order creation. See also bill errors and, if you’re using the optional ticket transfer approval flow, TicketTransferApproval errors.

Type HTTP code Description
FORBIDDEN 403 Forbidden.
NOT_FOUND 404 Not found.
BAD_REQUEST 400 Bad request.
PAYMENT_METHOD_MISSING 400 A payment method is needed for the creation of an order. Please retrieve a bill for the selected products to see which payment methods are available.
EMPTY_BASKET 400 You are trying to create an order with no products.
CONSUMER_MISSING 400 Not all necessary consumer data was provided. Please check the documentation to see which data to provide.
CONSTRAINT_VIOLATION 400 Generic constraint violation.
NO_TICKETS_OR_PRODUCTS_PROVIDED 400 No tickets or products provided.
BOTH_TICKETS_AND_PRODUCTS_PROVIDED 400 Both tickets or products provided, while only one or the other is allowed.
TICKET_ERROR 400 Ticket is not in a valid state, approval is already created, or ticket’s product is not in app’s point of sale. (When trying to create a TicketTransferApproval)
TICKET_NOT_AVAILABLE 400 Provided ticket is not valid or not found.
NO_CONSUMER_URI_OR_INFO_PROVIDED 400 Provided consumer information is not valid, or a consumer is not found.
TICKET_CONSUMER_ERROR 400 Ticket consumer information is not valid.
NOT_ENOUGH_SEATS 404 There are not enough seats available in the same row. The order has been cancelled.
VOUCHER_INVALID 400 Voucher code is invalid.