Documentação Carrinho de Compras Provedor - Manual API Checkout
Esse documento explica com exemplos de uso de nossa API REST a criação e finalização de carrinho de compras.
Requisições POST devem ter o header “Content-Type“ com o valor “application/vnd.api+json“ para evitar erros na criação de itens
Pré-checagem
Pegar informações de um endereço pelo CEP
Checagem inicial de cobertura na cidade do cliente
Checagem financeira
KMZ
Pegar coordenadas de um endereço
Pegar endereço pelas coordenadas
Verificar cobertura de um endereço
Checkout
Pegar ID do Revendedor
Salvar endereço do cliente
Criação de carrinho
Pegar contratos disponíveis
Pegar os planos disponíveis
Adição de produto no carrinho
Pegar os adicionais de um produto
Remoção de um produto do carrinho
Pegar carrinho
Aplicar cupom
Remover cupom
Pegar dados do "Como você chegou até nós?"
Pegar bancos
Pegar datas de vencimento de uma cidade
Pegar termos de um carrinho
Pegar documentos necessários
Atualizar o carrinho
Conversão em pedido
Pré-checagem:
Pegar informações de um endereço pelo CEP:
Possibilita pegar informações como rua, bairro, cidade e outras informações a partir do CEP.
Endpoint: GET /api/address/{CEP}/postal_code/
Parâmetros:
CEP | CEP que deseja buscar as informações | String |
|---|
Exemplo de resposta:
{
"data": {
"type": "Address",
"id": null,
"attributes": {
"nickname": "",
"first_name": "",
"last_name": "",
"company_name": "",
"number": "",
"street_address_1": "Avenida José Antônio Lorenzetti",
"street_address_2": "",
"street_address_3": "Jardim São João",
"city": "Lençóis Paulista",
"state": "SP",
"postal_code": "18680-410",
"country": null,
"country_area": "",
"phone": "",
"is_default": false,
"type": null,
"latitude": "",
"longitude": ""
}
}
}
Checagem inicial de cobertura na cidade do cliente:
Permite fazer uma verificação se existe cobertura em uma cidade, pelo CEP.
Endpoint: GET /api/provider/city/{CEP}/postal_code/
Parâmetros:
CEP | CEP que deseja verificar | String |
|---|
Exemplo de resposta:
Caso exista cobertura, retornará as informações do CEP, com o status 200:
{
"data": {
"type": "City",
"id": "11",
"attributes": {
"neighborhood": "Jardim São João",
"state": "SP",
"postal_code": "18680-410",
"street": "Avenida José Antônio Lorenzetti",
"created": "2021-08-19T19:37:43.708091-03:00",
"updated": "2022-02-16T17:31:40.001758-02:00",
"name": "Lençóis Paulista",
"short_name": "Lençóis Paulista",
"code": "lencoisPaulista",
"lat": "-22.6036000",
"long": "-48.7975000",
"redirect_url": null,
"due_date": null,
"is_neighborhood": false,
"neighborhood_name": null
},
"relationships": {
"postal_codes": {
"meta": {
"count": 0
},
"data": [],
"links": {
"self": "http://devisp.datacake.com.br/api/provider/city/11/relationships/postal_codes/",
"related": "http://devisp.datacake.com.br/api/provider/city/11/postal_codes/"
}
},
"streets": {
"meta": {
"count": 0
},
"data": [],
"links": {
"self": "http://devisp.datacake.com.br/api/provider/city/11/relationships/streets/",
"related": "http://devisp.datacake.com.br/api/provider/city/11/streets/"
}
},
"due_dates": {
"meta": {
"count": 9
},
"data": [
{
"type": "DueDate",
"id": "6"
},
{
"type": "DueDate",
"id": "5"
},
{
"type": "DueDate",
"id": "4"
},
{
"type": "DueDate",
"id": "3"
},
{
"type": "DueDate",
"id": "2"
},
{
"type": "DueDate",
"id": "1"
},
{
"type": "DueDate",
"id": "8"
},
{
"type": "DueDate",
"id": "7"
},
{
"type": "DueDate",
"id": "9"
}
],
"links": {
"self": "http://devisp.datacake.com.br/api/provider/city/11/relationships/due_dates/",
"related": "http://devisp.datacake.com.br/api/provider/city/11/due_dates/"
}
},
"products": {
"meta": {
"count": 3
},
"data": [
{
"type": "Product",
"id": "51"
},
{
"type": "Product",
"id": "50"
},
{
"type": "Product",
"id": "42"
}
],
"links": {
"self": "http://devisp.datacake.com.br/api/provider/city/11/relationships/products/",
"related": "http://devisp.datacake.com.br/api/provider/city/11/products/"
}
},
"integration": {
"links": {
"self": "http://devisp.datacake.com.br/api/provider/city/11/relationships/integration/",
"related": "http://devisp.datacake.com.br/api/provider/city/11/integration/"
},
"data": {
"type": "Integration",
"id": "9"
}
}
}
}
}Caso não exista cobertura no CEP informado, retornara uma mensagem de erro, com o status 404:
{
"errors": [
{
"detail": "Desculpe, infelizmente não temos cobertura na cidade Manaus CEP:69015-754",
"status": "404",
"source": {
"pointer": "/data"
},
"code": "not_found"
}
]
}
Checagem financeira
Permite verificar se o usuário possui restriçoes, não é ativado em todos os nossos clientes, então deve ser uma configuração “Liga/Desliga” na hora de vocês implementarem.
Endpoint: POST /api/store/cart/pre_check/
Atributos:
taxvat | CPF | String |
|---|---|---|
token | Token do carrinho | String |
stop_invalid_taxvat | Parar se o CPF for invalido | Boolean |
Exemplo:
Body:
{
"taxvat": "452.099.670-85",
"token": "5b2a6a6c-8797-466e-b430-2100cad7fbd9",
"stop_invalid_taxvat": true
}
KMZ:
Pegar coordenadas de um endereço:
Possibilita pegar as coordenas de um local pelo endereço.
Endpoint: POST /api/provider/coverage/geocode/
Atributos:
street_address_1 | Rua | String |
|---|---|---|
street_address_3 | Bairro | String |
address_number | Número | String |
postal_code | CEP | String |
state | Estado (sigla) | String |
city | Cidade | String |
Exemplo:
Body:
{
"data": {
"type": "Coverage",
"attributes": {
"street_address_1": "Avenida José Antônio Lorenzetti",
"street_address_3": "Jardim São João",
"address_number": "0",
"postal_code": "18680-410",
"state": "SP",
"city": "Lençóis Paulista"
}
}
}Resposta:
{
"data": {
"street_address_1": "Avenida José Antônio Lorenzetti",
"street_address_3": "Jardim São João",
"address_number": "0",
"postal_code": "18680-410",
"state": "SP",
"city": "Lençóis Paulista",
"latitude": -22.5879666,
"longitude": -48.7980126
}
}
Pegar endereço pelas coordenadas:
Permite pegas as informações de um endereço através de coordenadas
Endpoint: POST /api/provider/coverage/address/
Atributos:
latitude |
| Number |
|---|---|---|
longitude |
| Number |
Exemplo:
Body:
{
"data": {
"type": "Coverage",
"attributes": {
"latitude": -22.5879666,
"longitude": -48.7980126
}
}
}Resposta:
{
"data": {
"address": "R. Nicolau Dias Batista",
"number": "1",
"neighborhood": "Parque Res. Elizabeth",
"city": "Lençóis Paulista",
"state": "SP",
"country": "BR",
"postal_code": "18680-440"
}
}
Verificar cobertura de um endereço:
Permite verificar se existe cobertura em um endereço
Endpoint: POST /api/provider/coverage/check_coverage/
Atributos:
street_address_1 | Rua | String |
|---|---|---|
street_address_3 | Bairro | String |
address_number | Número | String |
postal_code | CEP | String |
state | Estado (sigla) | String |
city | Cidade | String |
latitude | Latitude | Number |
longitude | Longitude | Number |
Exemplo:
Body:
{
"data": {
"type": "Coverage",
"attributes": {
"street_address_1": "Rua Paraná",
"street_address_3": "Jardim Cruzeiro",
"address_number": "222",
"postal_code": "18680-510",
"state": "SP",
"city": "Lençóis Paulista",
"latitude": -22.5885833,
"longitude": -48.7980126
}
}
}Caso tenha cobertura retornara o status 200:
{
"data": {
"coverage": {
"polygons": [
{
"name": "LENÇÓIS",
"source": "KMZ"
}
]
}
}
}Caso não tenha cobertura retornará uma mensagem de erro, e o status 400:
{
"errors": [
{
"detail": "No Coverage",
"status": "400",
"source": {
"pointer": "/data"
},
"code": "400001"
}
]
}
Checkout:
Salvar endereço do cliente:
Permite salvar um endereço
Endpoint: POST /api/address/
Atributos:
first_name | Nome | String |
|---|---|---|
last_name | Sobrenome | String |
city | Cidade | String |
number | Número | String |
street_address_1 | Rua | String |
street_address_2 | Complemento | String |
street_address_3 | Bairro | String |
state | Estado (sigla) | String |
postal_code | CEP | String |
country | Pais (sigla) | String |
country_area | Pais (sigla) | String |
Exemplo:
Body:
{
"data": {
"type": "Address",
"attributes": {
"first_name": "Nome",
"last_name": "Sobrenome",
"city": "Lençóis Paulista",
"number": "999",
"street_address_1": "Rua São Pedro",
"street_address_2": "",
"street_address_3": "Centro",
"state": "SP",
"postal_code": "18680-049",
"country": "BR",
"country_area": "BR"
}
}
}Resposta:
{
"data": {
"type": "Address",
"id": "723",
"attributes": {
"created": "2022-02-24T14:55:28.492506-03:00",
"updated": "2022-02-24T14:55:28.492572-03:00",
"nickname": "",
"first_name": "Nome",
"last_name": "Sobrenome",
"company_name": null,
"number": "999",
"street_address_1": "Rua São Pedro",
"street_address_2": "",
"street_address_3": "Centro",
"city": "Lençóis Paulista",
"state": "SP",
"postal_code": "18680-049",
"country": "BR",
"country_area": "BR",
"phone": "",
"is_default": null,
"type": "billing",
"latitude": "",
"longitude": ""
},
"relationships": {
"user": {
"links": {
"self": "http://devisp.datacake.com.br/api/address/723/relationships/user/",
"related": "http://devisp.datacake.com.br/api/address/723/user/"
},
"data": null
}
}
}
}
Pegar ID do Revendedor:
Permite encontrar o ID do Revendedor buscando por CPF/CNPJ
Endpoint: GET /api/provider/reseller/{cpf}/by_taxvat/
Resposta:
{
"data": {
"type": "Reseller",
"id": "5493",
"attributes": {
"open_comission_requests_amount": 0.0,
"order_count": 0,
"created": "2023-04-10T16:57:58.626363-03:00",
"updated": "2023-05-26T15:42:42.607412-03:00",
"name": "Revendedor Datacake",
"taxvat": "993.464.350-20",
"email": "Emailteste@gmail.com",
"is_employee": false,
"active": true,
"order_goal": 0,
"internal_reseller_code": null,
"staff": null,
"responsible_email": null
},
"relationships": {
"comission_rule": {
"links": {
"self": "http://devisp.datacake.com.br/api/provider/reseller/5493/relationships/comission_rule/"
},
"data": null
},
"orders": {
"meta": {
"count": 0
},
"data": [],
"links": {
"self": "http://devisp.datacake.com.br/api/provider/reseller/5493/relationships/orders/"
}
},
"reseller_group": {
"links": {
"self": "http://devisp.datacake.com.br/api/provider/reseller/5493/relationships/reseller_group/"
},
"data": null
},
"user": {
"links": {
"self": "http://devisp.datacake.com.br/api/provider/reseller/5493/relationships/user/"
},
"data": {
"type": "User",
"id": "2"
}
}
}
}
}
Criação de carrinho:
Permite criar o carrinho, para iniciar o processo de compra.
Endpoint: POST /api/store/cart/?include=billing_address,shipping_address
Atributos:
extra_data |
| JSON |
|---|---|---|
String |
Atributos do “extra_data”:
resseller_id | ID do Revendedor | String |
|---|---|---|
mobile | Número de telefone | String |
paymentType | Tipo de pagamento | String |
current_step | Etapa atual do checkout | String |
current_wizard_step | Subetapa atual do checkout | String |
condo | Condominio | String |
condo_number | Número do condominio | String |
plan_type_id | ID do tipo de plano | String |
customer_type | Tipo de usuario (novo ou velho) | String |
city_id | ID da cidade | String |
is_migration | É migração | Boolean |
city_has_radio | Cidade tem radio | Boolean |
city_has_fiber | Cidade tem fibra | Boolean |
city_has_phone | Cidade tem telefone | Boolean |
city_has_tv | Cidade tem tv | Boolean |
cpf | CPF | String |
migration_type | Tipo de migração (apenas se for migração) | String |
has_hidden_product | Existe produto oculto | Boolean |
Atributos do “relationships”:
billing_address | ID do endereço do cliente criado anteriormente |
|---|---|
shipping_address | ID do endereço do cliente criado anteriormente |
Exemplo de uso:
Body:
{
"data": {
"relationships": {
"billing_address": {
"data": {
"type": "Address",
"id": "675"
}
},
"shipping_address": {
"data": {
"type": "Address",
"id": "675"
}
}
},
"type": "Cart",
"attributes": {
"extra_data": {
"reseller_id": "53",
"mobile": "(14) 98198-3853",
"paymentType": "email",
"current_step": "0",
"current_wizard_step": "1",
"condo": "",
"condo_number": "",
"plan_type_id": "1",
"customer_type": "new",
"city_id": "11",
"is_migration": false,
"city_has_radio": false,
"city_has_fiber": false,
"city_has_phone": false,
"city_has_tv": false,
"cpf": "993.464.350-20",
"migration_type": null,
"has_hidden_product": false
},
"email": "Emailteste@gmail.com"
}
}
}Resposta:
{
"data": {
"type": "Cart",
"id": "1108",
"attributes": {
"taxes": "0.00",
"discount": "-0.00",
"monthly_period_availability": 0,
"savings": null,
"shipping_method_extra_data": null,
"total": "0.00",
"available_shipping_methods": null,
"shipping_price": "0.00",
"has_variable_weight": false,
"total_without_monthly_period": "0.00",
"total_weight": "0.0 kg",
"total_monthly_period": {},
"is_shipping_required": false,
"extra_data": {
"mobile": "(14) 98198-3853",
"paymentType": "email",
"current_step": "0",
"current_wizard_step": "1",
"condo": "",
"condo_number": "",
"plan_type_id": "1",
"customer_type": "new",
"city_id": "11",
"is_migration": false,
"city_has_radio": false,
"city_has_fiber": false,
"city_has_phone": false,
"city_has_tv": false,
"cpf": "993.464.350-20",
"migration_type": null,
"has_hidden_product": false
},
"payment_method_extra_data": null,
"fees": "0.00",
"subtotal": "0.00",
"created": "2022-02-24T15:13:30.871781-03:00",
"updated": "2022-02-24T15:13:30.871882-03:00",
"email": "Emailteste@gmail.com",
"token": "5344e087-8101-4d60-bdd2-adc827ebd9a6",
"total_quantity": 0,
"status": "active",
"booking_deadline": null,
"note": "",
"voucher_code": null
},
"relationships": {
"shipping_method": {
"links": {
"self": "http://devisp.datacake.com.br/api/store/cart/1108/relationships/shipping_method/",
"related": "http://devisp.datacake.com.br/api/store/cart/1108/shipping_method/"
},
"data": null
},
"payment_method": {
"links": {
"self": "http://devisp.datacake.com.br/api/store/cart/1108/relationships/payment_method/",
"related": "http://devisp.datacake.com.br/api/store/cart/1108/payment_method/"
},
"data": null
},
"warehouse": {
"links": {
"self": "http://devisp.datacake.com.br/api/store/cart/1108/relationships/warehouse/",
"related": "http://devisp.datacake.com.br/api/store/cart/1108/warehouse/"
},
"data": null
},
"billing_address": {
"links": {
"self": "http://devisp.datacake.com.br/api/store/cart/1108/relationships/billing_address/",
"related": "http://devisp.datacake.com.br/api/store/cart/1108/billing_address/"
},
"data": {
"type": "Address",
"id": "675"
}
},
"items": {
"meta": {
"count": 0
},
"data": [],
"links": {
"self": "http://devisp.datacake.com.br/api/store/cart/1108/relationships/items/",
"related": "http://devisp.datacake.com.br/api/store/cart/1108/items/"
}
},
"user": {
"links": {
"self": "http://devisp.datacake.com.br/api/store/cart/1108/relationships/user/",
"related": "http://devisp.datacake.com.br/api/store/cart/1108/user/"
},
"data": null
},
"shipping_address": {
"links": {
"self": "http://devisp.datacake.com.br/api/store/cart/1108/relationships/shipping_address/",
"related": "http://devisp.datacake.com.br/api/store/cart/1108/shipping_address/"
},
"data": {
"type": "Address",
"id": "675"
}
},
"terms": {
"meta": {
"count": 1
},
"data": [
{
"type": "CartTerm",
"id": "7"
}
],
"links": {
"self": "http://devisp.datacake.com.br/api/store/cart/1108/relationships/terms/",
"related": "http://devisp.datacake.com.br/api/store/cart/1108/terms/"
}
},
"origin": {
"links": {
"self": "http://devisp.datacake.com.br/api/store/cart/1108/relationships/origin/",
"related": "http://devisp.datacake.com.br/api/store/cart/1108/origin/"
},
"data": null
},
"contract_period": {
"links": {
"self": "http://devisp.datacake.com.br/api/store/cart/1108/relationships/contract_period/",
"related": "http://devisp.datacake.com.br/api/store/cart/1108/contract_period/"
},
"data": null
},
"booking_slot": {
"links": {
"self": "http://devisp.datacake.com.br/api/store/cart/1108/relationships/booking_slot/",
"related": "http://devisp.datacake.com.br/api/store/cart/1108/booking_slot/"
},
"data": null
}
}
},
"included": [
{
"type": "Address",
"id": "675",
"attributes": {
"created": "2022-02-22T14:53:34.543509-03:00",
"updated": "2022-02-23T11:48:05.886913-03:00",
"nickname": "",
"first_name": "Nome",
"last_name": "Sobrenome",
"company_name": null,
"number": "198",
"street_address_1": "Rua São Pedro",
"street_address_2": "Casa",
"street_address_3": "Centro",
"city": "Lençóis Paulista",
"state": "SP",
"postal_code": "18680-049",
"country": "BR",
"country_area": "BR",
"phone": "",
"is_default": null,
"type": "billing",
"latitude": "",
"longitude": ""
},
"relationships": {
"user": {
"links": {
"self": "http://devisp.datacake.com.br/api/address/675/relationships/user/",
"related": "http://devisp.datacake.com.br/api/address/675/user/"
},
"data": null
}
}
}
]
}
Pegar contratos disponíveis:
Permite obter os contratos disponíveis.
Endpoint: GET /api/store/cart-contract-period/get_cart_contract_period/
Exemplo de resposta:
{
"data": [
{
"type": "CartContractPeriod",
"id": "1",
"attributes": {
"created": "2021-02-18T11:09:49.264456-02:00",
"updated": "2021-02-18T11:09:49.264505-02:00",
"all_carts": true,
"enabled": true,
"content": "Sem Fidelidade",
"position": 0
},
"relationships": {
"products": {
"meta": {
"count": 0
},
"data": [],
"links": {
"self": "/api/store/cart-term/1/relationships/products/",
"related": "/api/store/cart-term/1/products/"
}
}
}
},
{
"type": "CartContractPeriod",
"id": "2",
"attributes": {
"created": "2021-02-18T11:10:04.494635-02:00",
"updated": "2021-02-18T11:10:04.494686-02:00",
"all_carts": true,
"enabled": true,
"content": "1 ano",
"position": 1
},
"relationships": {
"products": {
"meta": {
"count": 0
},
"data": [],
"links": {
"self": "/api/store/cart-term/2/relationships/products/",
"related": "/api/store/cart-term/2/products/"
}
}
}
},
{
"type": "CartContractPeriod",
"id": "3",
"attributes": {
"created": "2022-01-04T11:39:01.915108-02:00",
"updated": "2022-01-04T11:39:01.915190-02:00",
"all_carts": true,
"enabled": true,
"content": "2 anos",
"position": 2
},
"relationships": {
"products": {
"meta": {
"count": 0
},
"data": [],
"links": {
"self": "/api/store/cart-term/3/relationships/products/",
"related": "/api/store/cart-term/3/products/"
}
}
}
}
]
}
Pegar os planos disponíveis:
Possibilita pegar os planos disponíveis na cidade
Endpoint: GET /api/store/product/?page[number]={page_number}&page[size]={page_size}&include=product_type&city__id={city__id}&restricted_customers={restricted_customers}
Parâmetros:
page[size] | Quantidades de itens por página | Number |
|---|---|---|
page[number] | Qual página deseja pegas as informações | Number |
city__id | ID da cidade que desaja pegar os planos | Number |
restricted_customers | TRUE se o usuario tiver restrição | Boolean |
Exemplo:
Resposta:
{
"links": {
"first": "http://devisp.datacake.com.br/api/store/product/?city__id=11&fields=product_type%2Cid%2Cname%2Csku%2Cdescription%2Cpricing_list%2Cvisibility%2Cpricing_sale%2Cproduct_class%2Cdata%2Cpositon%2Cpricing_sorting%2Cchannel_count%2Cchannel_hd_count&include=product_type&page%5Bnumber%5D=1",
"last": "http://devisp.datacake.com.br/api/store/product/?city__id=11&fields=product_type%2Cid%2Cname%2Csku%2Cdescription%2Cpricing_list%2Cvisibility%2Cpricing_sale%2Cproduct_class%2Cdata%2Cpositon%2Cpricing_sorting%2Cchannel_count%2Cchannel_hd_count&include=product_type&page%5Bnumber%5D=1",
"next": null,
"prev": null
},
"data": [
{
"type": "Product",
"id": "51",
"attributes": {
"pricing_sorting": "9.99",
"pricing_list": "9.99",
"data": {
"thumbnail": null,
"max_on_cart": "1",
"checkout_icon": null,
"multiple_on_cart": false,
"free_extra_tv_decoder": null,
"paid_extra_tv_decoder": null
},
"pricing_sale": null,
"sku": "in-opc-001",
"name": "Opcional de teste",
"description": "Opcional de teste",
"visibility": "all",
"product_class": "addon",
"channel_count": 0,
"channel_hd_count": 0
},
"relationships": {
"product_type": {
"links": {
"self": "http://devisp.datacake.com.br/api/store/product/51/relationships/product_type/",
"related": "http://devisp.datacake.com.br/api/store/product/51/product_type/"
},
"data": {
"type": "ProductType",
"id": "1"
}
}
}
},
{
"type": "Product",
"id": "50",
"attributes": {
"pricing_sorting": "49.99",
"pricing_list": "49.99",
"data": {
"ribbon": null,
"upload": "20",
"download": "100",
"sub_title": null,
"thumbnail": null,
"upload_icon": null,
"addon_icon_1": null,
"addon_icon_2": null,
"addon_icon_3": null,
"addon_icon_4": null,
"addon_text_1": null,
"addon_text_2": null,
"addon_text_3": null,
"addon_text_4": null,
"checkout_icon": null,
"display_title": "Internet",
"download_icon": null,
"franquia_dado": null,
"is_best_seller": null,
"addon_icon_cart_1": null,
"addon_icon_cart_2": null,
"addon_icon_cart_3": null,
"addon_icon_cart_4": null,
"addon_text_cart_1": null,
"addon_text_cart_2": null,
"addon_text_cart_3": null,
"addon_text_cart_4": null,
"short_description": null
},
"pricing_sale": null,
"sku": "int-normal-lp",
"name": "Internet Normalzinha",
"description": "Internet normal",
"visibility": "all",
"product_class": "simple",
"channel_count": 0,
"channel_hd_count": 0
},
"relationships": {
"product_type": {
"links": {
"self": "http://devisp.datacake.com.br/api/store/product/50/relationships/product_type/",
"related": "http://devisp.datacake.com.br/api/store/product/50/product_type/"
},
"data": {
"type": "ProductType",
"id": "4"
}
}
}
},
{
"type": "Product",
"id": "42",
"attributes": {
"pricing_sorting": "99.90",
"pricing_list": "99.90",
"data": {
"display_title": "<span class=\"prefix\">CONNECT</span><span class=\"title\">TV TOTAL</span>",
"free_extra_tv_decoder": null,
"paid_extra_tv_decoder": null
},
"pricing_sale": null,
"sku": "hdtv-a",
"name": "HDTV TURBO",
"description": "",
"visibility": "all",
"product_class": "simple",
"channel_count": 0,
"channel_hd_count": 0
},
"relationships": {
"product_type": {
"links": {
"self": "http://devisp.datacake.com.br/api/store/product/42/relationships/product_type/",
"related": "http://devisp.datacake.com.br/api/store/product/42/product_type/"
},
"data": {
"type": "ProductType",
"id": "2"
}
}
}
}
],
"included": [
{
"type": "ProductType",
"id": "1",
"attributes": {
"weight": "0.0 kg",
"created": "2021-01-12T00:20:22.905445-02:00",
"updated": "2021-01-12T00:20:22.905479-02:00",
"product_class": "addon",
"name": "Opcionais",
"code": "opcionais",
"has_variants": true,
"is_shipping_required": false
},
"relationships": {
"data": {
"meta": {
"count": 6
},
"data": [
{
"type": "ProductAttribute",
"id": "33"
},
{
"type": "ProductAttribute",
"id": "32"
},
{
"type": "ProductAttribute",
"id": "30"
},
{
"type": "ProductAttribute",
"id": "29"
},
{
"type": "ProductAttribute",
"id": "16"
},
{
"type": "ProductAttribute",
"id": "15"
}
],
"links": {
"self": "http://devisp.datacake.com.br/api/store/product-type/1/relationships/data/",
"related": "http://devisp.datacake.com.br/api/store/product-type/1/data/"
}
}
}
},
{
"type": "ProductType",
"id": "2",
"attributes": {
"weight": "0.0 kg",
"created": "2021-01-12T00:20:43.367249-02:00",
"updated": "2022-01-26T12:28:33.034977-02:00",
"product_class": "simple",
"name": "TV",
"code": "tv",
"has_variants": true,
"is_shipping_required": false
},
"relationships": {
"data": {
"meta": {
"count": 3
},
"data": [
{
"type": "ProductAttribute",
"id": "30"
},
{
"type": "ProductAttribute",
"id": "29"
},
{
"type": "ProductAttribute",
"id": "4"
}
],
"links": {
"self": "http://devisp.datacake.com.br/api/store/product-type/2/relationships/data/",
"related": "http://devisp.datacake.com.br/api/store/product-type/2/data/"
}
}
}
},
{
"type": "ProductType",
"id": "4",
"attributes": {
"weight": "0.0 kg",
"created": "2021-01-12T00:22:00.990090-02:00",
"updated": "2021-02-03T17:47:44.254117-02:00",
"product_class": "simple",
"name": "Internet Fibra",
"code": "fiber",
"has_variants": true,
"is_shipping_required": false
},
"relationships": {
"data": {
"meta": {
"count": 28
},
"data": [
{
"type": "ProductAttribute",
"id": "41"
},
{
"type": "ProductAttribute",
"id": "40"
},
{
"type": "ProductAttribute",
"id": "39"
},
{
"type": "ProductAttribute",
"id": "38"
},
{
"type": "ProductAttribute",
"id": "37"
},
{
"type": "ProductAttribute",
"id": "36"
},
{
"type": "ProductAttribute",
"id": "35"
},
{
"type": "ProductAttribute",
"id": "34"
},
{
"type": "ProductAttribute",
"id": "31"
},
{
"type": "ProductAttribute",
"id": "28"
},
{
"type": "ProductAttribute",
"id": "27"
},
{
"type": "ProductAttribute",
"id": "17"
},
{
"type": "ProductAttribute",
"id": "16"
},
{
"type": "ProductAttribute",
"id": "15"
},
{
"type": "ProductAttribute",
"id": "14"
},
{
"type": "ProductAttribute",
"id": "13"
},
{
"type": "ProductAttribute",
"id": "12"
},
{
"type": "ProductAttribute",
"id": "11"
},
{
"type": "ProductAttribute",
"id": "10"
},
{
"type": "ProductAttribute",
"id": "9"
},
{
"type": "ProductAttribute",
"id": "8"
},
{
"type": "ProductAttribute",
"id": "7"
},
{
"type": "ProductAttribute",
"id": "6"
},
{
"type": "ProductAttribute",
"id": "5"
},
{
"type": "ProductAttribute",
"id": "4"
},
{
"type": "ProductAttribute",
"id": "3"
},
{
"type": "ProductAttribute",
"id": "2"
},
{
"type": "ProductAttribute",
"id": "1"
}
],
"links": {
"self": "http://devisp.datacake.com.br/api/store/product-type/4/relationships/data/",
"related": "http://devisp.datacake.com.br/api/store/product-type/4/data/"
}
}
}
}
],
"meta": {
"pagination": {
"page": 1,
"pages": 1,
"count": 3
}
}
}
Adição de produto no carrinho:
Possibilita adicionar produto ao carrinho.
Endpoint: POST /api/store/cart-item/?include=product%2Ccart%2Ccart.items%2Ccart.items.product
Atributos:
quantity | Quantidade do produto | Number |
|---|
Headers:
x-cart-token | Token do carrinho | String |
|---|
Atributos do “relationships“:
product | ID do produto que deseja colocar no carrinho |
|---|---|
cart | ID do carrinho |
Exemplo de uso:
Body:
{
"data": {
"relationships": {
"product": {
"data": {
"type": "Product",
"id": "50"
}
},
"cart": {
"data": {
"type": "Cart",
"id": "1054"
}
}
},
"type": "CartItem",
"attributes": {
"quantity": 1
}
}
}Resposta:
{
"data": {
"type": "CartItem",
"id": "2373",
"attributes": {
"base_price": "49.99",
"quantity": 2,
"discount": "-5.00",
"total_without_discount": "99.98",
"price": "44.99",
"total": "89.98",
"is_shipping_required": false,
"unit_type": "regular",
"data": {
"discount_rules": {
"5_boleto": "-5.00"
}
},
"name": "Internet Normalzinha",
"sku": "int-normal-lp",
"created": "2022-02-22T15:31:47.410017-03:00",
"updated": "2022-02-25T14:37:07.191623-03:00",
"customer_notes": ""
},
"relationships": {
"product": {
"links": {
"self": "http://devisp.datacake.com.br/api/store/cart-item/2373/relationships/product/",
"related": "http://devisp.datacake.com.br/api/store/cart-item/2373/product/"
},
"data": {
"type": "Product",
"id": "50"
}
},
"cart": {
"links": {
"self": "http://devisp.datacake.com.br/api/store/cart-item/2373/relationships/cart/",
"related": "http://devisp.datacake.com.br/api/store/cart-item/2373/cart/"
},
"data": {
"type": "Cart",
"id": "1054"
}
}
}
},
"included": [
{
"type": "Cart",
"id": "1054",
"attributes": {
"taxes": "0.00",
"discount": "-19.90",
"monthly_period_availability": 0,
"savings": null,
"shipping_method_extra_data": {},
"total": "870.08",
"available_shipping_methods": [],
"shipping_price": "0.00",
"has_variable_weight": false,
"total_without_monthly_period": "89.98",
"total_weight": "0.0 kg",
"total_monthly_period": {},
"is_shipping_required": false,
"extra_data": {
"rg": "3283823782378",
"cpf": "993.464.350-20",
"dob": "01/01/2000",
"fees": {
"305596341G": "<span>R$-19.90<span>",
"tax_instal": "<span>R$800.00<span>"
},
"condo": "",
"dueDay": 10,
"mobile": "(14) 98198-3853",
"city_id": "11",
"message": "teste",
"telephone": "(78) 32738-2738",
"city_has_tv": true,
"paymentType": "email",
"condo_number": "",
"contractTime": 2,
"current_step": "2",
"is_migration": false,
"mobile_extra": "(87) 83728-7382",
"plan_type_id": "1",
"customer_type": "new",
"city_has_fiber": true,
"city_has_phone": false,
"city_has_radio": false,
"migration_type": null,
"has_hidden_product": false,
"current_wizard_step": "2",
"photo_identity_array": [
{
"document": "Selfie",
"media_id": "649",
"media_url": "https://storage.googleapis.com/wda-develop/secure/2022/2/4c511748079505b25ffdb3d13e37a0bf.png",
"document_id": "1",
"media_extension": "png"
},
{
"document": "Documento de identidade",
"media_id": "650",
"media_url": "https://storage.googleapis.com/wda-develop/secure/2022/2/725e6adc84d99ef99a7cdc8a8fd5d3e3.png",
"document_id": "2",
"media_extension": "png"
},
{
"document": "Comprovante de residência",
"media_id": "651",
"media_url": "https://storage.googleapis.com/wda-develop/secure/2022/2/86422b899764006fcb9f1f9d7b473879.png",
"document_id": "3",
"media_extension": "png"
},
{
"document": "Mais um",
"media_id": "652",
"media_url": "https://storage.googleapis.com/wda-develop/secure/2022/2/c5ba72b6623c8585778f24a7b0ac6a38.png",
"document_id": "7",
"media_extension": "png"
}
]
},
"payment_method_extra_data": {},
"fees": "800.00",
"subtotal": "89.98",
"created": "2022-02-22T14:53:34.768786-03:00",
"updated": "2022-02-23T11:48:07.181997-03:00",
"email": "marioli@gmail.com",
"token": "300e1eaa-bb9c-4aef-8343-2bebf2a87ea5",
"total_quantity": 0,
"status": "active",
"booking_deadline": null,
"note": "",
"voucher_code": "305596341G"
},
"relationships": {
"shipping_method": {
"links": {
"self": "http://devisp.datacake.com.br/api/store/cart/1054/relationships/shipping_method/",
"related": "http://devisp.datacake.com.br/api/store/cart/1054/shipping_method/"
},
"data": null
},
"payment_method": {
"links": {
"self": "http://devisp.datacake.com.br/api/store/cart/1054/relationships/payment_method/",
"related": "http://devisp.datacake.com.br/api/store/cart/1054/payment_method/"
},
"data": null
},
"warehouse": {
"links": {
"self": "http://devisp.datacake.com.br/api/store/cart/1054/relationships/warehouse/",
"related": "http://devisp.datacake.com.br/api/store/cart/1054/warehouse/"
},
"data": null
},
"billing_address": {
"links": {
"self": "http://devisp.datacake.com.br/api/store/cart/1054/relationships/billing_address/",
"related": "http://devisp.datacake.com.br/api/store/cart/1054/billing_address/"
},
"data": {
"type": "Address",
"id": "675"
}
},
"items": {
"meta": {
"count": 3
},
"data": [
{
"type": "CartItem",
"id": "2392"
},
{
"type": "CartItem",
"id": "2374"
},
{
"type": "CartItem",
"id": "2373"
}
],
"links": {
"self": "http://devisp.datacake.com.br/api/store/cart/1054/relationships/items/",
"related": "http://devisp.datacake.com.br/api/store/cart/1054/items/"
}
},
"user": {
"links": {
"self": "http://devisp.datacake.com.br/api/store/cart/1054/relationships/user/",
"related": "http://devisp.datacake.com.br/api/store/cart/1054/user/"
},
"data": null
},
"shipping_address": {
"links": {
"self": "http://devisp.datacake.com.br/api/store/cart/1054/relationships/shipping_address/",
"related": "http://devisp.datacake.com.br/api/store/cart/1054/shipping_address/"
},
"data": {
"type": "Address",
"id": "675"
}
},
"terms": {
"meta": {
"count": 1
},
"data": [
{
"type": "CartTerm",
"id": "7"
}
],
"links": {
"self": "http://devisp.datacake.com.br/api/store/cart/1054/relationships/terms/",
"related": "http://devisp.datacake.com.br/api/store/cart/1054/terms/"
}
},
"origin": {
"links": {
"self": "http://devisp.datacake.com.br/api/store/cart/1054/relationships/origin/",
"related": "http://devisp.datacake.com.br/api/store/cart/1054/origin/"
},
"data": {
"type": "Origin",
"id": "4"
}
},
"contract_period": {
"links": {
"self": "http://devisp.datacake.com.br/api/store/cart/1054/relationships/contract_period/",
"related": "http://devisp.datacake.com.br/api/store/cart/1054/contract_period/"
},
"data": {
"type": "CartContractPeriod",
"id": "3"
}
},
"booking_slot": {
"links": {
"self": "http://devisp.datacake.com.br/api/store/cart/1054/relationships/booking_slot/",
"related": "http://devisp.datacake.com.br/api/store/cart/1054/booking_slot/"
},
"data": null
}
}
},
{
"type": "CartItem",
"id": "2374",
"attributes": {
"base_price": "800.00",
"quantity": 1,
"discount": "0.00",
"total_without_discount": null,
"price": "800.00",
"total": "800.00",
"is_shipping_required": false,
"unit_type": null,
"data": {
"name": "Taxa de instalação",
"price": "800.00",
"rule_id": 1,
"voucher": "tax_instal"
},
"name": "Taxa de instalação",
"sku": "tax_instal",
"created": "2022-02-22T15:31:48.736354-03:00",
"updated": "2022-02-23T09:49:07.825932-03:00",
"customer_notes": ""
},
"relationships": {
"product": {
"links": {
"self": "http://devisp.datacake.com.br/api/store/cart-item/2374/relationships/product/",
"related": "http://devisp.datacake.com.br/api/store/cart-item/2374/product/"
},
"data": null
},
"cart": {
"links": {
"self": "http://devisp.datacake.com.br/api/store/cart-item/2374/relationships/cart/",
"related": "http://devisp.datacake.com.br/api/store/cart-item/2374/cart/"
},
"data": {
"type": "Cart",
"id": "1054"
}
}
}
},
{
"type": "CartItem",
"id": "2392",
"attributes": {
"base_price": "-19.90",
"quantity": 1,
"discount": "0.00",
"total_without_discount": null,
"price": "-19.90",
"total": "-19.90",
"is_shipping_required": false,
"unit_type": null,
"data": {
"name": "Cupom Datacake",
"price": "-19.90",
"rule_id": 49,
"voucher": "305596341G"
},
"name": "Cupom Datacake",
"sku": "305596341G",
"created": "2022-02-23T09:49:08.504375-03:00",
"updated": "2022-02-23T09:49:08.504446-03:00",
"customer_notes": ""
},
"relationships": {
"product": {
"links": {
"self": "http://devisp.datacake.com.br/api/store/cart-item/2392/relationships/product/",
"related": "http://devisp.datacake.com.br/api/store/cart-item/2392/product/"
},
"data": null
},
"cart": {
"links": {
"self": "http://devisp.datacake.com.br/api/store/cart-item/2392/relationships/cart/",
"related": "http://devisp.datacake.com.br/api/store/cart-item/2392/cart/"
},
"data": {
"type": "Cart",
"id": "1054"
}
}
}
},
{
"type": "Product",
"id": "50",
"attributes": {
"more_like_this": "/api/store/product/mlt/50/",
"extra_attributes": [],
"hide_customer_notes": false,
"pricing_sorting": "49.99",
"option_required": false,
"pricing_list": "49.99",
"exclusive_pricing_sale": null,
"kilogram_price": "49.99",
"weight": null,
"price": "49.99",
"data": {
"ribbon": null,
"upload": "20",
"download": "100",
"sub_title": null,
"thumbnail": null,
"upload_icon": null,
"addon_icon_1": null,
"addon_icon_2": null,
"addon_icon_3": null,
"addon_icon_4": null,
"addon_text_1": null,
"addon_text_2": null,
"addon_text_3": null,
"addon_text_4": null,
"checkout_icon": null,
"display_title": "Internet",
"download_icon": null,
"franquia_dado": null,
"is_best_seller": null,
"addon_icon_cart_1": null,
"addon_icon_cart_2": null,
"addon_icon_cart_3": null,
"addon_icon_cart_4": null,
"addon_text_cart_1": null,
"addon_text_cart_2": null,
"addon_text_cart_3": null,
"addon_text_cart_4": null,
"short_description": null
},
"first_image_alt": null,
"base_price": "49.99",
"attributes": null,
"pricing_sale": null,
"variant_attributes": null,
"is_favorite": false,
"cost": null,
"first_image": null,
"created": "2022-02-16T17:18:06.477206-02:00",
"updated": "2022-02-16T17:18:06.477301-02:00",
"is_active": true,
"language": "en",
"translation": {},
"sku": "int-normal-lp",
"name": "Internet Normalzinha",
"description": "Internet normal",
"brand": null,
"package": null,
"available_on": null,
"visibility": "all",
"track_inventory": true,
"quantity": 1,
"quantity_allocated": 0,
"shipping_width": null,
"shipping_height": null,
"shipping_depth": null,
"is_in_promotion": false,
"is_in_exclusive_promotion": false,
"has_image": false,
"restricted_customers": false,
"variable_weight": false,
"min_stock": 0.0,
"unit_type": "regular",
"position": 5,
"product_class": "simple",
"internal_product_code": null,
"channel_count": 0,
"channel_hd_count": 0,
"channel_audio_count": 0
},
"relationships": {
"inventory": {
"meta": {
"count": 0
},
"data": [],
"links": {
"self": "http://devisp.datacake.com.br/api/store/product/50/relationships/inventory/",
"related": "http://devisp.datacake.com.br/api/store/product/50/inventory/"
}
},
"variant_parent": {
"data": null,
"links": {
"self": "http://devisp.datacake.com.br/api/store/product/50/relationships/variant_parent/",
"related": "http://devisp.datacake.com.br/api/store/product/50/variant_parent/"
}
},
"tags": {
"meta": {
"count": 0
},
"data": [],
"links": {
"self": "http://devisp.datacake.com.br/api/store/product/50/relationships/tags/",
"related": "http://devisp.datacake.com.br/api/store/product/50/tags/"
}
},
"current_inventory": {
"links": {
"self": "http://devisp.datacake.com.br/api/store/product/50/relationships/current_inventory/",
"related": "http://devisp.datacake.com.br/api/store/product/50/current_inventory/"
},
"data": null
},
"categories": {
"meta": {
"count": 0
},
"data": [],
"links": {
"self": "http://devisp.datacake.com.br/api/store/product/50/relationships/categories/",
"related": "http://devisp.datacake.com.br/api/store/product/50/categories/"
}
},
"addons": {
"meta": {
"count": 0
},
"data": [],
"links": {
"self": "http://devisp.datacake.com.br/api/store/product/50/relationships/addons/",
"related": "http://devisp.datacake.com.br/api/store/product/50/addons/"
}
},
"product_type": {
"links": {
"self": "http://devisp.datacake.com.br/api/store/product/50/relationships/product_type/",
"related": "http://devisp.datacake.com.br/api/store/product/50/product_type/"
},
"data": {
"type": "ProductType",
"id": "4"
}
},
"bundle_products": {
"meta": {
"count": 0
},
"data": [],
"links": {
"self": "http://devisp.datacake.com.br/api/store/product/50/relationships/bundle_products/",
"related": "http://devisp.datacake.com.br/api/store/product/50/bundle_products/"
}
},
"images": {
"meta": {
"count": 0
},
"data": [],
"links": {
"self": "http://devisp.datacake.com.br/api/store/product/50/relationships/images/",
"related": "http://devisp.datacake.com.br/api/store/product/50/images/"
}
},
"options": {
"links": {
"self": "http://devisp.datacake.com.br/api/store/product/50/relationships/options/",
"related": "http://devisp.datacake.com.br/api/store/product/50/options/"
},
"data": null
}
}
}
]
}
Pegar os adicionais de um produto:
Permite pegar os adicionais de um produto
Endpoint: GET /api/store/product/{product_id}/addons/?include=product_type%2Ccategories
Parâmetros:
product_id | ID do produto que deseja pegar os adicionais |
|---|
Exemplo de resposta:
{
"data": []
}
Remoção de um produto do carrinho:
Permite remover produto do carrinho.
Endpoint: DELETE /api/store/cart-item/{cart_item_id}/
Parâmetros:
cart_item_id | ID do “CartItem” |
|---|
Headers:
x-cart-token | Token do carrinho |
|---|