POST
/
v1
/
:customer
/
orders
Criando Pedidos
curl --request POST \
  --url https://lojinha.dev/api/v1/:customer/orders \
  --header 'Authorization: Bearer <token>' \
  --header 'Content-Type: application/json' \
  --data '{
  "id": "<string>",
  "address": "<string>",
  "products": [
    {
      "id": "<string>",
      "quantity": 123
    }
  ]
}'
{
  "order": {
    "id": "4f24a75c-792a-4aff-9265-19deb198be07",
    "store": "org_2StqHEqEqKtCH66IJjLb73J2ww6",
    "customerId": "7b16fb4f-6c54-4f7c-a751-3027b451b4ed",
    "addressId": "96c0e914-0094-4694-b735-a54633f8dfbc",
    "price": 8000,
    "originalPrice": null,
    "status": "CREATED",
    "createdAt": "2023-07-23T22:04:52.234Z",
    "updatedAt": "2023-07-24T15:00:44.852Z",
    "deletedAt": null,
    "products": [
      {
        "id": "4cf35a0f-7f25-43ef-8e5e-208fbfeb1bd0",
        "store": "org_2StqHEqEqKtCH66IJjLb73J2ww6",
        "status": "ACTIVE",
        "name": "A Tormenta de Espadas",
        "slug": "a-tormenta-de-espadas",
        "description": "<p>Terceiro livro da série</p>",
        "price": 8000,
        "originalPrice": 12000,
        "quantity": 9,
        "sku": "LI-004",
        "createdAt": "2023-07-22T00:51:44.685Z",
        "updatedAt": "2023-07-24T02:09:03.948Z",
        "deletedAt": null,
        "order": {
          "quantity": 1,
          "price": 8000
        }
      }
    ],
    "address": {
      "id": "96c0e914-0094-4694-b735-a54633f8dfbc",
      "customerId": "7b16fb4f-6c54-4f7c-a751-3027b451b4ed",
      "alias": "Casa",
      "zipcode": "87045-700",
      "street": "Praça Pioneiro Antônio Laurentino Tavares",
      "state": "PR",
      "city": "Maringá",
      "country": "Brasil",
      "neightborhood": "Jd. América",
      "number": "200",
      "complement": "Casa Azul",
      "createdAt": "2023-07-24T14:46:19.941Z",
      "updatedAt": null,
      "deletedAt": null
    }
  }
}

URL

customer
uuid
required
ID do cliente.

Body

O ID do carrinho só é necessário se você estiver criando um pedido de um carrinho já exitente, caso você não informe um id de carrinho é obrigatório passar uma lista de produtos no campo products, você não pode passar os dois parametros ao mesmo tempo.
id
uuid
ID do carrinho se existir
address
uuid
ID do endereço do cliente.
products
array
Lista de produtos a serem adicionados

Resposta

order
object
{
  "order": {
    "id": "4f24a75c-792a-4aff-9265-19deb198be07",
    "store": "org_2StqHEqEqKtCH66IJjLb73J2ww6",
    "customerId": "7b16fb4f-6c54-4f7c-a751-3027b451b4ed",
    "addressId": "96c0e914-0094-4694-b735-a54633f8dfbc",
    "price": 8000,
    "originalPrice": null,
    "status": "CREATED",
    "createdAt": "2023-07-23T22:04:52.234Z",
    "updatedAt": "2023-07-24T15:00:44.852Z",
    "deletedAt": null,
    "products": [
      {
        "id": "4cf35a0f-7f25-43ef-8e5e-208fbfeb1bd0",
        "store": "org_2StqHEqEqKtCH66IJjLb73J2ww6",
        "status": "ACTIVE",
        "name": "A Tormenta de Espadas",
        "slug": "a-tormenta-de-espadas",
        "description": "<p>Terceiro livro da série</p>",
        "price": 8000,
        "originalPrice": 12000,
        "quantity": 9,
        "sku": "LI-004",
        "createdAt": "2023-07-22T00:51:44.685Z",
        "updatedAt": "2023-07-24T02:09:03.948Z",
        "deletedAt": null,
        "order": {
          "quantity": 1,
          "price": 8000
        }
      }
    ],
    "address": {
      "id": "96c0e914-0094-4694-b735-a54633f8dfbc",
      "customerId": "7b16fb4f-6c54-4f7c-a751-3027b451b4ed",
      "alias": "Casa",
      "zipcode": "87045-700",
      "street": "Praça Pioneiro Antônio Laurentino Tavares",
      "state": "PR",
      "city": "Maringá",
      "country": "Brasil",
      "neightborhood": "Jd. América",
      "number": "200",
      "complement": "Casa Azul",
      "createdAt": "2023-07-24T14:46:19.941Z",
      "updatedAt": null,
      "deletedAt": null
    }
  }
}