Gerar relatĂłrio via API
Gere o relatĂłrio de LiberaçÔes manualmente quantas vezes quiser ou programe-o de acordo com a frequĂȘncia desejada por meio de nossa API.
Configurar o relatório de LiberaçÔes
Atributos configurĂĄveis
Confira os campos que vocĂȘ pode configurar para ajustar as suas preferĂȘncias antes de começar:
Campo configuråvel | Tipo | Exemplo | Descrição |
columns | JSON Array | [{"key": "DATE"}, {"key": "SOURCE_ID"}] | Campo com os detalhes das colunas a serem incluĂdas no seu relatĂłrio. Encontre todos os valores possĂveis na seção GlossĂĄrio. |
file_name_prefix | String | "conciliation-settlement-report" | Prefixo que compÔe o nome do relatório gerado e pronto para download. |
unite_reserve (opcional) | Boolean | true | TransaçÔes que mostram quando o dinheiro foi reservado e liberado no mesmo segundo. |
frequency | JSON | {"hour": 0, "type": "monthly", "value": 1} | Indica a frequĂȘncia diĂĄria, semanal ou mensal dos relatĂłrios programados. - frequency : aplica type monthly ao dia do mĂȘs ou weekly ao dia da semana.- hour : hora do dia que o relatĂłrio deve ser gerado.- type : indica o tipo de frequĂȘncia: daily (diĂĄria), weekly (semanal) y monthly (mensal). |
sftp_info (opcional) | JSON | {"server": "sftp.myserver.com", "password": "mypassword", "remote_dir": "/myfolder", "port": 22, "username": "myusername"} | Fornece os dados de conexĂŁo necessĂĄrios para acessar o servidor. - server : URL ou endereço IP (pĂșblica) do servidor.- password : senha do usuĂĄrio com o qual estabeleceremos a conexĂŁo.- remote_dir : pasta onde depositaremos seus relatĂłrios.- port : porta usada para estabelecer a conexĂŁo.- username : usuĂĄrio com o qual nos autenticaremos no seu servidor. |
separator (opcional) | String | ";" | Separador alternativo para arquivos csv quando se deseja utilizar um caractere diferente da vĂrgula (','). |
display_timezone (opcional) | String | "GMT-04" | Este campo determina a data e o horĂĄrio mostrados nos relatĂłrios. Se vocĂȘ nĂŁo configurar um fuso horĂĄrio para esse campo, o sistema considerarĂĄ o fuso GMT-04 como padrĂŁo. Caso escolha um fuso que adote horĂĄrio de verĂŁo, vocĂȘ precisarĂĄ fazer o ajuste manual quando o horĂĄrio mudar. |
report_translation (opcional) | String | "es" | Permite alterar o idioma padrĂŁo dos cabeçalhos das colunas. Caso esteja ativado, recomenda-se verificar se as integraçÔes com arquivos do Excel (xlsx) estĂŁo funcionando corretamente para permitir a conciliação automĂĄtica. Caso a integração nĂŁo esteja funcionando corretamente, por favor, atualize-a tendo os novos cabeçalhos como referĂȘncia. Idiomas suportados: en (InglĂȘs), es (Espanhol neutro), pt (PortuguĂȘs). |
notification_email_list (opcional) | Array | ["example@email.com", "john@example.com"] | Permite adicionar um grupo de destinatĂĄrios de e-mail para que recebam uma notificação quando um relatĂłrio estiver pronto e disponĂvel para download. Certifique-se de incluir o e-mail associado Ă sua conta Mercado Pago para que vocĂȘ tambĂ©m receba as notificaçÔes. |
refund_detailed (opcional) | Boolean | true | Mostra o cĂłdigo de referĂȘncia (external_reference ) do reembolso em vez do cĂłdigo de referĂȘncia (external_reference ) do pagamento. |
include_withdrawal (opcional) | Boolean | true | Inclui as retiradas de dinheiro no relatĂłrio. |
coupon_detailed (opcional) | Boolean | true | Inclui uma coluna para mostrar os detalhes dos cupons de desconto. |
scheduled (read_only) | Boolean | true | Campo informativo que indica se jå existem relatórios programados na conta do usuårio. - True : A geração automåtica estå ativada. - False : A geração automåtica estå desativada. |
check_available_balance (opcional) | Boolean | true | Saldo antes e depois de fazer um saque, que explica o balanço da conta. (Esta configuração é meramente informativa. Ela não deve ser considerada para comprovação de balanço e/ou saldo da conta). |
compensate_detail (opcional) | Boolean | true | Bloqueio e desbloqueio de dinheiro que se compensam entre si e que nĂŁo afetam o saldo final. Ajuda a entender como Ă© feito o balanço final do relatĂłrio, em um formato cronolĂłgico (configuração recomendada caso vocĂȘ tenha um grande volume de transaçÔes). |
VocĂȘ pode configurar seus relatĂłrios conforme necessĂĄrio. Abaixo, destacamos as chamadas de API disponĂveis para que vocĂȘ possa gerenciar a configuração do seu relatĂłrio e, posteriormente, com base nessas configuraçÔes, gerar os relatĂłrios.
Criar uma nova configuração
Personalize seus relatórios atribuindo diferentes propriedades de criação executando o seguinte curl:
curl -X POST \
-H 'accept: application/json' \
-H 'content-type: application/json' \
-H 'Authorization: Bearer ENV_ACCESS_TOKEN' \
'https://api.mercadopago.com/v1/account/release_report/config' \
-d '{
"file_name_prefix": "release-report-USER_ID",
"include_withdrawal_at_end": true,
"execute_after_withdrawal": false,
"display_timezone": "GMT-04",
"notification_email_list": [
"example@email.com",
"john@example.com"
],
"frequency": {
"hour": 0,
"type": "monthly",
"value": 1
},
"columns": [
{
"key": "DATE"
},
{
"key": "SOURCE_ID"
},
{
"key": "EXTERNAL_REFERENCE"
}
]
}'
<?php
include('vendor/rmccue/requests/library/Requests.php');
Requests::register_autoloader();
$headers = array(
'accept' => 'application/json',
'content-type' => 'application/json',
'Authorization' => 'Bearer ENV_ACCESS_TOKEN'
);
$data = '{
"file_name_prefix": "release-report-USER_ID",
"include_withdrawal_at_end": true,
"execute_after_withdrawal": false,
"display_timezone": "GMT-04",
"notification_email_list": [
"example@email.com",
"john@example.com"
],
"frequency": {
"hour": 0,
"type": "monthly",
"value": 1
},
"columns": [
{
"key": "DATE"
},
{
"key": "SOURCE_ID"
},
{
"key": "EXTERNAL_REFERENCE"
}
]
}';
$response = Requests::post('https://api.mercadopago.com/v1/account/release_report/config', $headers, $data);
URL url = new URL("https://api.mercadopago.com/v1/account/release_report/config");
HttpsURLConnection connection = (HttpsURLConnection) url.openConnection();
connection.setRequestMethod("POST");
connection.setRequestProperty("Accept", "application/json");
connection.setRequestProperty("Content-Type", "application/json");
connection.setRequestProperty("Authorization", "Bearer ENV_ACCESS_TOKEN");
connection.setDoOutput(true);
String body = "{
\\"file_name_prefix\\": \\"release-report-USER_ID\\",
\\"include_withdrawal_at_end\\": true,
\\"execute_after_withdrawal\\": false,
\\"display_timezone\\": \\"GMT-04\\",
\\"notification_email_list\\": [
\\"example@email.com\\",
\\"john@example.com\\",
],
\\"frequency\\": {
\\"hour\\": 0,
\\"type\\": \\"monthly\\",
\\"value\\": 1
},
\\"columns\\": [
{ \\"key\\": \\"DATE\\" },
{ \\"key\\": \\"SOURCE_ID\\" },
{ \\"key\\": \\"EXTERNAL_REFERENCE\\" },
]
}";
try(OutputStream os = connection.getOutputStream()) {
byte[] input = body.getBytes("utf-8");
os.write(input, 0, input.length);
}
System.out.println(connection.getResponseCode());
System.out.println(connection.getResponseMessage());
System.out.println(connection.getInputStream());
import requests
headers = {
'accept': 'application/json',
'content-type': 'application/json',
'Authorization': 'Bearer ENV_ACCESS_TOKEN'
}
data = '{
"file_name_prefix": "release-report-USER_ID",
"include_withdrawal_at_end": true,
"execute_after_withdrawal": false,
"display_timezone": "GMT-04",
"notification_email_list": [
"example@email.com",
"john@example.com"
],
"frequency": {
"hour": 0,
"type": "monthly",
"value": 1
},
"columns": [
{
"key": "DATE"
},
{
"key": "SOURCE_ID"
},
{
"key": "EXTERNAL_REFERENCE"
}
]
}'
response = requests.post('https://api.mercadopago.com/v1/account/release_report/config', headers=headers, data=data)
var request = require('request');
var headers = {
'accept': 'application/json',
'content-type': 'application/json',
'Authorization': 'Bearer ENV_ACCESS_TOKEN'
};
var dataString = '{
"file_name_prefix": "release-report-USER_ID",
"include_withdrawal_at_end": true,
"execute_after_withdrawal": false,
"display_timezone": "GMT-04",
"notification_email_list": [
"example@email.com",
"john@example.com"
],
"frequency": {
"hour": 0,
"type": "monthly",
"value": 1
},
"columns": [
{
"key": "DATE"
},
{
"key": "SOURCE_ID"
},
{
"key": "EXTERNAL_REFERENCE"
}
]
}';
var options = {
url: 'https://api.mercadopago.com/v1/account/release_report/config',
method: 'POST',
headers: headers,
body: dataString
};
function callback(error, response, body) {
if (!error && response.statusCode == 200) {
console.log(body);
}
}
request(options, callback);
Na ausĂȘncia de erros, serĂĄ emitido um cĂłdigo de status HTTP 201 (Created)
. A API responderĂĄ com uma estrutura JSON, cujas propriedades representarĂŁo a configuração que vocĂȘ criou.
Resposta
json
{
"file_name_prefix": "release-report-USER_ID",
"include_withdrawal_at_end": true,
"scheduled": false,
"execute_after_withdrawal": false,
"separator": ",",
"display_timezone": "GMT-04",
"notification_email_list": [
"example@email.com",
"john@example.com"
],
"frequency": {
"hour": 0,
"type": "monthly",
"value": 1
},
"columns": [
{
"key": "DATE"
},
{
"key": "SOURCE_ID"
},
{
"key": "EXTERNAL_REFERENCE"
}
]
}
Consultar configuraçÔes
Consulte a configuração atual dos seus relatórios executando o seguinte curl:
curl -X GET \
-H 'accept: application/json' \
-H 'content-type: application/json' \
-H 'Authorization: Bearer ENV_ACCESS_TOKEN' \
'https://api.mercadopago.com/v1/account/release_report/config' \
<?php
include('vendor/rmccue/requests/library/Requests.php');
Requests::register_autoloader();
$headers = array(
'accept' => 'application/json',
'content-type' => 'application/json',
'Authorization' => 'Bearer ENV_ACCESS_TOKEN'
);
$response = Requests::get('https://api.mercadopago.com/v1/account/release_report/config', $headers);
URL url = new URL("https://api.mercadopago.com/v1/account/release_report/config");
HttpsURLConnection connection = (HttpsURLConnection) url.openConnection();
connection.setRequestMethod("GET");
connection.setRequestProperty("Accept", "application/json");
connection.setRequestProperty("Content-Type", "application/json");
connection.setRequestProperty("Authorization", "Bearer ENV_ACCESS_TOKEN");
System.out.println(connection.getResponseCode());
System.out.println(connection.getResponseMessage());
System.out.println(connection.getInputStream());
import requests
headers = {
'accept': 'application/json',
'content-type': 'application/json',
'Authorization': 'Bearer ENV_ACCESS_TOKEN'
}
response = requests.get('https://api.mercadopago.com/v1/account/release_report/config', headers=headers)
var request = require('request');
var headers = {
'accept': 'application/json',
'content-type': 'application/json',
'Authorization': 'Bearer ENV_ACCESS_TOKEN'
};
var options = {
url: 'https://api.mercadopago.com/v1/account/release_report/config',
headers: headers
};
function callback(error, response, body) {
if (!error && response.statusCode == 200) {
console.log(body);
}
}
request(options, callback);
Na ausĂȘncia de erros, serĂĄ emitido um cĂłdigo de status HTTP 200 (Ok)
. A API responderĂĄ com uma estrutura JSON cujas propriedades representarĂŁo as caracterĂsticas dos seus relatĂłrios.
Resposta
json
{
"file_name_prefix": "release-report-USER_ID",
"include_withdrawal_at_end": true,
"scheduled": false,
"execute_after_withdrawal": false,
"separator": ";",
"display_timezone": "GMT-04",
"frequency": {
"hour": 0,
"type": "monthly",
"value": 1
},
"columns": [
{
"key": "DATE"
},
{
"key": "SOURCE_ID"
},
{
"key": "EXTERNAL_REFERENCE"
}
]
}
Atualizar configuraçÔes
Atualize as configuraçÔes predefinidas dos seus relatórios quando necessårio executando o curl abaixo.
curl -X PUT \
-H 'accept: application/json' \
-H 'content-type: application/json' \
-H 'Authorization: Bearer ENV_ACCESS_TOKEN' \
'https://api.mercadopago.com/v1/account/release_report/config' \
-d '{
"file_name_prefix": "release-report-USER_ID",
"include_withdrawal_at_end": true,
"execute_after_withdrawal": false,
"display_timezone": "GMT-04",
"notification_email_list": [
"example@email.com",
"john@example.com"
],
"frequency": {
"hour": 0,
"type": "monthly",
"value": 1
},
"columns": [
{
"key": "DATE"
},
{
"key": "SOURCE_ID"
},
{
"key": "EXTERNAL_REFERENCE"
}
]
}'
<?php
include('vendor/rmccue/requests/library/Requests.php');
Requests::register_autoloader();
$headers = array(
'accept' => 'application/json',
'content-type' => 'application/json',
'Authorization' => 'Bearer ENV_ACCESS_TOKEN'
);
$data = '{
"file_name_prefix": "release-report-USER_ID",
"include_withdrawal_at_end": true,
"execute_after_withdrawal": false,
"display_timezone": "GMT-04",
"notification_email_list": [
"example@email.com",
"john@example.com"
],
"frequency": {
"hour": 0,
"type": "monthly",
"value": 1
},
"columns": [
{
"key": "DATE"
},
{
"key": "SOURCE_ID"
},
{
"key": "EXTERNAL_REFERENCE"
}
]
}';
$response = Requests::put('https://api.mercadopago.com/v1/account/release_report/config', $headers, $data);
URL url = new URL("https://api.mercadopago.com/v1/account/release_report/config");
HttpsURLConnection connection = (HttpsURLConnection) url.openConnection();
connection.setRequestMethod("PUT");
connection.setRequestProperty("Accept", "application/json");
connection.setRequestProperty("Content-Type", "application/json");
connection.setRequestProperty("Authorization", "Bearer ENV_ACCESS_TOKEN");
connection.setDoOutput(true);
String body = "{
\\"file_name_prefix\\": \\"release-report-USER_ID\\",
\\"include_withdrawal_at_end\\": true,
\\"execute_after_withdrawal\\": false,
\\"display_timezone\\": \\"GMT-04\\",
\\"notification_email_list\\": [
\\"example@email.com\\",
\\"john@example.com\\",
],
\\"frequency\\": {
\\"hour\\": 0,
\\"type\\": \\"monthly\\",
\\"value\\": 1
},
\\"columns\\": [
{ \\"key\\": \\"DATE\\" },
{ \\"key\\": \\"SOURCE_ID\\" },
{ \\"key\\": \\"EXTERNAL_REFERENCE\\" },
]
}";
try(OutputStream os = connection.getOutputStream()) {
byte[] input = body.getBytes("utf-8");
os.write(input, 0, input.length);
}
System.out.println(connection.getResponseCode());
System.out.println(connection.getResponseMessage());
System.out.println(connection.getInputStream());
import requests
headers = {
'accept': 'application/json',
'content-type': 'application/json',
'Authorization': 'Bearer ENV_ACCESS_TOKEN'
}
data = '{
"file_name_prefix": "release-report-USER_ID",
"include_withdrawal_at_end": true,
"execute_after_withdrawal": false,
"display_timezone": "GMT-04",
"notification_email_list": [
"example@email.com",
"john@example.com"
],
"frequency": {
"hour": 0,
"type": "monthly",
"value": 1
},
"columns": [
{
"key": "DATE"
},
{
"key": "SOURCE_ID"
},
{
"key": "EXTERNAL_REFERENCE"
}
]
}'
response = requests.put('https://api.mercadopago.com/v1/account/release_report/config', headers=headers, data=data)
var request = require('request');
var headers = {
'accept': 'application/json',
'content-type': 'application/json',
'Authorization': 'Bearer ENV_ACCESS_TOKEN'
};
var dataString = '{
"file_name_prefix": "release-report-USER_ID",
"include_withdrawal_at_end": true,
"execute_after_withdrawal": falsre,
"display_timezone": "GMT-04",
"notification_email_list": [
"example@email.com",
"john@example.com"
],
"frequency": {
"hour": 0,
"type": "monthly",
"value": 1
},
"columns": [
{
"key": "DATE"
},
{
"key": "SOURCE_ID"
},
{
"key": "EXTERNAL_REFERENCE"
}
]
}';
var options = {
url: 'https://api.mercadopago.com/v1/account/release_report/config',
method: 'PUT',
headers: headers,
body: dataString
};
function callback(error, response, body) {
if (!error && response.statusCode == 200) {
console.log(body);
}
}
request(options, callback);
Na ausĂȘncia de erros, serĂĄ emitido um cĂłdigo de status HTTP 200 (Ok)
. A API responderĂĄ com uma estrutura JSON cujas propriedades representarĂŁo a configuração que vocĂȘ atualizou.
Resposta
json
{
"file_name_prefix": "release-report-USER_ID",
"include_withdrawal_at_end": true,
"scheduled": false,
"execute_after_withdrawal": false,
"separator": ",",
"display_timezone": "GMT-04",
"notification_email_list": [
"example@email.com",
"john@example.com"
],
"frequency": {
"hour": 0,
"type": "monthly",
"value": 1
},
"columns": [
{
"key": "DATE"
},
{
"key": "SOURCE_ID"
},
{
"key": "EXTERNAL_REFERENCE"
}
]
}
Criar relatĂłrio manualmente
VocĂȘ tem Ă sua disposição vĂĄrios recursos que permitirĂŁo interagir com seus relatĂłrios manualmente.
Criar relatĂłrio
Faça uma requisição POST Ă API para gerar manualmente um novo relatĂłrio dentro de um intervalo de datas especĂfico:
curl -X POST \
-H 'accept: application/json' \
-H 'content-type: application/json' \
-H 'Authorization: Bearer ENV_ACCESS_TOKEN' \
'https://api.mercadopago.com/v1/account/release_report' \
-d '{
"begin_date": "2019-05-01T00:00:00Z",
"end_date": "2019-06-01T00:00:00Z"
}'
<?php
include('vendor/rmccue/requests/library/Requests.php');
Requests::register_autoloader();
$headers = array(
'accept' => 'application/json',
'content-type' => 'application/json',
'Authorization' => 'Bearer ENV_ACCESS_TOKEN'
);
$data ='{
"begin_date": "2019-05-01T00:00:00Z",
"end_date": "2019-06-01T00:00:00Z"
}';
$response = Requests::post("https://api.mercadopago.com/v1/account/release_report", $headers, $data);
URL url = new URL("https://api.mercadopago.com/v1/account/release_report");
HttpsURLConnection connection = (HttpsURLConnection) url.openConnection();
connection.setRequestMethod("POST");
connection.setRequestProperty("Accept", "application/json");
connection.setRequestProperty("Content-Type", "application/json");
connection.setRequestProperty("Authorization", "Bearer ENV_ACCESS_TOKEN");
connection.setDoOutput(true);
String body = "{\\"begin_date\\":\\"2019-05-01T00:00:00Z\\",\\"end_date\\": \\"2019-06-01T00:00:00Z\\"}";
try(OutputStream os = connection.getOutputStream()) {
byte[] input = body.getBytes("utf-8");
os.write(input, 0, input.length);
}
System.out.println(connection.getResponseCode());
System.out.println(connection.getResponseMessage());
System.out.println(connection.getInputStream());
import requests
headers = {
'accept': 'application/json',
'content-type': 'application/json',
'Authorization': 'Bearer ENV_ACCESS_TOKEN'
}
data = '{ "begin_date": "2019-05-01T00:00:00Z", "end_date": "2019-06-01T00:00:00Z" }'
response = requests.post('https://api.mercadopago.com/v1/account/release_report', headers=headers, data=data)
var request = require('request');
var headers = {
'accept': 'application/json',
'content-type': 'application/json',
'Authorization': 'Bearer ENV_ACCESS_TOKEN'
};
var dataString = '{ "begin_date": "2019-05-01T00:00:00Z", "end_date": "2019-06-01T00:00:00Z" }';
var options = {
url: 'https://api.mercadopago.com/v1/account/release_report',
method: 'POST',
headers: headers,
body: dataString
};
function callback(error, response, body) {
if (!error && response.statusCode == 200) {
console.log(body);
}
}
request(options, callback);
Na ausĂȘncia de erros, serĂĄ emitido um cĂłdigo de status HTTP 202 (Accepted)
. ApĂłs isso, o seu relatĂłrio serĂĄ gerado de forma assĂncrona. VocĂȘ receberĂĄ como resposta uma estrutura JSON com informaçÔes relevantes ao seu pedido de criação.
Consultar relatĂłrio
Consulte a API conforme abaixo para explorar a lista de relatĂłrios que vocĂȘ gerou:
curl -G \
-H 'accept: application/json' \
-d 'access_token=ENV_ACCESS_TOKEN' \
'https://api.mercadopago.com/v1/account/release_report/list'
<?php
include('vendor/rmccue/requests/library/Requests.php');
Requests::register_autoloader();
$headers = array(
'accept' => 'application/json'
);
$data = array(
'access_token' => 'ENV_ACCESS_TOKEN'
);
$response = Requests::post('https://api.mercadopago.com/v1/account/release_report/list', $headers, $data);
URL url = new URL("https://api.mercadopago.com/v1/account/release_report/list");
HttpsURLConnection connection = (HttpsURLConnection) url.openConnection();
connection.setRequestMethod("GET");
connection.setRequestProperty("Authorization", "Bearer ENV_ACCESS_TOKEN");
System.out.println(connection.getResponseCode());
System.out.println(connection.getResponseMessage());
System.out.println(connection.getInputStream());
import requests
headers = {
'accept': 'application/json',
'Authorization': 'Bearer ENV_ACCESS_TOKEN'
}
response = requests.post('https://api.mercadopago.com/v1/account/release_report/list', headers=headers)
var request = require('request');
var headers = { 'accept': 'application/json'};
var dataString = 'access_token=ENV_ACCESS_TOKEN';
var options = {
url: 'https://api.mercadopago.com/v1/account/release_report/list',
method: 'POST',
headers: headers,
body: dataString
};
function callback(error, response, body) {
if (!error && response.statusCode == 200) {
console.log(body);
}
}
request(options, callback);
Na ausĂȘncia de erros, serĂĄ emitido um cĂłdigo de status HTTP 200 (Ok)
. A API responderĂĄ com um JSON Array no qual vocĂȘ encontrarĂĄ a lista de todos os relatĂłrios que gerou.
Resposta
json
[
{
"id": 12345678,
"user_id": "USER_ID",
"begin_date": "2015-05-01T00:00:00Z",
"end_date": "2015-06-01T23:59:59Z",
"file_name": "release-report-USER_ID-2016-01-20-131015.csv",
"created_from": "manual",
"date_created": "2016-01-20T10:07:53.000-04:00"
},
{
...
}
]
Baixar relatĂłrio
Usando o atributo file_name
, vocĂȘ pode baixar qualquer um de seus relatĂłrios na seguinte URL:
curl -X GET \
-H 'Authorization: Bearer ENV_ACCESS_TOKEN' \
'https://api.mercadopago.com/v1/account/release_report/:file_name'
<?php
include('vendor/rmccue/requests/library/Requests.php');
Requests::register_autoloader();
$headers = array(
'accept' => 'application/json'
);
$data = array(
'access_token' => 'ENV_ACCESS_TOKEN'
);
$response = Requests::post('https://api.mercadopago.com/v1/account/release_report/:file_name', $headers, $data);
URL url = new URL("https://api.mercadopago.com/v1/account/release_report/:file_name");
HttpsURLConnection connection = (HttpsURLConnection) url.openConnection();
connection.setRequestMethod("GET");
connection.setRequestProperty("Authorization", "Bearer ENV_ACCESS_TOKEN");
System.out.println(connection.getResponseCode());
System.out.println(connection.getResponseMessage());
System.out.println(connection.getInputStream());
import requests
headers = {
'Authorization': 'Bearer ENV_ACCESS_TOKEN'
}
response = requests.get('https://api.mercadopago.com/v1/account/release_report/:file_name', headers=headers)
var request = require('request');
var headers = {
'Authorization': 'Bearer ENV_ACCESS_TOKEN'
};
var options = {
url: 'https://api.mercadopago.com/v1/account/release_report/:file_name',
headers: headers,
};
function callback(error, response, body) {
if (!error && response.statusCode == 200) {
console.log(body);
}
}
request(options, callback);
Na ausĂȘncia de erros, serĂĄ emitido um cĂłdigo de status HTTP 200 (Ok)
. Na resposta da API, vocĂȘ terĂĄ Ă disposição o arquivo do relatĂłrio que solicitou baixar.
Resposta
csv
DATE,SOURCE_ID,EXTERNAL_REFERENCE,RECORD_TYPE,DESCRIPTION,NET_CREDIT_AMOUNT,NET_DEBIT_AMOUNT,GROSS_AMOUNT,MP_FEE_AMOUNT,FINANCING_FEE_AMOUNT,SHIPPING_FEE_AMOUNT,TAXES_AMOUNT,COUPON_AMOUNT,INSTALLMENTS,PAYMENT_METHOD
2018-04-17T15:07:53.000-04:00,,,initial_available_balance,,813439.19,0.00,813439.19,0.00,0.00,0.00,0.00,0.00,1,
2018-04-17T15:07:53.000-04:00,,,release,withdrawal,0.00,813363.45,-813360.45,-3.00,0.00,0.00,0.00,0.00,1,
2018-04-17T15:11:12.000-04:00,,,release,payment,225.96,0.00,269.00,-43.04,0.00,0.00,0.00,0.00,1,account_money
2018-04-17T15:18:16.000-04:00,,,release,payment,124.32,0.00,148.00,-23.68,0.00,0.00,0.00,0.00,1,visa
2018-04-17T15:38:40.000-04:00,,,release,payment,820.14,0.00,1099.00,-278.86,0.00,0.00,0.00,0.00,6,visa
2018-04-17T15:38:40.000-04:00,,,release,payment,850.00,0.00,850.00,0.00,0.00,0.00,0.00,0.00,1,account_money
Agendar relatĂłrio automaticamente
Crie seus relatórios de forma programada configurando duas instùncias: ativação e desativação.
Ativar criação automåtica
Programe a criação automĂĄtica do relatĂłrio utilizando a frequĂȘncia atribuĂda durante a configuração dos seus relatĂłrios. Ao consumir este serviço, a propriedade scheduled
da sua configuração serå atualizada automaticamente para true
:
curl -X POST \
-H 'accept: application/json' \
-H 'content-type: application/json' \
-H 'Authorization: Bearer ENV_ACCESS_TOKEN' \
'https://api.mercadopago.com/v1/account/release_report/schedule'
<?php
include('vendor/rmccue/requests/library/Requests.php');
Requests::register_autoloader();
$headers = array(
'accept' => 'application/json',
'content-type' => 'application/json',
'Authorization' => 'Bearer ENV_ACCESS_TOKEN'
);
$response = Requests::post('https://api.mercadopago.com/v1/account/release_report/schedule', $headers);
URL url = new URL("https://api.mercadopago.com/v1/account/release_report/schedule");
HttpsURLConnection connection = (HttpsURLConnection) url.openConnection();
connection.setRequestMethod("POST");
connection.setRequestProperty("Accept", "application/json");
connection.setRequestProperty("Content-Type", "application/json");
connection.setRequestProperty("Authorization", "Bearer ENV_ACCESS_TOKEN");
System.out.println(connection.getResponseCode());
System.out.println(connection.getResponseMessage());
System.out.println(connection.getInputStream());
import requests
headers = {
'accept': 'application/json',
'content-type': 'application/json',
'Authorization': 'Bearer ENV_ACCESS_TOKEN'
}
response = requests.post('https://api.mercadopago.com/v1/account/release_report/schedule', headers=headers)
var request = require('request');
var headers = {
'accept': 'application/json',
'content-type': 'application/json',
'Authorization': 'Bearer ENV_ACCESS_TOKEN'
};
var options = {
url: 'https://api.mercadopago.com/v1/account/release_report/schedule',
method: 'POST',
headers: headers
};
function callback(error, response, body) {
if (!error && response.statusCode == 200) {
console.log(body);
}
}
request(options, callback);
Na ausĂȘncia de erros, serĂĄ emitido um cĂłdigo de status HTTP 200 (OK)
. A API responderĂĄ com uma estrutura JSON na qual vocĂȘ encontrarĂĄ informaçÔes associadas ao relatĂłrio que vocĂȘ agendou.
Resposta
json
{
"id": 2541818,
"user_id": "USER-ID",
"begin_date": "2019-07-01T06:00:00Z",
"end_date": "2019-08-01T05:59:59Z",
"created_from": "schedule",
"status": "pending",
"report_type": "release",
"generation_date": "2019-08-01T06:00:00.000Z",
"last_modified": "2019-07-24T13:45:33.479-04:00",
"retries": 0
}
Desativar criação automåtica
Pode desativar a geração automåtica dos seus relatórios a qualquer momento, quando necessårio. Ao consumir este serviço, a propriedade scheduled
da sua configuração serå atualizada automaticamente para false
.
curl -X DELETE \
-H 'accept: application/json' \
-H 'content-type: application/json' \
-H 'Authorization: Bearer ENV_ACCESS_TOKEN' \
'https://api.mercadopago.com/v1/account/release_report/schedule'
<?php
include('vendor/rmccue/requests/library/Requests.php');
Requests::register_autoloader();
$headers = array(
'accept' => 'application/json',
'content-type' => 'application/json',
'Authorization' => 'Bearer ENV_ACCESS_TOKEN'
);
$response = Requests::delete('https://api.mercadopago.com/v1/account/release_report/schedule', $headers);
URL url = new URL("https://api.mercadopago.com/v1/account/release_report/schedule");
HttpsURLConnection connection = (HttpsURLConnection) url.openConnection();
connection.setRequestMethod("DELETE");
connection.setRequestProperty("Accept", "application/json");
connection.setRequestProperty("Content-Type", "application/json");
connection.setRequestProperty("Authorization", "Bearer ENV_ACCESS_TOKEN");
System.out.println(connection.getResponseCode());
System.out.println(connection.getResponseMessage());
System.out.println(connection.getInputStream());
import requests
headers = {
'accept': 'application/json',
'content-type': 'application/json',
'Authorization': 'Bearer ENV_ACCESS_TOKEN'
}
response = requests.delete('https://api.mercadopago.com/v1/account/release_report/schedule', headers=headers)
var request = require('request');
var headers = {
'accept': 'application/json',
'content-type': 'application/json',
'Authorization': 'Bearer ENV_ACCESS_TOKEN'
};
var options = {
url: 'https://api.mercadopago.com/v1/account/release_report/schedule',
method: 'DELETE',
headers: headers
};
function callback(error, response, body) {
if (!error && response.statusCode == 200) {
console.log(body);
}
}
request(options, callback);
Na ausĂȘncia de erros, serĂĄ emitido um cĂłdigo de status HTTP 200 (OK)
. A API responderĂĄ com uma estrutura JSON na qual vocĂȘ encontrarĂĄ informaçÔes associadas ao relatĂłrio que desativou.
Resposta
json
{
"id": 2787882,
"begin_date": "2019-08-15T06:00:00Z",
"created_from": "schedule",
"end_date": "2019-08-16T05:59:59Z",
"generation_date": "2019-08-16T02:00:00.000-04:00",
"last_modified": "2019-08-15T15:41:53.681-04:00",
"report_type": "release",
"retries": 0,
"status": "deleted",
"user_id": USER_ID
}