API Comenzi

Acesta este sectiunea de help pentru versiunea Legacy a panoului de control. Daca utilizati panoul de control Flex, puteti gasi aici sectiunea de help relevanta.

Foloseste API-ul de comenzi pentru a extrage informatii despre comenzi, pentru a adauga comenzi noi sau pentru a actualiza datelor unor comenzi existente.

Campuri disponibile

Lista de mai jos indica toate campurile disponibile pt acest API, care sunt returnate cand extragi o lista sau resursa individuala, care pot fi modificate, care sunt obligatorii in cazul crearii unei resurse noi sau actualizarii unei resurse existente.

Camp Tip Descriere Lista Alterabil
id string ID-ul comenzii  
parent_id int ID-ul comenzii parinte in cazul comenzilor care au fost splitate  
return_source_id int ID-ul comenzii initiale in cazul comenzilor care au fost returnate  
rma_orders array Lista de comenzi care au fost returnate din comanda initiala    
   rma_orders.id int ID-ul comenzii returnate    
   rma_orders.type string Tipul de returnare    
channel_name string Numele canalului de vanzari de unde a fost primit comanda  
channel_ref_id string Identificatorul extern al comenzii  
payment_status string Status-ul de plata. Valori posibile: temporary, awaiting, paid, failed, cancelled, refunded, rejected
payment_status_text string Reprezentarea textuala a status-ului de plata  
payment_substatus_id int ID-ul substatus-ului de plata
payment_substatus_text string Reprezentarea textuala a substatus-ului de plata  
payment_method_code string Codul metodei de plata. Valori posibile (dependente de metodele active): librapay, paypal, skrill, 2checkout, epayment, euplatesc, cash_delivery, wire, in_store, mobilpay, nestpay, plationlinepo5, brd_finance, sofort, tbi, paypal_plus, libracredit, ipay
payment_method_name string Denumirea metodei de plata  
payment_transaction_id string Identificatorul de referinta al platii  
shipping_status string Status-ul de livrare. Valori posibile: awaiting, confirmed, in_process, shipped, delivered, returned, cancelled
shipping_status_text string Reprezentarea textuala a status-ului de livrare  
shipping_substatus_id int ID-ul substatus-ului de livrare
shipping_substatus_text string Reprezentarea textuala a substatus-ului de livrare  
shipping_method_id string ID-ul intern al metodei de livrare
shipping_method_name string Denumirea metodei de livrare  
shipping_delivery_info array Detaliile de livrare    
   shipping_delivery_info.delivery_time string Durata de livrare    
   shipping_delivery_info.pickup_address array Informatiile privind adresa de livrare  
      pickup_address.id int ID-ul punctului de ridicare a comenzii (locker, easybox, office)  
      pickup_address.name string Numele adresei de livrare  
shipping_carrier_id string ID-ul curierului folosit pentru livrare  
shipping_awb string Codul AWB din sistemul curierului
shipping_amount float Cost livrare
shipping_tax_amount float Valoarea taxei din costul de livrare  
total_amount float Total valoare comanda  
currency string Moneda aferenta (ISO 4217)  
original_currency string Moneda in care a fost plasata comanda, daca comanda a fost plasata in alta moneda decat moneda implicita (ISO 4217)  
currency_rate float Rata de schimb aferenta monedei in care a fost plasata comanda  
coupon_code string Codul de cupon folosit  
customer_id int ID-ul clientului
customer_email int Adresa de email a clientului
customer_ip_address string Adresa IP de pe care a fost plasata comanda  
customer_ip_country string Tara aferenta IP-ului de pe care a fost platasa comanda  
customer_device string Tipul de device folosit la momentul plasarii comenzii (desktop, mobile)
customer_lang string Limba selectata la momentul plasarii comenzii
customer_note string Observatiile clientului
customer_notification string Mentiunile administratorului catre client
date_created date Data adaugarii comenzii (format ISO 8601)  
date_modified date Data ultimei modificari (format ISO 8601)  
date_shipped date Data la care a fost facuta livrarea comenzii (format ISO 8601)  
date_delivered date Data la care a fost receptionata comanda de catre client (format ISO 8601)  
created_by string Tipul de utilizator care a creat comanda (account, user)
meta_fields object Campurile aditionale
internal_notes array Lista notelor interne
   internal_notes[].id int ID-ul notei  
   internal_notes[].text string Textul aferent notei
tags array Taguri aferente comenzii
   tags[].id int ID-ul tagului  
   tags[].name int Numele tagului
billing_type string Tipul de cont, persoana fizica sau juridica (individual, company)
billing_name string Numele clientului
billing_identity_number string Codul numeric personal (in cazul clientilor persoane fizice)
billing_company_name string Numele companiei (in cazul clientilor persoane juridice)
billing_company_number string Numarul de inregistrare (in cazul clientilor persoane juridice)
billing_company_vat string Codul fiscal (in cazul clientilor persoane juridice)
billing_company_bank_name string Denumirea bancii (in cazul clientilor persoane juridice)
billing_company_bank_account string Contul bancar (in cazul clientilor persoane juridice)
billing_country_code string Codul tarii aferent datelor de facturare (ISO 3166-1 alpha-2)
billing_country_name string Numele tarii aferent datelor de facturare
billing_state string Judetul sau statul aferent datelor de facturare
billing_city string Orasul aferent datelor de facturare
billing_address string Adresa aferenta datelor de facturare
billing_postal_code string Codul postal aferent datelor de facturare
billing_phone string Numarul de telefon aferent datelor de facturare
shipping_name string Persoana desemnata sa primeasca comanda
shipping_country_code string Codul tarii aferent datelor de livrare (ISO 3166-1 alpha-2)
shipping_country_name string Numele tarii aferent datelor de livrare
shipping_state string Judetul sau statul aferent datelor de livrare
shipping_city string Orasul aferent datelor de livrare
shipping_address string Adresa aferenta datelor de livrare
shipping_postal_code string Codul postal aferent datelor de livrare
shipping_phone string Numarul de telefon aferent datelor de livrare
line_items array Lista produselor comandate  

TIP
Orice camp returnat si care nu este documentat poate fi ignorat deoarece nu este inca disponibil.

Extragere lista comenzi

Afiseaza lista filtrata de inregistrari.

Tip: Lista resurse
Verb: GET
Url: /api/v2/orders
Filtrare rezultate: Da
Selectie campuri: Da
Includere campuri suplimentare: Da
Paginatie: Da

Codul http de raspuns este 200 in caz de succes, raspunsul va avea forma unei liste de resurse aferente filtrelor definite.

Doar campurile de tip lista vor fi incluse in rezultatul standard. Poti include campuri suplimentare care in mod implicit nu sunt incluse folosind parametrul include si mentionand in mod explicit doar campurile suplimentare (separate prin virgula) pe care le doresti incluse.

GET /api/v2/orders?include=line_items

Poti filtra campurile pe care le doresti incluse in rezultat pentru fiecare resursa folosind parametrul fields si mentionand in mod explicit doar campurile (separate prin virgula) pe care le doresti incluse (campul id va fi inclus intotdeauna in mod implicit).

GET /api/v2/orders?fields=id,payment_status,shipping_status,total_amount

Filtrare rezultate

Este posibila filtrarea rezultatelor prin apendarea unor parametrii specifici in URL.

Parametru Descriere Exemplu
id Id-ul comenzii id=101
ids Lista id-uri comenzi separate prin virgula ids=12345001,12345002,12345003
payment_status Status-ul de plata payment_status=awaiting
payment_substatus_id ID-ul substatus-ului de plata payment_substatus_id=11
payment_method_code Codul metodei de plata payment_method_code=cash_delivery
payment_transaction_id Identificatorul de referinta al platii payment_transaction_id=VADE0B248932
shipping_status Status-ul de livrare shipping_status=awaiting
shipping_substatus_id ID-ul substatus-ului de livrare shipping_substatus_id=21
shipping_method_id ID-ul metodei de livrare shipping_method_id=101
shipping_awb Codul AWB din sistemul curierului shipping_awb=12312345675
customer_id ID-ul clientului customer_id=12345
customer_email Adresa de email a clientului customer_email=john.smith@example.com
created_after Data de la care au fost create inregistrarile (format ISO 8601) created_after=2019-01-01
created_before Data pana la care au fost create inregistrarile (format ISO 8601) created_before=2020-01-01
tag_name Numele tag-ului tag_name=valoare
tag_ids Lista id-uri taguri separate prin virgula tag_ids=123,456
GET /api/v2/orders?ids=12345001,12345002,12345003

Sortare rezultate

Este posibila sortarea rezultatelor prin apendarea unor parametrii specifici in URL.

Parametru Descriere Exemplu
date_created Data adaugarii comenzii ascendent sort=date_created
date_created.desc Data adaugarii comenzii descendent sort=date_created.desc
GET /api/v2/orders?sort=date_created 

Paginatie

Parametrii de paginatie pot fi adaugati request-ului API pentru a limita numarul de inregistrari pe pagina si a accesa toate paginile disponibile.

Parametru Tip Default
start int 0
limit int 100

Limita maxima de inregistrari pe pagina nu poate depasi valoarea 100.

GET /api/v2/orders?start=100&limit=100

Format request

Exemplu de request CURL care extrage toate inregistrarile:

curl --request GET \
--url 'https://shop.demo.ro/api/v2/orders' \
--header 'Accept: application/json' \
--header 'Content-type: application/json' \
--header 'Authorization: Basic {base64-encoded-credentials}'

Filtreaza inregistrarile pe baza de status livrare, extrage toate campurile

Exemplu request

GET /api/v2/orders?shipping_status=awaiting
Exemplu raspuns
{
  "data": [  
    {
        "id": 11089919,
        "payment_status": "awaiting",
        "payment_status_text": "Plata in asteptare",
        "payment_method_code": "cash_delivery",
        "payment_method_name": "Plata in sistem ramburs",
        "shipping_status": "awaiting",
        "shipping_status_text": "Comanda in asteptare",
        "shipping_method_id": 3,
        "shipping_method_name": "Speedy",
        "shipping_amount": 15,
        "shipping_tax_amount": 2.39,
        "total_amount": 30.23,
        "currency": "RON",
        "customer_id": 14,
        "customer_email": "john.smith@yahoo.com",
        "customer_ip_address": "166.176.119.218",
        "customer_ip_country": "RO",
        "customer_device": "desktop",
        "customer_lang": "ro_RO",
        "customer_note": null,
        "customer_notification": null,
        "date_created": "2019-12-05T16:11:23+02:00",
        "date_modified": "2019-12-05T16:11:23+02:00",
        "created_by": "customer",
        "meta_fields": null,
        "tags": null,
        "billing_type": "individual",
        "billing_name": "John Smith",
        "billing_company_name": null,
        "billing_company_number": null,
        "billing_company_vat": null,
        "billing_company_bank_name": null,
        "billing_company_bank_account": null,
        "billing_country_code": "RO",
        "billing_country_name": "România",
        "billing_state": "Bucuresti",
        "billing_city": "Bucuresti",
        "billing_address": "str Rose Hill, nr. 45",
        "billing_postal_code": "100167",
        "billing_phone": "0722356158",
        "shipping_name": "John Smith",
        "shipping_country_code": "RO",
        "shipping_country_name": "România",
        "shipping_state": "Bucuresti",
        "shipping_city": "Bucuresti",
        "shipping_address": "str Rose Hill, nr. 45",
        "shipping_postal_code": "100167",
        "shipping_phone": "0722356158",
        "invoice": null,
        "info_url": "https://shop.demo.ro/comanda/info/33a818fcb3a13aa5b70e3a9e1475bfc0/11089919",
        "proforma_url": "https://shop.demo.ro/comanda/proforma/33a818fcb3a13aa5b70e3a9e1475bfc0/11089919"
    }  
  ],
  "meta": {
    "count": {
      "total": 1,
      "current": 1,
      "start": 0,
      "limit": 100
    },
    "links": {
      "prev": null,
      "current": "/api/v2/orders?shipping_status=awaiting",
      "next": null
    }
  }
}

Filtreaza inregistrarile pe baza de lista de ID-uri, filtreaza doar anumite campuri

Exemplu request

GET /api/v2/orders?ids=12345001,12345002,12345003&fields=id,payment_status,payment_method_code,total_amount
Exemplu raspuns
{
  "data": [
    {
      "id": 12345001,
      "payment_status": "awaiting",
      "payment_method_code": "cash_delivery",
      "total_amount": 999.95
    },
    {
      "id": 12345002,
      "payment_status": "paid",
      "payment_method_code": "paypal",
      "total_amount": 199.99
    },
    {
      "id": 12345003,
      "payment_status": "cancelled",
      "payment_method_code": "cash_delivery",
      "total_amount": 599.97
    }
  ],
  "meta": {
    "count": {
      "total": 3,
      "current": 3,
      "start": 0,
      "limit": 100
    },
    "links": {
      "prev": null,
      "current": "/api/v2/orders?ids=12345001,12345002,12345003&fields=id,payment_status,payment_method_code,total_amount",
      "next": null
    }
  }
}

Filtreaza inregistrarile pe baza de status livrare, include campuri suplimentare

Exemplu request

GET /api/v2/orders?shipping_status=awaiting&include=line_items
Exemplu raspuns
{
  "data": [
         {
            "id": 64098294,
            "payment_status": "awaiting",
            "payment_status_text": "Plata in asteptare",
            "payment_method_code": "cash_delivery",
            "payment_method_name": "Plata in sistem ramburs",
            "shipping_status": "awaiting",
            "shipping_status_text": "Comanda in asteptare",
            "shipping_method_id": 3,
            "shipping_method_name": "Speedy",
            "shipping_amount": 161.16,
            "shipping_tax_amount": 25.73,
            "total_amount": 526.55,
            "currency": "RON",
            "customer_id": 19,
            "customer_email": "john.smith@yahoo.com",
            "customer_ip_address": "143.20.218.217",
            "customer_ip_country": "ro",
            "customer_device": "desktop",
            "customer_lang": "ro_RO",
            "customer_note": null,
            "customer_notification": null,
            "date_created": "2020-03-26T15:47:08+02:00",
            "date_modified": "2020-03-26T15:47:08+02:00",
            "created_by": "customer",
            "meta_fields": null,
            "tags": null,
            "billing_type": "individual",
            "billing_name": "John Smith",
            "billing_company_name": null,
            "billing_company_number": null,
            "billing_company_vat": null,
            "billing_company_bank_name": null,
            "billing_company_bank_account": null,
            "billing_country_code": "RO",
            "billing_country_name": "România",
            "billing_state": "Bucuresti",
            "billing_city": "Bucuresti",
            "billing_address": "str Rose Hill, nr. 45",
            "billing_postal_code": "1221421",
            "billing_phone": "0722654983",
            "shipping_name": "John Smith",
            "shipping_country_code": "RO",
            "shipping_country_name": "România",
            "shipping_state": "Bucuresti",
            "shipping_city": "Bucuresti",
            "shipping_address": "str Rose Hill, nr. 45",
            "shipping_postal_code": "1221421",
            "shipping_phone": "0722654983",
            "line_items": [
                {
                    "item_type": "product",
                    "product_id": 1958,
                    "variant_name": "Culoare: alb",
                    "variant_options": [
                        {
                            "id": 1,
                            "name": "Culoare",
                            "value": "alb"
                        },
                    ],
                    "product_sku": "3484",
                    "product_ean": "7562461441110",
                    "product_name": "Massive Menelaus 37511/48/10",
                    "product_url": "https://shop.demo.ro/cumpara?id=1958",
                    "product_image_url": "https://shop.demo.ro/files/s11/204992628/p/l/7/massive-menelaus-37511-48-10-lustra~1057.jpg",
                    "product_tax_name": "TVA",
                    "product_tax_percent": 19,
                    "category_id": 2,
                    "category_name": "Lustre",
                    "manufacturer_id": 0,
                    "quantity": 1,
                    "unit_price_net": 307.05,
                    "unit_tax_amount": 58.34,
                    "unit_price_gross": 365.39,
                    "line_subtotal_net": 307.05,
                    "line_tax_amount": 58.34,
                    "line_subtotal_gross": 365.39,
                }
            ],
            "invoice": null,
            "info_url": "https://shop.demo.ro/comanda/info/6c1d81789f477768caad874aafc24936/64098294",
            "proforma_url": "https://shop.demo.ro/comanda/proforma/6c1d81789f477768caad874aafc24936/64098294"
        }
  ],
  "meta": {
    "count": {
      "total": 1,
      "current": 1,
      "start": 0,
      "limit": 100
    },
    "links": {
      "prev": null,
      "current": "/api/v2/orders?shipping_status=awaiting&include=line_items",
      "next": null
    }
  }
}

Extragere date comanda

Afiseaza datele unei singure inregistrari.

Tip: Resursa individuala
Verb: GET
Url: /api/v2/orders/{id}
Filtrare rezultate: Nu
Selectie campuri: Da
Includere campuri suplimentare: Nu
Paginatie: Nu

Codul http de raspuns este 200 in caz de succes, raspunsul va avea forma unei resurse individuale aferente id-ului solicitat.

Poti filtra campurile pe care le doresti incluse in rezultat pentru fiecare resursa folosind parametrul fields si mentionand in mod explicit doar campurile (separate prin virgula) pe care le doresti incluse (campul id va fi inclus intotdeauna in mod implicit).

GET /api/v2/orders/{id}?fields=id,total_amount,line_items

Format request

Exemplu de request CURL care returneaza o inregistrare individuala:

curl --request GET \
--url 'https://shop.demo.ro/api/v2/orders/12345001' \
--header 'Accept: application/json' \
--header 'Content-type: application/json' \
--header 'Authorization: Basic {base64-encoded-credentials}'

Extrage toate campurile

Exemplu request

GET /api/v2/orders/{id}
Exemplu raspuns
{
  "id": 12345001,
  "parent_id": 39787708,
  "payment_status": "awaiting",
  "payment_status_text": "Plata in asteptare",
  "payment_method_code": "cash_delivery",
  "payment_method_name": "Plata in sistem ramburs",
  "shipping_status": "awaiting",
  "shipping_status_text": "Comanda in asteptare",
  "shipping_method_id": 0,
  "shipping_method_name": null,
  "shipping_amount": null,
  "shipping_tax_amount": null,
  "total_amount": 453.05,
  "currency": "RON",
  "customer_id": 2,
  "customer_email": "dfdfddddf@exemple.com",
  "customer_ip_address": "",
  "customer_ip_country": "",
  "customer_device": "manual",
  "customer_lang": "ro_RO",
  "customer_note": null,
  "customer_notification": null,
  "date_created": "2020-03-25T07:42:28+02:00",
  "date_modified": "2020-03-25T07:42:28+02:00",
  "created_by": "account",
  "meta_fields": null,
  "tags": null,
  "billing_type": "individual",
  "billing_name": "John Smith",
  "billing_company_name": null,
  "billing_company_number": null,
  "billing_company_vat": null,
  "billing_company_bank_name": null,
  "billing_company_bank_account": null,
  "billing_country_code": "RO",
  "billing_country_name": "România",
  "billing_state": "Bacau",
  "billing_city": "bacau",
  "billing_address": "",
  "billing_postal_code": "",
  "billing_phone": "",
  "shipping_name": "John Smith",
  "shipping_country_code": "RO",
  "shipping_country_name": "România",
  "shipping_state": "Bacau",
  "shipping_city": "bacau",
  "shipping_address": "",
  "shipping_postal_code": "",
  "shipping_phone": "",
  "line_items": [
    {
      "item_type": "product",
      "product_id": 259,
      "product_sku": null,
      "product_ean": null,
      "product_name": "Giuseppe Zanotti Women's Swarovski Sandal",
      "product_url": "https://shop.demo.ro/cumpara?id=259",
      "product_image_url": "https://s.cdnmpro.com/272414248/p/l/7/giuseppe-zanotti-women-s-swarovski-sandal~27.jpg",
      "product_tax_name": "TVA",
      "product_tax_percent": 19,
      "category_id": 18,
      "category_name": "Sandale",
      "manufacturer_id": 1000050,
      "manufacturer_name": "Giuseppe-Zanotti",
      "quantity": 1,
      "unit_price_net": 184.03,
      "unit_tax_amount": 34.96,
      "unit_price_gross": 218.99,
      "line_subtotal_net": 184.03,
      "line_tax_amount": 34.96,
      "line_subtotal_gross": 218.99
    },
    {
      "item_type": "product",
      "product_id": 260,
      "product_sku": null,
      "product_ean": null,
      "product_name": "Women's Nunaked Dress Sandal",
      "product_url": "https://shop.demo.ro/cumpara?id=260",
      "product_image_url": "https://s.cdnmpro.com/272414248/p/l/9/women-s-nunaked-dress-sandal~29.jpg",
      "product_tax_name": "TVA",
      "product_tax_percent": 19,
      "category_id": 18,
      "category_name": "Sandale",
      "manufacturer_id": 1000061,
      "manufacturer_name": "Joop",
      "quantity": 2,
      "unit_price_net": 98.34,
      "unit_tax_amount": 18.69,
      "unit_price_gross": 117.03,
      "line_subtotal_net": 196.68,
      "line_tax_amount": 37.38,
      "line_subtotal_gross": 234.06
    }
  ],
  "invoice": {
    "prefix": "SERIE",
    "number": "0000010",
    "app": "billing",
    "cancelled": false,
    "url": "https://shop.demo.ro/comanda/invoice/2e8b8a4802eb3b5d1c8f381b2c20a0ea/52527708"
  },
  "info_url": "https://shop.demo.ro/comanda/info/557d2803bc4caee040329d1de5d2754f/12345001",
  "proforma_url": "https://shop.demo.ro/comanda/proforma/557d2803bc4caee040329d1de5d2754f/12345001"
}

Filtreaza doar anumite campuri

Exemplu request

GET /api/v2/orders/{id}?fields=id,payment_status,shipping_status,total_amount
Exemplu raspuns
{
  "data": [
    {
      "id": 12345001,
      "payment_status": "awaiting",
      "shipping_status": "awaiting",
      "total_amount": 453.05
    },
    {
      "id": 39787708,
      "payment_status": "cancelled",
      "shipping_status": "cancelled",
      "total_amount": 1712.05
    },
    {
      "id": 46706210,
      "payment_status": "failed",
      "shipping_status": "awaiting",
      "total_amount": 1799
    },
    {
      "id": 53824910,
      "payment_status": "awaiting",
      "shipping_status": "shipped",
      "total_amount": 467.99
    },
    {
      "id": 67716435,
      "payment_status": "paid",
      "shipping_status": "in_process",
      "total_amount": 1719
    },
    {
      "id": 73000828,
      "payment_status": "awaiting",
      "shipping_status": "awaiting",
      "total_amount": 1900
    },
    {
      "id": 93950143,
      "payment_status": "paid",
      "shipping_status": "delivered",
      "total_amount": 503.99
    }
  ],
  "meta": {
    "count": {
      "total": 7,
      "current": 7,
      "start": 0,
      "limit": 20
    },
    "links": {
    "prev": null,
    "current": "/api/v2/orders?fields=id,payment_status,shipping_status,total_amount",
    "next": null
    }
  }
}

Adaugare comanda

Permite adaugarea unei noi inregistrari.

Tip: Creare resursa
Verb: POST
Url: /api/v2/orders

Codul http de raspuns este 200 in caz de succes, raspunsul va avea forma unei resurse individuale reprezentand inregistrarea care tocmai a fost adaugata.

Format request

Exemplu de request CURL care creeaza o noua comanda:

curl --request POST \
--url 'https://shop.demo.ro/api/v2/orders' \
--header 'Accept: application/json' \
--header 'Content-type: application/json' \
--header 'Authorization: Basic {base64-encoded-credentials}' \
--data-raw '{
    "payment_status": "awaiting",
    "payment_method_code": "cash_delivery",
    "shipping_status": "awaiting",
    "shipping_method_id": 0,
    "shipping_amount": null,
    "customer_id": 17,
    "customer_email": "sdsdsdsdsdsdsd@example.com",
    "billing_type": "individual",
    "billing_name": "John Smith",
    "billing_country_code": "RO",
    "billing_country_name": "România",
    "shipping_name": "John Smith",
    "shipping_country_code": "RO",
    "shipping_country_name": "Romania",
    "shipping_state": "Bucuresti",
    "shipping_city": "Bucuresti",
    "line_items": [
        {
            "item_type": "product",
            "product_id": 5087,
            "variant_id": 10004461,
            "variant_name": "Size: 39",
            "variant_options": [
                {
                    "id": 27884,
                    "name": "Size",
                    "value": "39"
                }
            ],
            "family_sku": "V01 nude pu",
            "product_sku": "V01 nude pu 39",
            "product_ean": null,
            "product_name": "Shoes Inko Nude 2",
            "product_url": "https://shop.demo.ro/cumpara?id=5087",
            "product_image_url": "https://shm-cdn.v1.ro/199135886/p/l/7/pantofi-inko-nude-2~4987.jpg",
            "product_tax_name": "TVA",
            "product_tax_percent": 19,
            "category_id": 6,
            "category_name": "Shoes",
            "manufacturer_id": 0,
            "quantity": 1,
            "unit_price_net": 91.6,
            "unit_tax_amount": 17.4,
            "unit_price_gross": 109,
            "line_subtotal_net": 91.6,
            "line_tax_amount": 17.4,
            "line_subtotal_gross": 109,
            "meta_fields": {
                "prod_id_ref": "7777060"
            }
        },
        {
            "item_type": "product",
            "product_id": 5088,
            "variant_id": 10002901,
            "variant_name": "Size: 35",
            "variant_options": [
                {
                    "id": 27884,
                    "name": "Size",
                    "value": "35"
                }
            ],
            "family_sku": "JA-1388-C BEIGE 2",
            "product_sku": "JA-1388-C BEIGE 2 35",
            "product_ean": null,
            "product_name": "Shoes Gabel Beige 2",
            "product_url": "https://shop.demo.ro/cumpara?id=5088",
            "product_image_url": "https://shm-cdn.v1.ro/199135886/p/l/8/pantofi-gabel-bej-2~4988.jpg",
            "product_tax_name": "TVA",
            "product_tax_percent": 19,
            "category_id": 6,
            "category_name": "Shoes",
            "manufacturer_id": 0,
            "quantity": 1,
            "unit_price_net": 57.98,
            "unit_tax_amount": 11.02,
            "unit_price_gross": 69,
            "line_subtotal_net": 57.98,
            "line_tax_amount": 11.02,
            "line_subtotal_gross": 69,
            "meta_fields": {
                "prod_id_ref": "7777061"
            }
        }
    ]
}'

Adaugare comanda

Exemplu request

POST /api/v2/orders
{
    "payment_status": "awaiting",
    "payment_method_code": "cash_delivery",
    "shipping_status": "awaiting",
    "shipping_method_id": 0,
    "shipping_amount": null,
    "customer_id": 17,
    "customer_email": "sdsdsdsdsdsdsd@example.com",
    "billing_type": "individual",
    "billing_name": "John Smith",
    "billing_country_code": "RO",
    "billing_country_name": "România",
    "shipping_name": "John Smith",
    "shipping_country_code": "RO",
    "shipping_country_name": "Romania",
    "shipping_state": "Bucuresti",
    "shipping_city": "Bucuresti",
    "line_items": [
        {
            "item_type": "product",
            "product_id": 5087,
            "variant_id": 10004461,
            "variant_name": "Size: 39",
            "variant_options": [
                {
                    "id": 27884,
                    "name": "Size",
                    "value": "39"
                }
            ],
            "family_sku": "V01 nude pu",
            "product_sku": "V01 nude pu 39",
            "product_ean": null,
            "product_name": "Shoes Inko Nude 2",
            "product_url": "https://shop.demo.ro/cumpara?id=5087",
            "product_image_url": "https://shm-cdn.v1.ro/199135886/p/l/7/pantofi-inko-nude-2~4987.jpg",
            "product_tax_name": "TVA",
            "product_tax_percent": 19,
            "category_id": 6,
            "category_name": "Shoes",
            "manufacturer_id": 0,
            "quantity": 1,
            "unit_price_net": 91.6,
            "unit_tax_amount": 17.4,
            "unit_price_gross": 109,
            "line_subtotal_net": 91.6,
            "line_tax_amount": 17.4,
            "line_subtotal_gross": 109,
            "meta_fields": {
                "prod_id_ref": "7777060"
            }
        },
        {
            "item_type": "product",
            "product_id": 5088,
            "variant_id": 10002901,
            "variant_name": "Size: 35",
            "variant_options": [
                {
                    "id": 27884,
                    "name": "Size",
                    "value": "35"
                }
            ],
            "family_sku": "JA-1388-C BEIGE 2",
            "product_sku": "JA-1388-C BEIGE 2 35",
            "product_ean": null,
            "product_name": "Shoes Gabel Beige 2",
            "product_url": "https://shop.demo.ro/cumpara?id=5088",
            "product_image_url": "https://shm-cdn.v1.ro/199135886/p/l/8/pantofi-gabel-bej-2~4988.jpg",
            "product_tax_name": "TVA",
            "product_tax_percent": 19,
            "category_id": 6,
            "category_name": "Shoes",
            "manufacturer_id": 0,
            "quantity": 1,
            "unit_price_net": 57.98,
            "unit_tax_amount": 11.02,
            "unit_price_gross": 69,
            "line_subtotal_net": 57.98,
            "line_tax_amount": 11.02,
            "line_subtotal_gross": 69,
            "meta_fields": {
                "prod_id_ref": "7777061"
            }
        }
    ]
}
Exemplu raspuns
{
    "id": 69291306,
    "payment_status": "awaiting",
    "payment_status_text": "Plata in asteptare",
    "payment_method_code": "cash_delivery",
    "payment_method_name": "Plata in sistem ramburs",
    "shipping_status": "awaiting",
    "shipping_status_text": "Comanda in asteptare",
    "shipping_method_id": 0,
    "shipping_method_name": null,
    "shipping_amount": null,
    "shipping_tax_amount": null,
    "total_amount": 178,
    "currency": "RON",
    "customer_id": 17,
    "customer_email": "sdsdsdsdsdsdsd@example.com",
    "customer_ip_address": "",
    "customer_ip_country": "",
    "customer_device": "desktop",
    "customer_lang": null,
    "customer_note": null,
    "customer_notification": null,
    "date_created": "2020-05-05T10:04:54+03:00",
    "date_modified": "2020-05-05T10:04:54+03:00",
    "created_by": "customer",
    "meta_fields": null,
    "tags": null,
    "billing_type": "individual",
    "billing_name": "John Smith",
    "billing_company_name": null,
    "billing_company_number": null,
    "billing_company_vat": null,
    "billing_company_bank_name": null,
    "billing_company_bank_account": null,
    "billing_country_code": "RO",
    "billing_country_name": "România",
    "billing_state": "Bucuresti",
    "billing_city": "Bucuresti",
    "billing_address": "",
    "billing_postal_code": "1000",
    "billing_phone": "",
    "shipping_name": "John Smith",
    "shipping_country_code": "RO",
    "shipping_country_name": "România",
    "shipping_state": "Bucuresti",
    "shipping_city": "Bucuresti",
    "shipping_address": null,
    "shipping_postal_code": null,
    "shipping_phone": null,
    "line_items": [
        {
            "product_id": 5087,
            "variant_id": 10004461,
            "family_sku": "V01 nude pu",
            "product_sku": "V01 nude pu 39",
            "product_ean": null,
            "product_name": "Shoes Inko Nude 2",
            "product_url": "https://shop.demo.ro/cumpara?id=5087",
            "product_image_url": "https://shm-cdn.v1.ro/199135886/p/l/7/pantofi-inko-nude-2~4987.jpg",
            "product_tax_name": "TVA",
            "product_tax_percent": 19,
            "category_id": 6,
            "category_name": "Shoes",
            "manufacturer_id": 0,
            "quantity": 1,
            "unit_price_net": 91.6,
            "unit_tax_amount": 17.4,
            "unit_price_gross": 109,
            "line_subtotal_net": 91.6,
            "line_tax_amount": 17.4,
            "line_subtotal_gross": 109,
            "meta_fields": {
                "prod_id_ref": "7777060"
            }
        },
        {
            "product_id": 5088,
            "variant_id": 10002901,
            "family_sku": "JA-1388-C BEIGE 2",
            "product_sku": "JA-1388-C BEIGE 2 35",
            "product_ean": null,
            "product_name": "Shoes Gabel Beige 2",
            "product_url": "https://shop.demo.ro/cumpara?id=5088",
            "product_image_url": "https://shm-cdn.v1.ro/199135886/p/l/8/pantofi-gabel-bej-2~4988.jpg",
            "product_tax_name": "TVA",
            "product_tax_percent": 19,
            "category_id": 6,
            "category_name": "Shoes",
            "manufacturer_id": 0,
            "quantity": 1,
            "unit_price_net": 57.98,
            "unit_tax_amount": 11.02,
            "unit_price_gross": 69,
            "line_subtotal_net": 57.98,
            "line_tax_amount": 11.02,
            "line_subtotal_gross": 69,
            "meta_fields": {
                "prod_id_ref": "7777061"
            }
        }
    ],
    "invoice": null,
    "info_url": "https://shop.demo.ro/comanda/info/f3b941970c87ce44033586413c2dec92/69291306",
    "proforma_url": "https://shop.demo.ro/comanda/proforma/f3b941970c87ce44033586413c2dec92/69291306"
}

Modificare date comanda

Permite actualizarea unei inregistrari existente pe baza de ID.

Tip: Actualizare resursa
Verb: PATCH
Url: /api/v2/orders/{id}

Codul http de raspuns este 200 in caz de succes, raspunsul va avea forma unei resurse individuale reprezentand inregistrarea care tocmai a fost actualizata.

Format request

Exemplu de request CURL care actualizeaza o inregistrare existenta:

curl --request PATCH \
--url 'https://shop.demo.ro/api/v2/orders/12345001' \
--header 'Accept: application/json' \
--header 'Content-type: application/json' \
--header 'Authorization: Basic {base64-encoded-credentials}' \
--data-raw '{
  "shipping_method_id": 101,
  "shipping_amount": 15
}'

Actualizare date comanda

Exemplu request

PATCH /api/v2/orders/{id}
{
  "shipping_method_id": 101,
  "shipping_amount": 15,
  "tags": [
    {
      "name": "Feedback excelent"
    }
  ]
}
Exemplu raspuns
{
  "id": 12345001,
  "parent_id": 61001305,
  "payment_status": "cancelled",
  "payment_status_text": "Plata anulata",
  "payment_method_code": "cash_delivery",
  "payment_method_name": "Plata in sistem ramburs",
  "shipping_status": "cancelled",
  "shipping_status_text": "Comanda anulata",
  "shipping_method_id": 101,
  "shipping_method_name": null,
  "shipping_amount": 15,
  "shipping_tax_amount": 0,
  "total_amount": 13394.85,
  "currency": "RON",
  "customer_id": 3,
  "customer_email": "234242424242@example.net",
  "customer_ip_address": "95.77.99.177",
  "customer_ip_country": "RO",
  "customer_device": "desktop",
  "customer_lang": "ro_RO",
  "customer_note": null,
  "customer_notification": "",
  "date_created": "2020-01-13T13:34:15+02:00",
  "date_modified": "2020-05-02T10:50:12+03:00",
  "created_by": "customer",
  "meta_fields": null,
  "tags": [
    {
      "id": 1,
      "name": "Feedback excelent"
    }
  ],
  "billing_type": "individual",
  "billing_name": "John Smith",
  "billing_company_name": null,
  "billing_company_number": null,
  "billing_company_vat": null,
  "billing_company_bank_name": null,
  "billing_company_bank_account": null,
  "billing_country_code": "RO",
  "billing_country_name": "România",
  "billing_state": "Bucuresti",
  "billing_city": "Bucuresti",
  "billing_address": "str Rose Hill, nr. 45",
  "billing_postal_code": "",
  "billing_phone": "0212112121",
  "shipping_name": "John Smith",
  "shipping_country_code": "RO",
  "shipping_country_name": "România",
  "shipping_state": "Bucuresti",
  "shipping_city": "Bucuresti",
  "shipping_address": "str Rose Hill, nr. 45",
  "shipping_postal_code": "",
  "shipping_phone": "0212112121",
  "line_items": [
    {
      "item_type": "product",
      "product_id": 53,
      "product_sku": null,
      "product_ean": null,
      "product_name": "Floral Laser Suede Dress",
      "product_url": "https://shop.demo.ro/cumpara?id=53",
      "product_image_url": "https://shm-cdn.v1.ro/283342624/p/l/9/floral-laser-suede-dress~169.jpg",
      "product_tax_name": "TVA",
      "product_tax_percent": 19,
      "category_id": 9,
      "category_name": "Rochii",
      "manufacturer_id": 1000017,
      "manufacturer_name": "Michael Kors",
      "quantity": 15,
      "unit_price_net": 891.99,
      "unit_tax_amount": 0,
      "unit_price_gross": 891.99,
      "line_subtotal_net": 13379.85,
      "line_tax_amount": 0,
      "line_subtotal_gross": 13379.85
    }
  ],
  "invoice": {
    "prefix": "SERIE",
    "number": "0000010",
    "app": "billing",
    "cancelled": false,
    "url": "https://shop.demo.ro/comanda/invoice/2e8b8a4802eb3b5d1c8f381b2c20a0ea/52527708"
  },
  "info_url": "https://shop.demo.ro/comanda/info/6962541174d3099d2dc6b0cd902d3601/12345001",
  "proforma_url": "https://shop.demo.ro/comanda/proforma/6962541174d3099d2dc6b0cd902d3601/12345001"
}

Procesare comanda

Permite procesare unei inregistrari existente pe baza de ID.

Tip: Actualizare resursa
Verb: PATCH
Url: /api/v2/orders/{id}/{request_handler}

Codul http de raspuns este 200 in caz de succes.

Schimbare status livrare (comanda in procesare)

Exemplu request

PATCH /api/v2/orders/{id}/in_process
Exemplu raspuns
{
  "ok": true
}

Schimbare status livrare (comanda expediata)

Exemplu request

PATCH /api/v2/orders/{id}/shipped
Exemplu raspuns
{
  "ok": true
}

Schimbare status livrare (comanda livrata)

Exemplu request

PATCH /api/v2/orders/{id}/delivered
Exemplu raspuns
{
  "ok": true
}

Schimbare status livrare (comanda returnata)

Exemplu request

PATCH /api/v2/orders/{id}/returned
Exemplu raspuns
{
  "ok": true
}

Anulare comanda

Exemplu request

PATCH /api/v2/orders/{id}/cancelled
Exemplu raspuns
{
  "ok": true
}

Emitere factura

Exemplu request

PATCH /api/v2/orders/{id}/create_invoice
Exemplu raspuns
{
  "ok": true
}

Stergere comanda

Permite stergerea unei inregistrari existente pe baza de ID.

Tip: Stergere resursa
Verb: DELETE
Url: /api/v2/orders/{id}

Codul http de raspuns este 200 in caz de succes, raspunsul va avea forma unei resurse individuale reprezentand inregistrarea care tocmai a fost stearsa.

Format request

Exemplu de request CURL care sterge o inregistrare existenta:

curl --request DELETE \
--url 'https://shop.demo.ro/api/v2/orders/12345001' \
--header 'Accept: application/json' \
--header 'Content-type: application/json' \
--header 'Authorization: Basic {base64-encoded-credentials}'

Stergere comanda impreuna cu toate datele aferente acesteia

Exemplu request

DELETE /api/v2/orders/{id}
Exemplu raspuns
{
  "ok": true
}
Ultima modificare: 20 Dec 2023
Te-a ajutat acest articol?
Mai ai nevoie si de alte informatii?
Confidentialitate
Utilizam cookie-uri pentru a-ti oferi serviciile si pentru a-ti optimiza experienta. Navigand in continuare, iti exprimi acordul cu privire la Politica de Cookies.