Documentation of the shops data exchange protocol - baselinker.com
Function list
Tests
ChangeLog
Remap Builder


OrderAdd
The method allows add a new order from BaseLinker to the store. It provides delivery details, billing details and products of the order.


Input parameters
Incoming as $_POST fields.
previous_order_idintOrder ID (if added to the store for the first time, the value is empty. If it was added before, the value contains the previous order number)
baselinker_idintOrder ID from BaseLinker pool
delivery_fullnamestringDelivery address - full name
delivery_companystringDelivery address - company
delivery_addressstringDelivery address - street and home/local number
delivery_postcodestringDelivery address - postcode
delivery_citystringDelivery address - city
delivery_state_codestringDelivery address - State, region or province code
delivery_countrystringDelivery address - Country
delivery_country_codestringDelivery address - ISO country code (2 letters)
invoice_fullnamestringBilling data - full name
invoice_companystringBilling data - company name
invoice_nipstringBilling data - Tax identifier
invoice_addressstringBilling data - street and home/local number
invoice_postcodestringBilling data - postcode
invoice_citystringBilling data - city
invoice_state_codestring(optional) Billing data - State, region or province code
invoice_countrystringBilling data - Country
invoice_country_codestringBilling data - ISO country code (2 letters)
emailstringCustomer email
phonestringCustomer phone
delivery_methodstringDelivery name
delivery_method_idstringDelivery ID
delivery_pricefloatDelivery price
delivery_point_namestring(optional) delivery to point: name of point or name of machine
delivery_point_idstring(optional) delivery to point: code of point or machine
delivery_point_addressstring(optional) delivery to point: street and home/local number
delivery_point_postcodestring(optional) delivery to point: postcode
delivery_point_citystring(optional) delivery to point: city
payment_methodstringName of payment method
payment_method_codboolflag determining whether the payment is cash on delivery (0/1)
payment_method_idstring(optional) Payment method ID (if mapped in BaseLinker panel)
user_commentsstring(optional) customer comment
admin_commentsstring(optional) short note from the operator to the order
status_idstringOrder status ID (status list to be downloaded by StatusesList method)
currencychar(3)Order currency symbol
want_invoiceboola flag specifying whether the customer wants an invoice (0/1)
paidboolflag determining whether the order is paid (0/1)
productsArray (Sent as string in JSON format)An array containing the products of the order (in JSON format). Each element of the array is also an array containing the following fields:
| - idstringproduct ID
| - variant_idstringvariant ID (0 when main product)
| - namestringfull product or variant name
| - skustring(optional) Stock Keeping Unit
| - pricefloatgross price of one item
| - quantityintnumber of items purchased
| - taxfloattax amount expressed as a percentage, as a number from 0-100. Without % character.
| - auction_idstring(optional) auction ID (from external marketplace, e.g. Ebay, Etsy)(optional)
| - attributesarray(optional) array with selectable product attributes describing the purchased variant, in which each element contains the following fields:
      | - namestringattribute name
      | - valuestringattribute value
      | - pricefloatprice difference to the basic price of the product
transaction_idstring(optional) Transaction ID (from external marketplace)
service_accountstring(optional) ID of seller account (from external marketplace)
servicestring(optional) Name of external marketplace (if order was imported from external marketplace)
change_products_quantitybool(optional) flag determining whether the status of purchased products should be reduced after creating an order (1 - yes, 0 - no)
client_loginstring(optional) Customer Login (from external marketplace)
extra_field_1string(optional) additional field 1 (any data)
extra_field_2string(optional) additional field 2 (any data)



Outgoing data
Array fields that the method should return.
order_idintID of the new order saved in store database



Example:
Input data:
Array
(
    [previous_order_id] => 123456
    [baselinker_id] => 151009
    [delivery_fullname] => Jan Kowalski
    [delivery_company] => Firma sp.z.o.o.
    [delivery_address] => ul. Kolejowa 1
    [delivery_postcode] => 00-000
    [delivery_city] => Warszawa
    [delivery_country] => Polska
    [delivery_country_code] => PL
    [invoice_fullname] => Jan Kowalski
    [invoice_company] => Firma sp.z.o.o.
    [invoice_nip] => 1234567890
    [invoice_address] => ul. Kolejowa 1
    [invoice_postcode] => 00-000
    [invoice_city] => Warszawa
    [invoice_state_code] => 
    [invoice_country] => Polska
    [invoice_country_code] => PL
    [email] => example@example.com
    [phone] => +48123456789
    [delivery_method] => DHL
    [delivery_method_id] => 1
    [delivery_price] => 33
    [delivery_point_name] => DHL-BOX
    [delivery_point_id] => EX123456
    [delivery_point_address] => Testowa 12
    [delivery_point_postcode] => 12-123
    [delivery_point_city] => Warszawa
    [payment_method] => Przelew
    [payment_method_id] => x23
    [payment_method_cod] => 0
    [user_comments] => example user comments
    [admin_comments] => example admin comments
    [status_id] => 1
    [currency] => PLN
    [want_invoice] => 1
    [paid] => 1
    [products] => Array
        (
            [0] => Array
                (
                    [id] => 123
                    [variant_id] => 0
                    [name] => Test item 1
                    [sku] => 1234567890
                    [price] => 10
                    [quantity] => 1
                    [tax] => 23
                    [auction_id] => AUCTION_GUID
                    [attributes] => Array
                        (
                            [0] => Array
                                (
                                    [name] => Kolor
                                    [value] => Czerwony
                                    [price] => 
                                )

                        )

                )

            [1] => Array
                (
                    [id] => e9e92420-ce21-4650-bfc4-08c145fb9583
                    [variant_id] => 468b37bd-7e0a-406d-bc08-6e969835f4d2
                    [name] => Test item 2
                    [sku] => 
                    [price] => 54
                    [quantity] => 8
                    [tax] => 23
                    [auction_id] => a2b1d36a-ca7d-4542-8b24-ed112d2ae3eb
                )

        )

    [transaction_id] => 7ac0e291-5227-45dc-ba19-65c55fab1834
    [service_account] => jankowalski66
    [service] => MarketPlace
    [change_products_quantity] => 1
    [client_login] => jankowalski66
    [extra_field_1] => example additional field 1
    [extra_field_2] => example additional field 2
    [extra_field_(INT))] => example additional field with custom ID
)

POST request:
previous_order_id=123456&baselinker_id=151009&delivery_fullname=Jan+Kowalski&delivery_company=Firma+sp.z.o.o.&delivery_address=ul.+Kolejowa+1&delivery_postcode=00-000&delivery_city=Warszawa&delivery_country=Polska&delivery_country_code=PL&invoice_fullname=Jan+Kowalski&invoice_company=Firma+sp.z.o.o.&invoice_nip=1234567890&invoice_address=ul.+Kolejowa+1&invoice_postcode=00-000&invoice_city=Warszawa&invoice_state_code=&invoice_country=Polska&invoice_country_code=PL&email=example%40example.com&phone=%2B48123456789&delivery_method=DHL&delivery_method_id=1&delivery_price=33&delivery_point_name=DHL-BOX&delivery_point_id=EX123456&delivery_point_address=Testowa+12&delivery_point_postcode=12-123&delivery_point_city=Warszawa&payment_method=Przelew&payment_method_id=x23&payment_method_cod=0&user_comments=example+user+comments&admin_comments=example+admin+comments&status_id=1¤cy=PLN&want_invoice=1&paid=1&products%5B0%5D%5Bid%5D=123&products%5B0%5D%5Bvariant_id%5D=0&products%5B0%5D%5Bname%5D=Test+item+1&products%5B0%5D%5Bsku%5D=1234567890&products%5B0%5D%5Bprice%5D=10&products%5B0%5D%5Bquantity%5D=1&products%5B0%5D%5Btax%5D=23&products%5B0%5D%5Bauction_id%5D=AUCTION_GUID&products%5B0%5D%5Battributes%5D%5B0%5D%5Bname%5D=Kolor&products%5B0%5D%5Battributes%5D%5B0%5D%5Bvalue%5D=Czerwony&products%5B0%5D%5Battributes%5D%5B0%5D%5Bprice%5D=&products%5B1%5D%5Bid%5D=e9e92420-ce21-4650-bfc4-08c145fb9583&products%5B1%5D%5Bvariant_id%5D=468b37bd-7e0a-406d-bc08-6e969835f4d2&products%5B1%5D%5Bname%5D=Test+item+2&products%5B1%5D%5Bsku%5D=&products%5B1%5D%5Bprice%5D=54&products%5B1%5D%5Bquantity%5D=8&products%5B1%5D%5Btax%5D=23&products%5B1%5D%5Bauction_id%5D=a2b1d36a-ca7d-4542-8b24-ed112d2ae3eb&transaction_id=7ac0e291-5227-45dc-ba19-65c55fab1834&service_account=jankowalski66&service=MarketPlace&change_products_quantity=1&client_login=jankowalski66&extra_field_1=example+additional+field+1&extra_field_2=example+additional+field+2&extra_field_%28INT%29%29=example+additional+field+with+custom+ID


returned data JSON:
{"order_id":"12345"}

Dane wyjściowe:
Array
(
    [order_id] => 12345
)