# PUT:: Atualizar dados de uma cobrança com vencimento

## Endpoint de request

```
https://sandbox.agilspotpay.financehub.com.br/pix/v1/collection/duedate/{transactionId}
```

## Exemplo com as principais linguagem

Retorno em JSON com os dados do cadastro.

{% tabs %}
{% tab title="cPHP" %}

```php
<?php

$curl = curl_init();

curl_setopt_array($curl, [
  CURLOPT_URL => "https://sandbox.agilspotpay.financehub.com.br/pix/v1/collection/duedate/{transactionId}",
  CURLOPT_RETURNTRANSFER => true,
  CURLOPT_ENCODING => "",
  CURLOPT_MAXREDIRS => 10,
  CURLOPT_TIMEOUT => 30,
  CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
  CURLOPT_CUSTOMREQUEST => "PUT",
  CURLOPT_POSTFIELDS => "{\"clientRequestId\":\"9b26edb7cf254db09f5449c94bf13abc\",\"duedate\":\"2021-04-29 00:00:00\",\"debtor\":{\"cpf\":\"11122233366\",\"cnpj\":\"1112223300100\",\"city\":\"Barueri\",\"publicArea\":\"Avenida Brasil\",\"state\":\"SP\",\"email\":\"conta@agilspotpay.com.br\"},\"receiver\":{\"cpf\":\"11122233366\",\"cnpj\":\"Documento único de identificação brasileiro de pessoa jurídica (CNPJ). Campo obrigatório para pessoa jurídica.\",\"postalCode\":\"09550000\",\"city\":\"São Caetano do Sul\",\"state\":\"SP\"},\"locationId\":55845,\"amountDicount\":{\"modality\":\"FIXED_VALUE_UNTIL_THE_DATES_INFORMED\"},\"amountAbatement\":{\"amountPerc\":\"0.00\",\"modality\":\"FIXED_VALUE\"},\"amountFine\":{\"modality\":\"FIXED_VALUE\"},\"amountInterest\":{\"amountPerc\":\"0.00\",\"modality\":\"VALUE_CALENDAR_DAYS\"},\"key\":\"5d000ece-b3f0-47b3-8bdd-c183e8875862\"}",
  CURLOPT_HTTPHEADER => [
    "accept: application/json",
    "content-type: application/json"
  ],
]);

$response = curl_exec($curl);
$err = curl_error($curl);

curl_close($curl);

if ($err) {
  echo "cURL Error #:" . $err;
} else {
  echo $response;
}
```

{% endtab %}

{% tab title="cURL" %}

```shell
curl --request PUT \
     --url https://sandbox.agilspotpay.financehub.com.br/pix/v1/collection/duedate/{transactionId} \
     --header 'accept: application/json' \
     --header 'content-type: application/json' \
     --data '
{
     "clientRequestId": "9b26edb7cf254db09f5449c94bf13abc",
     "duedate": "2021-04-29 00:00:00",
     "debtor": {
          "cpf": "11122233366",
          "cnpj": "1112223300100",
          "city": "Barueri",
          "publicArea": "Avenida Brasil",
          "state": "SP",
          "email": "conta@agilspotpay.com.br"
     },
     "receiver": {
          "cpf": "11122233366",
          "cnpj": "Documento único de identificação brasileiro de pessoa jurídica (CNPJ). Campo obrigatório para pessoa jurídica.",
          "postalCode": "09550000",
          "city": "São Caetano do Sul",
          "state": "SP"
     },
     "locationId": 55845,
     "amountDicount": {
          "modality": "FIXED_VALUE_UNTIL_THE_DATES_INFORMED"
     },
     "amountAbatement": {
          "amountPerc": "0.00",
          "modality": "FIXED_VALUE"
     },
     "amountFine": {
          "modality": "FIXED_VALUE"
     },
     "amountInterest": {
          "amountPerc": "0.00",
          "modality": "VALUE_CALENDAR_DAYS"
     },
     "key": "5d000ece-b3f0-47b3-8bdd-c183e8875862"
}
'
```

{% endtab %}

{% tab title="NodeJs Axios" %}

```jsx
const axios = require('axios');

const options = {
  method: 'PUT',
  url: 'https://sandbox.agilspotpay.financehub.com.br/pix/v1/collection/duedate/{transactionId}',
  headers: {accept: 'application/json', 'content-type': 'application/json'},
  data: {
    clientRequestId: '9b26edb7cf254db09f5449c94bf13abc',
    duedate: '2021-04-29 00:00:00',
    debtor: {
      cpf: '11122233366',
      cnpj: '1112223300100',
      city: 'Barueri',
      publicArea: 'Avenida Brasil',
      state: 'SP',
      email: 'conta@agilspotpay.com.br'
    },
    receiver: {
      cpf: '11122233366',
      cnpj: 'Documento único de identificação brasileiro de pessoa jurídica (CNPJ). Campo obrigatório para pessoa jurídica.',
      postalCode: '09550000',
      city: 'São Caetano do Sul',
      state: 'SP'
    },
    locationId: 55845,
    amountDicount: {modality: 'FIXED_VALUE_UNTIL_THE_DATES_INFORMED'},
    amountAbatement: {amountPerc: '0.00', modality: 'FIXED_VALUE'},
    amountFine: {modality: 'FIXED_VALUE'},
    amountInterest: {amountPerc: '0.00', modality: 'VALUE_CALENDAR_DAYS'},
    key: '5d000ece-b3f0-47b3-8bdd-c183e8875862'
  }
};

axios
  .request(options)
  .then(function (response) {
    console.log(response.data);
  })
  .catch(function (error) {
    console.error(error);
  });
```

{% endtab %}
{% endtabs %}

## **Modelo de retorno&#x20;**<mark style="color:green;">**200 OK**</mark>

```json
{
  "transactionIdentification": "kk6g232xel65a0daee4dd13kk9189382",
  "transactionId": 9189382,
  "clientRequestId": "9b26edb7cf254db09f5449c94bf13abc",
  "status": "ACTIVE",
  "lastUpdate": "2022-03-21T14:27:58.2106288+00:00",
  "payerQuestion": null,
  "additionalInformation": null,
  "debtor": {
    "name": "Fulano de Tal",
    "cpf": null,
    "cnpj": "61360961000100"
  },
  "amount": {
    "original": 15.63,
    "discount": {
      "discountDateFixed": [
        {
          "date": "2022-03-21T00:00:00",
          "amountPerc": "1.00"
        }
      ],
      "modality": "FIXED_VALUE_UNTIL_THE_DATES_INFORMED"
    },
    "abatement": null,
    "fine": null,
    "interest": null
  },
  "location": {
    "merchant": {
      "postalCode": "01201005",
      "city": "Barueri",
      "merchantCategoryCode": "0000",
      "name": "AgilSpot Pay Pagamentos"
    },
    "url": "api-h.developer.btgpactual.com/v1/p/v2/cobv/8767107ce1db49fdb1058224e00c4ab1",
    "emv": "00020101021226980014br.gov.bcb.pix2576api-h.developer.btgpactual.com/v1/p/v2/cobv/8767107ce1db49fdb1058224e00c4ab15204000053039865802BR5918Celcoin Pagamentos6007Barueri61080120100562070503***630411F9",
    "type": "COBV",
    "locationId": "12731020",
    "id": null
  },
  "key": "testepix@btgpactual.com",
  "receiver": {
    "name": "João da Silva",
    "fantasyName": "Nome de Comercial",
    "cpf": null,
    "cnpj": "60904237000129"
  },
  "calendar": {
    "expirationAfterPayment": "10",
    "createdAt": "0001-01-01T00:00:00",
    "dueDate": "2022-03-22T00:00:00"
  },
  "createAt": "2022-03-21T14:27:58.2106288+00:00"
}
```

## **Modelo de retorno&#x20;**<mark style="color:red;">**400 Error**</mark>

```json
400 - The Calendar.DueDate Field Cannot Be
{
  "message": "The Calendar.DueDate field cannot be less than the current date.",
  "errorCode": "PCE003"
}
400 - The Discount.DiscountDateFixed.AmountPerc Field Cannot Be
{
  "message": "The Discount.DiscountDateFixed.AmountPerc field cannot be less than the current date.",
  "errorCode": "PCE003"
}
400 - Can't Create A New PixCollectionDueDate
{
  "message": "Can't create a new PixCollectionDueDate when there is another Pix Collection active with the same location.",
  "errorCode": "PBE318"
}
```


---

# 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://agilspot-pay.gitbook.io/api-finance-hub/api-de-pix/cobranca-com-vencimento-cobv/put-atualizar-dados-de-uma-cobranca-com-vencimento.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.
