POST/api/v2/pagamentos/documents/

Criar

Cria um novo documento que será impresso ou processado por um terminal, contendo linhas de texto, QR codes ou imagens. Scope: transactions.write. Não existe scope documents.* no login Mundo Digital.

Parâmetros

Content-TypeObrigatório
header

application/json

Tipo:string
AcceptObrigatório
header

application/json

Tipo:string
AuthorizationObrigatório
header

Bearer {{TOKEN}}

Tipo:string

Autenticação e scopes

Requer Bearer token com transactions.write (Pagamentos via Terminais). Não existe scope documents.read nem documents.write no login Mundo Digital.

Descrição dos Campos da Requisição

Campos Principais

CampoTipoObrigatórioDescrição
statusstringSimEstado inicial do documento. Ex: "pending"
merchant_idstringSimIdentificador único do lojista (UUID)
urlstringNãoURL para callback/notificação sobre o documento (opcional)
terminal_idstringSimIdentificador único do terminal (UUID)
tokenstringSimValor fixo "Bearer"
token_typestringSimValor fixo "Bearer", representa o tipo do token
linesarraySimLista de elementos (linhas) a serem incluídos no documento

Campos dentro de lines[]

CampoTipoObrigatórioDescrição
contentstringSimConteúdo da linha. Pode ser texto, URL ou base64 de imagem
typestringSimTipo de linha: "text", "qrcode" ou "image"
orderintegerSimOrdem de exibição/impressão da linha no documento

Tipos de Linhas Suportados

  • text: Texto simples que será impresso
  • qrcode: URL que será convertida em QR Code
  • image: Imagem em formato base64 que será impressa
curl --location 'https://api-h.nuvende.com.br/api/v2/pagamentos/documents' \
--header 'Content-Type: application/json' \
--header 'Accept: application/json' \
--header 'Authorization: Bearer {{ token_de_autenticacao }}' \
--data '{
    "status": "pending",
    "merchant_id": "{{ merchant_id }}",
    "url": "{{ url_callback }}",
    "terminal_id": "{{ terminal_id }}",
    "token": "Bearer",
    "token_type": "Bearer",
    "lines": [
        {
            "content": "Nuvende",
            "type": "text",
            "order": 1
        },
        {
            "content": "https://nuvende.com.br",
            "type": "qrcode",
            "order": 2
        },
        {
            "content": "{{ imagem_base64 }}",
            "type": "image",
            "order": 3
        }
    ]
}'
const axios = require("axios");

const data = {
  status: "pending",
  merchant_id: "{{ merchant_id }}",
  url: "{{ url_callback }}",
  terminal_id: "{{ terminal_id }}",
  token: "Bearer",
  token_type: "Bearer",
  lines: [
    {
      content: "Nuvende",
      type: "text",
      order: 1,
    },
    {
      content: "https://nuvende.com.br",
      type: "qrcode",
      order: 2,
    },
    {
      content: "{{ imagem_base64 }}",
      type: "image",
      order: 3,
    },
  ],
};

const config = {
  method: "post",
  url: "https://api-h.nuvende.com.br/api/v2/pagamentos/documents",
  headers: {
    "Content-Type": "application/json",
    Accept: "application/json",
    Authorization: "Bearer {{ token_de_autenticacao }}",
  },
  data: data,
};

axios(config)
  .then((response) => {
    console.log(JSON.stringify(response.data));
  })
  .catch((error) => {
    console.log(error);
  });
import requests
import json

url = "https://api-h.nuvende.com.br/api/v2/pagamentos/documents"

payload = {
    "status": "pending",
    "merchant_id": "{{ merchant_id }}",
    "url": "{{ url_callback }}",
    "terminal_id": "{{ terminal_id }}",
    "token": "Bearer",
    "token_type": "Bearer",
    "lines": [
        {
            "content": "Nuvende",
            "type": "text",
            "order": 1
        },
        {
            "content": "https://nuvende.com.br",
            "type": "qrcode",
            "order": 2
        },
        {
            "content": "{{ imagem_base64 }}",
            "type": "image",
            "order": 3
        }
    ]
}

headers = {
    'Content-Type': 'application/json',
    'Accept': 'application/json',
    'Authorization': 'Bearer {{ token_de_autenticacao }}'
}

response = requests.post(url, headers=headers, data=json.dumps(payload))

print(response.text)
<?php

$curl = curl_init();

curl_setopt_array($curl, array(
  CURLOPT_URL => 'https://api-h.nuvende.com.br/api/v2/pagamentos/documents',
  CURLOPT_RETURNTRANSFER => true,
  CURLOPT_ENCODING => '',
  CURLOPT_MAXREDIRS => 10,
  CURLOPT_TIMEOUT => 0,
  CURLOPT_FOLLOWLOCATION => true,
  CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
  CURLOPT_CUSTOMREQUEST => 'POST',
  CURLOPT_POSTFIELDS => json_encode(array(
    'status' => 'pending',
    'merchant_id' => '{{ merchant_id }}',
    'url' => '{{ url_callback }}',
    'terminal_id' => '{{ terminal_id }}',
    'token' => 'Bearer',
    'token_type' => 'Bearer',
    'lines' => array(
      array(
        'content' => 'Nuvende',
        'type' => 'text',
        'order' => 1
      ),
      array(
        'content' => 'https://nuvende.com.br',
        'type' => 'qrcode',
        'order' => 2
      ),
      array(
        'content' => '{{ imagem_base64 }}',
        'type' => 'image',
        'order' => 3
      )
    )
  )),
  CURLOPT_HTTPHEADER => array(
    'Content-Type: application/json',
    'Accept: application/json',
    'Authorization: Bearer {{ token_de_autenticacao }}'
  ),
));

$response = curl_exec($curl);

curl_close($curl);
echo $response;
?>
{
  "status": "pending",
  "merchant_id": "{{merchant_id}}",
  "url": "https://webhook.site/a26d5508-c9d4-4645-a94f-d38562ff901d",
  "terminal_id": "{{terminal_id}}",
  "token": "Bearer",
  "token_type": "Bearer",
  "lines": [
    {
      "content": "Nuvende",
      "type": "text",
      "order": 1
    },
    {
      "content": "https://nuvende.com.br",
      "type": "qrcode",
      "order": 2
    },
    {
      "content": "iVBORw0KGgoAAAANSUhEUgAAAAUAAAAFCAIAAAACDbGyAAABg2lDQ1BJQ0MgcHJvZmlsZQAAKJF9kT1Iw0AcxV9TS0UqCnYo4pChOrWLijjWKhShQqgVWnUwufQLmrQkKS6OgmvBwY/FqoOLs64OroIg+AHiLjgpukiJ/0sKLWI8OO7Hu3uPu3eA0KoyzexLAJpuGZlUUszlV8XgK4KIYBgxBGRm1uckKQ3P8XUPH1/v4jzL+9yfY1AtmAzwicQJVjcs4g3imU2rznmfOMzKskp8Thwz6ILEj1xXXH7jXHJY4JlhI5uZJw4Ti6UeVnqYlQ2NeJo4qmo65Qs5l1XOW5y1aoN17slfGCroK8tcpzmGFBaxBAkiFDRQQRUW4rTqpJjI0H7Swz/q+CVyKeSqgJFjATVokB0/+B/87tYsTk26SaEkEHix7Y9xILgLtJu2/X1s2+0TwP8MXOldf60FzH6S3uxq0SNgaBu4uO5qyh5wuQNEnuqyITuSn6ZQLALvZ/RNeWDkFhhYc3vr7OP0AchSV+kb4OAQmChR9rrHu/t7e/v3TKe/H5BycrJUq5q4AAAACXBIWXMAAAsTAAALEwEAmpwYAAAAB3RJTUUH6QcZBAouQ55pdgAAAAxJREFUCNdjYKAuAAAAUAABIhPodQAAAABJRU5ErkJggg==",
      "type": "image",
      "order": 3
    }
  ]
}