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.
POST request:
returned data JSON:
Dane wyjściowe:
previous_order_id | int | Order 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_id | int | Order ID from BaseLinker pool |
delivery_fullname | string | Delivery address - full name |
delivery_company | string | Delivery address - company |
delivery_address | string | Delivery address - street and home/local number |
delivery_postcode | string | Delivery address - postcode |
delivery_city | string | Delivery address - city |
delivery_state_code | string | Delivery address - State, region or province code |
delivery_country | string | Delivery address - Country |
delivery_country_code | string | Delivery address - ISO country code (2 letters) |
invoice_fullname | string | Billing data - full name |
invoice_company | string | Billing data - company name |
invoice_nip | string | Billing data - Tax identifier |
invoice_address | string | Billing data - street and home/local number |
invoice_postcode | string | Billing data - postcode |
invoice_city | string | Billing data - city |
invoice_state_code | string | (optional) Billing data - State, region or province code |
invoice_country | string | Billing data - Country |
invoice_country_code | string | Billing data - ISO country code (2 letters) |
string | Customer email | |
phone | string | Customer phone |
delivery_method | string | Delivery name |
delivery_method_id | string | Delivery ID |
delivery_price | float | Delivery price |
delivery_point_name | string | (optional) delivery to point: name of point or name of machine |
delivery_point_id | string | (optional) delivery to point: code of point or machine |
delivery_point_address | string | (optional) delivery to point: street and home/local number |
delivery_point_postcode | string | (optional) delivery to point: postcode |
delivery_point_city | string | (optional) delivery to point: city |
payment_method | string | Name of payment method |
payment_method_cod | bool | flag determining whether the payment is cash on delivery (0/1) |
payment_method_id | string | (optional) Payment method ID (if mapped in BaseLinker panel) |
user_comments | string | (optional) customer comment |
admin_comments | string | (optional) short note from the operator to the order |
status_id | string | Order status ID (status list to be downloaded by StatusesList method) |
currency | char(3) | Order currency symbol |
want_invoice | bool | a flag specifying whether the customer wants an invoice (0/1) |
paid | bool | flag determining whether the order is paid (0/1) |
products | Array (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: |
| - id | string | product ID |
| - variant_id | string | variant ID (0 when main product) |
| - name | string | full product or variant name |
| - sku | string | (optional) Stock Keeping Unit |
| - price | float | gross price of one item |
| - quantity | int | number of items purchased |
| - tax | float | tax amount expressed as a percentage, as a number from 0-100. Without % character. |
| - auction_id | string | (optional) auction ID (from external marketplace, e.g. Ebay, Etsy)(optional) |
| - attributes | array | (optional) array with selectable product attributes describing the purchased variant, in which each element contains the following fields: |
| - name | string | attribute name |
| - value | string | attribute value |
| - price | float | price difference to the basic price of the product |
transaction_id | string | (optional) Transaction ID (from external marketplace) |
service_account | string | (optional) ID of seller account (from external marketplace) |
service | string | (optional) Name of external marketplace (if order was imported from external marketplace) |
change_products_quantity | bool | (optional) flag determining whether the status of purchased products should be reduced after creating an order (1 - yes, 0 - no) |
client_login | string | (optional) Customer Login (from external marketplace) |
extra_field_1 | string | (optional) additional field 1 (any data) |
extra_field_2 | string | (optional) additional field 2 (any data) |
Outgoing data
Array fields that the method should return.
order_id | int | ID 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
)
(
[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
)
(
[order_id] => 12345
)