# API
## criar carrinho
POST /carts
``` json
{
"items": [
{
"plan_id":"58a93c2f-7103-410f-af81-6063b5214af0",
"periodicity":"12",
"quantity":1,
"attributes":[
{
"key":"domain_name",
"value":"comprapelobbsys4"
},
{
"key":"domain_suffix",
"value":"com"
},
{
"key":"registrar",
"value":"enon"
},
{
"key":"document",
"value":"35738322100"
},
{
"key":"transfer",
"value":"false"
}
]
}
],
"customer_code":"1100026798"
}
```
Retorno
``` json
{
"id": "5ece7ffaa527a602109f7fdd",
"sales_channel_id": "retail",
"customer": {
"code": "1100026798",
"login": "sousys2cartao"
},
"total_price": 0.0,
"full_price": 0.0,
"discounts": 0.0,
"coupon": null,
"items": [
{
"plan_id": "58a93c2f-7103-410f-af81-6063b5214af0",
"price_list_id": "be264dee-a2ff-4814-912c-dab433e310d9",
"product_id": "0f9aa1be-eb1a-483a-ae04-edb13b6e8d69",
"periodicity": 12,
"quantity": 1,
"description": "Registro de domínio internacional",
"purchase_price": null,
"installation_fee": null,
"manual_installation": false,
"unit_price": null,
"total_price": null,
"root_service": null,
"unit_discount": null,
"services": [],
"attributes": [
{
"key": "domain_name",
"value": "comprapelobbsys4"
},
{
"key": "domain_suffix",
"value": "com"
},
{
"key": "registrar",
"value": "enon"
},
{
"key": "document",
"value": "35738322100"
},
{
"key": "transfer",
"value": "false"
}
]
}
]
}
```
## Obter Carrinho
GET /carts/{{ cart_id }}
retorno
```json
{
"id": "5ece7ffaa527a602109f7fdd",
"sales_channel_id": "retail",
"customer": {
"code": "1100026798",
"login": "sousys2cartao"
},
"total_price": 36.9,
"full_price": 36.9,
"discounts": 0.0,
"coupon": null,
"items": [
{
"plan_id": "58a93c2f-7103-410f-af81-6063b5214af0",
"price_list_id": "be264dee-a2ff-4814-912c-dab433e310d9",
"product_id": "0f9aa1be-eb1a-483a-ae04-edb13b6e8d69",
"periodicity": 12,
"quantity": 1,
"description": "Registro de domínio internacional",
"purchase_price": 36.9,
"installation_fee": 0.0,
"manual_installation": false,
"unit_price": 36.9,
"total_price": 36.9,
"root_service": null,
"unit_discount": null,
"services": [],
"attributes": [
{
"key": "domain_name",
"value": "comprapelobbsys4"
},
{
"key": "domain_suffix",
"value": "com"
},
{
"key": "registrar",
"value": "enon"
},
{
"key": "document",
"value": "35738322100"
},
{
"key": "transfer",
"value": "false"
}
]
}
]
}
```
## Checkout Carrinho
POST /carts/{{ cart_id }}/checkout
``` json
{
"id": "5ece7ffaa527a602109f7fdd",
"finalized_at": "2020-05-27T12:02:29.8894382-03:00",
"cart_id": "5ece7ffaa527a602109f7fdd",
"sales_channel_id": "retail",
"items": [
{
"plan_id": "58a93c2f-7103-410f-af81-6063b5214af0",
"price_list_id": "be264dee-a2ff-4814-912c-dab433e310d9",
"product_id": "0f9aa1be-eb1a-483a-ae04-edb13b6e8d69",
"periodicity": 12,
"quantity": 1,
"description": "Registro de domínio internacional",
"purchase_price": 36.9,
"installation_fee": 0.0,
"manual_installation": false,
"unit_price": 36.9,
"total_price": 36.9,
"root_service": null,
"unit_discount": null,
"services": [],
"attributes": [
{
"key": "domain_name",
"value": "comprapelobbsys4"
},
{
"key": "domain_suffix",
"value": "com"
},
{
"key": "registrar",
"value": "enon"
},
{
"key": "document",
"value": "35738322100"
},
{
"key": "transfer",
"value": "false"
}
]
}
],
"invoice_id": "5ece7ffaa527a602109f7fdd",
"charge": {
"charge_id": "0db020b3-0a0f-4a9d-b37b-13cd2f13ec77",
"charge_method": {
"payment_method": "credit_card",
"boleto": null,
"credit_card": {
"brand": "master_card",
"number": "554037******2154",
"name": "AUTORIZA CAPTURA",
"expiration_month": "11",
"expiration_year": "2021",
"security_code": null,
"id": "2fe65517c13f425088363c27c6f4b9c0"
}
}
},
"customer": {
"code": "1100026798",
"login": "sousys2cartao"
},
"total_price": 36.9,
"full_price": 36.9,
"discounts": 0.0,
"coupon": null,
"link": null,
"payment_condition": null,
"antifraud_enabled": true
}
```
## Obtem dados de pagmento
/customers/{{customer_code}}/billing_info
``` json
{
"customer_id": "1100026950",
"payment_method": "boleto",
"read_only": false,
"credit_card": null,
"boleto": {
"bank": "bradesco"
},
"account_debit": null
}
{
"customer_id": "1100026535",
"payment_method": "credit_card",
"read_only": false,
"credit_card": {
"brand": "master_card",
"number": "510070******7105",
"name": "AUTORIZA CAPTURA",
"security_code": null,
"expiration_year": 2021,
"expiration_month": 12
},
"boleto": null,
"account_debit": null
}
```