Skip to content

Add new order

Endpoint URL

URL: https://api.mylion.hu/v1/orders

Request Method

HTTP Method: POST

Example JSON Request

To add a new order, you need to provide the necessary information in the form of a JSON payload. Here's an example JSON request:

json
[ 
    {
        "orderNumber": "ORD12345",
        "orderDate": "2023-08-14T12:34:56Z", 
        "currency": "USD", 
        "paymentMethod": "Credit Card", 
        "deliveryMethod": "Express", 
        "shippingFeeNetValue": 10.0,
        "shippingFeeVatValue": 1.5,
        "additionalFeeNetValue": 5.0,
        "additionalFeeVatValue": 0.75,
        "comments": "Please handle with care",
        "partner": {
            "externalId": "PARTNER123", 
            "identifiers": {
                "id": 456,
                "mylionId": 789
            },
            "firstName": "John",
            "lastName": "Doe",
            "companyName": "ABC Inc.",
            "emails": ["john@example.com", "johndoe@example.com"], 
            "phone": "123-456-7890", 
            "legalEntity": true, 
            "billingAddress": { 
                "countryCode": "US", 
                "city": "New York", 
                "zipCode": "10001", 
                "street": "123 Main St", 
                "fullStreetAddress": "123 Main St, New York, 10001, US"
            },
            "postalAddress": { 
                "countryCode": "US", 
                "city": "Los Angeles", 
                "zipCode": "90001", 
                "street": "456 Elm St", 
                "fullStreetAddress": "456 Elm St, Los Angeles, 90001, US"
            },
            "taxNumber": "123456789",
            "groupTaxNumber": "987654321",
            "euTaxNumber": "EU123456"
        },
        "orderItems": [
            {
                "id": 1, 
                "productId": 101, 
                "productCode": "PROD001", 
                "originalNetPrice": 50.0, 
                "discountedNetPrice": 45.0, 
                "quantity": 2, 
                "netValue": 90.0, 
                "vatValue": 10.0, 
                "comments": "Please handle with care",
                "attachedImages": [
                    {
                        "base64": "iVBORw0KGgoAAAANSUhEUgAAABAAAAAQCAYAAAAf8/9hAAABjElEQVR42mNk",
                        "url": null,
                    },
                    {
                        "base64": null,
                        "url": "https://example.com/image2.jpg"
                    }
                ]
            },
            {
                "id": 2, 
                "productId": 102, 
                "productCode": "PROD002", 
                "originalNetPrice": 30.0, 
                "discountedNetPrice": 25.0, 
                "quantity": 3, 
                "netValue": 75.0, 
                "vatValue": 7.5, 
                "comments": null,
                "attachedImages": []
            }
        ]
    }
]
java
@Data
public class OrderDTO {
    private String externalId;
    private String orderNumber;
    private XMLGregorianCalendar orderDate;
    private String currency;
    private String paymentMethod;
    private String deliveryMethod;
    private Double shippingFeeNetValue;
    private Double shippingFeeVatValue;
    private Double additionalFeeNetValue;
    private Double additionalFeeVatValue;
    private String comments;
    private PartnerDTO partner;
    private List<OrderItemDTO> orderItems;
}

@Data
public class PartnerDTO {

    private String externalId;
    private GenericIdentifiersDTO identifiers;
    private String firstName;
    private String lastName;
    private String companyName;
    private List<String> emails;
    private String phone;
    private Boolean legalEntity;
    private AddressDTO billingAddress;
    private AddressDTO postalAddress;
    private String taxNumber;
    private String groupTaxNumber;
    private String euTaxNumber;
    private Boolean isCustomer;
    private Boolean isSupplier;
}
@Data
public class GenericIdentifiersDTO {
    private Integer id;
    private Integer mylionId;
}
@Data
public class AddressDTO  {

    private String countryCode;
    private String city;
    private String zipCode;
    private String street;
    private String streetType;
    private String addressNumber;
    private String building;
    private String floor;
    private String door;
    private String fullStreetAddress;

}
@Data
public class OrderItemDTO {

    private Integer id;
    private Integer productId;
    private String productCode;
    private Double originalNetPrice;
    private Double discountedNetPrice;
    private Integer quantity;
    private Double netValue;
    private Double vatValue;
    private String comments;
    private List<AttachedImageDTO> attachedImages;
}
@Data
public class AttachedImageDTO {
    private String base64;
    private String url;
}

JSON Structure Explanation

The highlighted lines are the required properties.

  • 'id': The unique identifier for the order.
  • 'orderNumber': The order number associated with the order.
  • 'orderDate': The date and time when the order was placed.
  • 'currency': The currency in which the order is placed. e.g.: 'HU', 'USD', 'EUR'
  • 'paymentMethod': The method of payment for the order. Please contact MyLION team for the required values.
  • 'deliveryMethod': The method of delivery for the order. Please contact MyLION team for the required values.
  • 'shippingFeeNetValue': The net value of the shipping fee.
  • 'shippingFeeVatValue': The VAT value of the shipping fee.
  • 'additionalFeeNetValue': The net value of any additional fees.
  • 'additionalFeeVatValue': The VAT value of any additional fees.
  • 'comments'': Any additional comments or instructions.
  • 'partner': Details of the partner (customer) placing the order. See example JSON for details.
    • 'companyName' required if legalEntity is true
    • 'firstName' 'lastName' is required if legalEntity is false
    • 'taxNumber' required if legal entity
  • 'orderItems': An array of order items. Each item represents a product in the order. See example JSON for details.
  • 'attachedImages': An array of images attached to the order item. Each image can be provided as a base64 string or a URL.

Response Scenarios

HTTP 201 - Created

Upon successful order submission, you will receive an HTTP 201 response indicating that the order(s) have been created. Here's an example of a successful response:

json
{
    "mylionIds": [
        12345
    ]
}

HTTP 400 - Rejected

If there's an issue with the order submission, you might receive an HTTP 400 response. The response will include the order ID and a detailed error message explaining the reason for rejection. Here's an example of a rejected response:

json
{
    "orderNumber": "ORD12345",
    "errors": {
        {
            "property": "paymentMethod",
            "message": "Not a valid payment method."
        },
    }
}