# POST:: Retornar informações do QR Code a partir de um EMV

Para iniciar o processo de pagamento de um QR Code é necessário realizar sua leitura, portanto é preciso decodificar ele a partir de uma string EMV (padrão criado para leitura de QR Code Pix no Brasil).

## Endpoint de request

```
https://sandbox.agilspotpay.financehub.com.br/pix/v1/emv
```

## 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/emv",
  CURLOPT_RETURNTRANSFER => true,
  CURLOPT_ENCODING => "",
  CURLOPT_MAXREDIRS => 10,
  CURLOPT_TIMEOUT => 30,
  CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
  CURLOPT_CUSTOMREQUEST => "POST",
  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 POST \
     --url https://sandbox.agilspotpay.financehub.com.br/pix/v1/emv \
     --header 'accept: application/json' \
     --header 'content-type: application/json'
```

{% endtab %}

{% tab title="NodeJs Axios" %}

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

const options = {
  method: 'POST',
  url: 'https://sandbox.agilspotpay.financehub.com.br/pix/v1/emv',
  headers: {accept: 'application/json', 'content-type': 'application/json'}
};

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
{
  "type": "2",
  "collection": "1",
  "payloadFormatIndicator": "01",
  "merchantAccountInformation": {
    "url": "https://api-h.developer.btgpactual.com/v1/p/v2/4c98d619a4344f6aa719c35bd16fb777",
    "gui": "br.gov.bcb.pix",
    "key": null,
    "additionalInformation": null,
    "withdrawalServiceProvider": null
  },
  "merchantCategoryCode": 0,
  "transactionCurrency": 986,
  "transactionAmount": 0,
  "countryCode": "BR",
  "merchantName": "valdir sousa",
  "merchantCity": "barueri",
  "postalCode": "09550001",
  "initiationMethod": "12",
  "transactionIdentification": "***"
}
```

## **Modelo de retorno** <mark style="color:red;">400 - Não Encontramos O EMV</mark>

```json
{
  "code": "999",
  "description": "{\"version\":\"1.3.8\",\"status\":400,\"errors\":[{\"message\":\"Error reading emv: [Failed To Decode].\",\"errorCode\":\"PCE002\"}]}"
}
```
