# Envio de Pedido

Para configurar o webhook para o envio de pedidos ao seu sistema, acesse o menu "B2B", clique em "Editar Portal" e selecione o perfil que deseja configurar. Ao selecionar clique em “Configurações”.

<figure><img src="https://lh7-rt.googleusercontent.com/docsz/AD_4nXf-kBS5pQpBNu7sPa8OQdWLKoUIEa-gSUXPO3Lg2Xl5Qmm6pdRXZt4nJUD8_SssXQsrsvjOBXhnGhq-VrlUXLpt83_hsh2nTVH-oD3sKFtcRCI5SPEuHwN2aN9LSl1RU0yH4Scw0hFrynbmDJ1OVA?key=Zwk67BZsb2R2NWhgpn3nNA" alt=""><figcaption></figcaption></figure>

<figure><img src="https://lh7-rt.googleusercontent.com/docsz/AD_4nXf3QCvRNDp1_FRwulvRo4GBxsNvAOnLDFBbXiVex8uIlTmC38l2r_eD6NnSiKG4fgauFru14Ex8OU17IvLdhRUF2jMPimtIF2UgaC5dqQtVBwMksk78Q6mf0NQjjFeeTLpPdcqbkk5rxnddb6pOdA?key=Zwk67BZsb2R2NWhgpn3nNA" alt="" width="375"><figcaption></figcaption></figure>

<br>

<figure><img src="https://lh7-rt.googleusercontent.com/docsz/AD_4nXeIPbwIgu-dTHWqqkVcPhxDwmhhDqLc2RlcsevT9U1LEEdpeH8mOf4i4XZf85pJlBV0caqUi-5VIr1yRmf0EtW6w7rLlSg1QQjjNaRAY_3k8IlAj9OBRblT3dE-mICE_ysdsWY2NpP0_sOImtFP?key=Zwk67BZsb2R2NWhgpn3nNA" alt=""><figcaption></figcaption></figure>

Para configurar as informações que devem ser enviadas para a persistência do pedido, acesse a aba "Entrada de Pedido". Esses dados serão incluídos no corpo da requisição de envio do pedido.

<figure><img src="https://lh7-rt.googleusercontent.com/docsz/AD_4nXcjbrnPGM8_GM3CV8igY84eRY_MJaX8UsdLWd5r8k_U43qkNwqNLVaLx0hNxCr4SBipd0HNsGjtlfHmxz4f7JxC2Ap0Rq6NHhZt0kHPcVHsC9PDv9V-2BWAmbT2bixXc_339UWT3Sb6EbTVWW-Hcw?key=Zwk67BZsb2R2NWhgpn3nNA" alt=""><figcaption></figcaption></figure>

<figure><img src="https://lh7-rt.googleusercontent.com/docsz/AD_4nXehHO2Y4t1yAVUqMX-bc5juHUvm3_oxTG43ezGtRZ_P4y7YeQvTNURQICeBsKE7IZ8R3b-D2RHooo2rlXdQLnc7MGbrlrtptJe4S3OwoYwZoS88qE3oFyIoiYQSqKZNggkARd3lH87K0OHSJ4Go?key=Zwk67BZsb2R2NWhgpn3nNA" alt=""><figcaption></figcaption></figure>

Objeto enviado no evento:

```json
{
    "amount_value": 1864.83,
    "automation_fields": { //campos configurados para serem enviados
        "AD_OBJETIVODECOMPRA": "CON",
        "AD_OPCFRETE": "1",
        "AD_ORIGEM": "B2B",
        "CODTIPOPER": "4502"
    },
    "checkout_complement": { //informações do formulário de checkout
        "3e53f947-713a-4bf2-ae2e-d8e12db4cce4": "C",
        "4d581464-6414-48b4-b854-a04851d56c5e": "asd",
        "879b22f0-d8ca-491e-8532-0d6cd1881acb": "CON",
        "a1ebb794-84dd-4931-ba56-5f1886d161da": "1"
    },
    "delivery": {
        "address_type": "Av",
        "complement": "BLOCO B",
        "contact_name": "EXEMPLO",
        "contact_number": 34  99999999",
        "country": "Brasil",
        "neighborhood": "Cidade Jardim",
        "number": "799",
        "postal_code": "38412166",
        "state": "MG",
        "street": "Av. Uirapuru"
    },
    "discount": [
        {
            "amount": 0
        }
    ],
    "discount_value": 0,
    "freight": {
        "amount": 0
    },
    "items": [
       
        {
            "amount": 245.73,
            "automation_fields": { //campos configurados para serem enviados
                "CODLOCALORIG": "3030100"
            },
            "discount": 0.0,
            "product_id": "20031",
            "quantity": 3,
            "total_value": 245.73,
            "unit": "un",
            "unit_value": 81.91
        },
        …
        
    ],
    "partner_id": "4337",
    "payments": [
        {
            "payment_method_id": "64"
        }
    ],
    "resume_fields": [ // campos para serem exibidos no resumo do pedido
        "VLRPIS",
        "VLRISS",
        "VLRJURO",
        "VLRPISST",
        "VLRCOFINS",
        "AD_VALORDESONICMS",
        "AD_DIASENT",
        "VLROUTROS",
        "VLRFRETE",
       
    ],
    "total_value": 1864.83
}


```

Objeto de retorno esperado:

```java
@Data public class CreateOrderResponse { 
  private String id; 
  private BigDecimal total_value; 
  private List<CreateOrderItemResponse> items; 
}
```

```java
@Data @AllArgsConstructor 
public class CreateOrderItemResponse { 
	private String product_id; 
	private BigDecimal quantity; 
	private String unit; 
	private BigDecimal unit_value; 
	private BigDecimal discount; 
	private BigDecimal total_value;
}
```

Exemplo de resposta:

```json
{
	"resume_fields": [
		{
			"key": "VLRPIS",
			"description": "Vlr. PIS"
		},
		{
			"key": "VLRISS",
			"description": "Vlr. do ISS",
			"value": 0
		},
		{
			"key": "VLRJURO",
			"description": "Vlr. do Juro",
			"value": 0
		},
               …			
      ],
	"id": "9999999760",
	"total_value": 1864.83,
	"items": [
		{
			"product_id": "20031",
			"quantity": 3,
			"unit": "UN",
			"unit_value": 81.91,
			"discount": 0,
			"total_value": 245.73
		},
             …
	]
}
```


---

# Agent Instructions: Querying This Documentation

If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://docs.zydon.com.br/webhooks/envio-de-pedido.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
