POST:: Criar um QR Code (Location)

Essa API possibilita que seja realizado a criação de um QR Code para em seguida ser atrelado uma cobrança a ele, podendo ser com vencimento, ou imediata.

Endpoint de request

https://sandbox.agilspotpay.financehub.com.br/pix/v1/location

Exemplo com as principais linguagem

Retorno em JSON com os dados do cadastro.

<?php

$curl = curl_init();

curl_setopt_array($curl, [
  CURLOPT_URL => "https://sandbox.agilspotpay.financehub.com.br/pix/v1/location",
  CURLOPT_RETURNTRANSFER => true,
  CURLOPT_ENCODING => "",
  CURLOPT_MAXREDIRS => 10,
  CURLOPT_TIMEOUT => 30,
  CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
  CURLOPT_CUSTOMREQUEST => "POST",
  CURLOPT_POSTFIELDS => "{\"clientRequestId\":\"9b26edb7cf254db09f5449c94bf13abc\",\"merchant\":{\"postalCode\":\"01201005\",\"merchantCategoryCode\":0,\"name\":\"AgilSpot Pay\"}}",
  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;
}

Modelo de retorno 200 OK

{
  "status": "CREATED",
  "clientRequestId": "9b26edb7cf254db09f5449c94bf13abc",
  "merchant": {
    "postalCode": "01201005",
    "city": "Barueri",
    "merchantCategoryCode": "0000",
    "name": "AgilSpot Pay"
  },
  "url": "api-h.developer.btgpactual.com/v1/p/v2/f5d3c300f49442149d996c3dccc8860e",
  "emv": "00020101021226930014br.gov.bcb.pix2571api-h.developer.btgpactual.com/v1/p/v2/f5d3c300f49442149d996c3dccc8860e5204000053039865802BR5907Celcoin6007Barueri61080120100562070503***630411BD",
  "type": "COB",
  "locationId": 12731081

Modelo de retorno 400 - Error Converting Value

{
  "message": "Error converting value \"xxx\" to 'type' 'Pactual.BaaS.Entities.Pix.LocationType'. Path ''type'', line 3, position 17.",
  "errorCode": "400"
}

Modelo de retorno 422 - Value Cannot Be Null

{
  "message": "Value cannot be null. (Parameter 's')",
  "errorCode": "CR001"
}

Last updated