Summaries

Ecart Pay provides an intuitive API for managing transactions, enabling businesses to access detailed summaries, all transactions, or individual transaction records. This system ensures precise tracking, reconciliation, and insights into the financial activities of an account.

Financial transparency and accuracy are fundamental for any business. Ecart Pay simplifies transaction management by offering tools to monitor payments received, charges paid, and withdrawals made. Businesses can retrieve transaction summaries, explore detailed records, and gain insights into financial patterns. This functionality ensures accuracy, transparency, and better decision-making in financial operations.

Why Transaction Management is Useful

Reconcile Accounts

Keep accurate records of all payments, charges, and withdrawals.

Monitor Financial Health

Gain insights into total balances, transaction history, and financial patterns.

Optimize Decision-Making

Use comprehensive data to inform financial strategies.

Support Compliance

Maintain transparent and organized records for auditing purposes.


Pagination with Token-Based Navigation

To provide high-performance navigation through large datasets, the GET /api/transactions endpoint utilizes Token-Based Pagination. Unlike traditional offset pagination (using skip), tokens allow the database to jump directly to a specific point in the result set, ensuring consistent response times even when browsing millions of records.

The token_page and next_token fields

  • Type: String (Base64 Encoded)
  • token_page Description: Token representing the current page position. Use it with prev to navigate backwards.
  • next_token Description: Token representing the next page position. Use it with next to navigate forwards.

Pagination Methods

Standard Pagination (Pages 1-10)

Use page and limit parameters:

  • GET /api/transactions?page=2&limit=50

Note: The page parameter is limited to a maximum of 10. For results beyond page 10, you must use token-based pagination.

Token-Based Pagination (Recommended for large datasets)

1234

Step 1: Initial Request

Perform your search as usual:

GET /api/transactions?limit=50
❗️

IMPORTANT

Both the token_page and next_token values must be URL encoded before being sent as query params.

URL Encoding Requirement

Important: Token values are Base64 encoded and may contain special characters (+, /, =) that must be URL-encoded when passed as a query parameter.

CharacterURL Encoded
+%2B
/%2F
=%3D
&%26

Example: If your next_token is CKfeARoJKYMScK+bAQAAIg5aDGlkNUQADQ99Pt0qjQ==, you should pass it as:
GET /api/transactions?next=CKfeARoJKYMScK%2BbAQAAIg5aDGlkNUQADQ99Pt0qjQ%3D%3D

Most HTTP clients and libraries handle URL encoding automatically. If you encounter a 422 error with the message "searchAfter" Invalid format for token value, ensure the token is properly URL-encoded.

Important Constraints

  • Query Semantics: The token is only valid if the search filters, query strings, and sort order remain identical to the original request. Changing these parameters will invalidate the token.
  • Page Limit: Standard pagination is limited to pages 1-10. Beyond page 10, you must use the next parameter.
  • Performance: We strongly recommend using token-based pagination instead of high page values to avoid performance degradation.


⚠️

IMPORTANT

To follow the steps below, it is essential to have the corresponding Authorization Token. For more information, please refer to the following documentation page: Authorization Token

Retrieve All Transactions

Retrieves a detailed list of all transactions in the account. By default, this endpoint returns the transactions from the last 30 days.

💻

Visit our API Reference to test this endpoint.

Endpoint

GET {{baseURL}}/api/transactions

Headers

  • Authorization: {token}

Query Parameters

ParameterTypeDescription
pagenumberPage number (1-10 only, default: 1). For results beyond page 10, use the next parameter.
limitnumberResults per page (max 250, default: 50).
nextstringToken for fetching the next page. Use the next_token value from a previous response. URL encode before using.
prevstringToken for fetching the previous page. Use the token_page value from a previous response. URL encode before using.
qstringSearch string for filtering transactions.
typestringFilter by transaction type (e.g., "payment", "charge").
statusstringFilter by transaction status (e.g., "paid", "processing", "pending", "blocked").
currencystringFilter by currency (e.g., "MXN", "USD").
gatewaystringFilter by gateway (e.g., "ecartpay", "stripe").
created_at[from]dateFilter transactions starting from this date (ISO 8601 format).
created_at[to]dateFilter transactions up to this date (ISO 8601 format).

Response Key Values

FieldTypeDescription
countnumberTotal number of transactions matching the query.
docsarrayArray of transaction objects.
pagesnumberTotal number of pages available.
token_pagestringA Base64-encoded token to use with prev parameters for pagination.
next_tokenstringA Base64-encoded token representing the last document in the current page. Use this with the next parameter to navigate to the next page of results.

Example Request

postman request 'http://sandbox.ecartpay.com/api/transactions?limit=5&created_at[from]=2025-01-01&created_at[to]=2025-12-31' \
  --header 'Authorization: eyJhbGciOiJIUzUxMiIsInR5cCI6IkpXVCJ9.eyJpZCI6IjY4YTRjMzE1MGIyOGE5NTg0MzA1YTJhYSIsImFjY291bnRfaWQiOiI2OGE0YzMxNTBiMjhhOTU4NDMwNWEyYTYiLCJhY2NvdW50Ijp7ImVtYWlsIjoiaHVnby5tb3JpbkBlY2FydHBheS5jb20iLCJmaXJzdF9uYW1lIjoiSHVnbyIsImxhc3RfbmFtZSI6Ik1vcsOtbiIsInBob25lIjoiNTI5OTk5OTk5OTk5IiwiY291bnRyeSI6Ik1YIiwiY3VycmVuY3kiOiJNWE4iLCJ2ZXJpZmllZCI6dHJ1ZSwiYWN0aXZlIjp0cnVlLCJpbWFnZSI6Imh0dHBzOi8vZWNhcnRwYXktYXNzZXRzLnMzLmFtYXpvbmF3cy5jb20vdGVzdC9odWdvXzEucG5nIiwiYmV0YXMiOnsiY2hlY2tvdXRfdjIiOnRydWUsImNoZWNrb3V0X3YyX2N1cnJlbmNpZXMiOlsiTVhOIl19fSwiaWF0IjoxNzcwNzUyNzQ2LCJleHAiOjE3NzA3NTYzNDZ9.WpLtuoxZa1jA8Mh3FPzJpfhblQv33k2loWoxfyYOhqMvJdmIVWK5S2alC9kxBRcwNzyLRT0_iK4qIEItTU-yIw'
package main

import (
  "fmt"
  "net/http"
  "io"
)

func main() {

  url := "https://sandbox.ecartpay.com/api/transactions"
  method := "GET"

  client := &http.Client {
  }
  req, err := http.NewRequest(method, url, nil)

  if err != nil {
    fmt.Println(err)
    return
  }
  req.Header.Add("Authorization", "eyJhbGciOiJIUzUxMiIsInR5cCI6IkpXVCJ9.eyJpZCI6IjY3MmE4NTAzNzFiZTBlY2Y1NTRkMDUxNiIsImFjY291bnRfaWQiOiI2NzJhODUwMzcxYmUwZWNmNTU0ZDA1MGMiLCJpYXQiOjE3Mzg2OTA5NDQsImV4cCI6MTczODY5NDU0NH0.eJ7LOLmSwZBVcdol6_7trjeNQBQKjF0IGnJnWrqwpi80Fm5OlezbV2V0rhKmrFA5kW8o7REniUSWEVCIQcrb4A")
  req.Header.Add("Cookie", "lang=en")

  res, err := client.Do(req)
  if err != nil {
    fmt.Println(err)
    return
  }
  defer res.Body.Close()

  body, err := io.ReadAll(res.Body)
  if err != nil {
    fmt.Println(err)
    return
  }
  fmt.Println(string(body))
}
GET /api/transactions HTTP/1.1
Host: sandbox.ecartpay.com
Authorization: eyJhbGciOiJIUzUxMiIsInR5cCI6IkpXVCJ9.eyJpZCI6IjY3MmE4NTAzNzFiZTBlY2Y1NTRkMDUxNiIsImFjY291bnRfaWQiOiI2NzJhODUwMzcxYmUwZWNmNTU0ZDA1MGMiLCJpYXQiOjE3Mzg2OTA5NDQsImV4cCI6MTczODY5NDU0NH0.eJ7LOLmSwZBVcdol6_7trjeNQBQKjF0IGnJnWrqwpi80Fm5OlezbV2V0rhKmrFA5kW8o7REniUSWEVCIQcrb4A
Cookie: lang=en
// OkHttp

OkHttpClient client = new OkHttpClient().newBuilder()
  .build();
MediaType mediaType = MediaType.parse("text/plain");
RequestBody body = RequestBody.create(mediaType, "");
Request request = new Request.Builder()
  .url("https://sandbox.ecartpay.com/api/transactions")
  .method("GET", body)
  .addHeader("Authorization", "eyJhbGciOiJIUzUxMiIsInR5cCI6IkpXVCJ9.eyJpZCI6IjY3MmE4NTAzNzFiZTBlY2Y1NTRkMDUxNiIsImFjY291bnRfaWQiOiI2NzJhODUwMzcxYmUwZWNmNTU0ZDA1MGMiLCJpYXQiOjE3Mzg2OTA5NDQsImV4cCI6MTczODY5NDU0NH0.eJ7LOLmSwZBVcdol6_7trjeNQBQKjF0IGnJnWrqwpi80Fm5OlezbV2V0rhKmrFA5kW8o7REniUSWEVCIQcrb4A")
  .addHeader("Cookie", "lang=en")
  .build();
Response response = client.newCall(request).execute();

// -------------------------------------------------------------

// Unirest

Unirest.setTimeouts(0, 0);
HttpResponse<String> response = Unirest.get("https://sandbox.ecartpay.com/api/transactions")
  .header("Authorization", "eyJhbGciOiJIUzUxMiIsInR5cCI6IkpXVCJ9.eyJpZCI6IjY3MmE4NTAzNzFiZTBlY2Y1NTRkMDUxNiIsImFjY291bnRfaWQiOiI2NzJhODUwMzcxYmUwZWNmNTU0ZDA1MGMiLCJpYXQiOjE3Mzg2OTA5NDQsImV4cCI6MTczODY5NDU0NH0.eJ7LOLmSwZBVcdol6_7trjeNQBQKjF0IGnJnWrqwpi80Fm5OlezbV2V0rhKmrFA5kW8o7REniUSWEVCIQcrb4A")
  .header("Cookie", "lang=en")
  .asString();
// Fetch

const myHeaders = new Headers();
myHeaders.append("Authorization", "eyJhbGciOiJIUzUxMiIsInR5cCI6IkpXVCJ9.eyJpZCI6IjY3MmE4NTAzNzFiZTBlY2Y1NTRkMDUxNiIsImFjY291bnRfaWQiOiI2NzJhODUwMzcxYmUwZWNmNTU0ZDA1MGMiLCJpYXQiOjE3Mzg2OTA5NDQsImV4cCI6MTczODY5NDU0NH0.eJ7LOLmSwZBVcdol6_7trjeNQBQKjF0IGnJnWrqwpi80Fm5OlezbV2V0rhKmrFA5kW8o7REniUSWEVCIQcrb4A");
myHeaders.append("Cookie", "lang=en");

const requestOptions = {
  method: "GET",
  headers: myHeaders,
  redirect: "follow"
};

fetch("https://sandbox.ecartpay.com/api/transactions", requestOptions)
  .then((response) => response.text())
  .then((result) => console.log(result))
  .catch((error) => console.error(error));

// -------------------------------------------------------------

// jQuery

var settings = {
  "url": "https://sandbox.ecartpay.com/api/transactions",
  "method": "GET",
  "timeout": 0,
  "headers": {
    "Authorization": "eyJhbGciOiJIUzUxMiIsInR5cCI6IkpXVCJ9.eyJpZCI6IjY3MmE4NTAzNzFiZTBlY2Y1NTRkMDUxNiIsImFjY291bnRfaWQiOiI2NzJhODUwMzcxYmUwZWNmNTU0ZDA1MGMiLCJpYXQiOjE3Mzg2OTA5NDQsImV4cCI6MTczODY5NDU0NH0.eJ7LOLmSwZBVcdol6_7trjeNQBQKjF0IGnJnWrqwpi80Fm5OlezbV2V0rhKmrFA5kW8o7REniUSWEVCIQcrb4A",
    "Cookie": "lang=en"
  },
};

$.ajax(settings).done(function (response) {
  console.log(response);
});

// -------------------------------------------------------------

// XHR

// WARNING: For GET requests, body is set to null by browsers.

var xhr = new XMLHttpRequest();
xhr.withCredentials = true;

xhr.addEventListener("readystatechange", function() {
  if(this.readyState === 4) {
    console.log(this.responseText);
  }
});

xhr.open("GET", "https://sandbox.ecartpay.com/api/transactions");
xhr.setRequestHeader("Authorization", "eyJhbGciOiJIUzUxMiIsInR5cCI6IkpXVCJ9.eyJpZCI6IjY3MmE4NTAzNzFiZTBlY2Y1NTRkMDUxNiIsImFjY291bnRfaWQiOiI2NzJhODUwMzcxYmUwZWNmNTU0ZDA1MGMiLCJpYXQiOjE3Mzg2OTA5NDQsImV4cCI6MTczODY5NDU0NH0.eJ7LOLmSwZBVcdol6_7trjeNQBQKjF0IGnJnWrqwpi80Fm5OlezbV2V0rhKmrFA5kW8o7REniUSWEVCIQcrb4A");
// WARNING: Cookies will be stripped away by the browser before sending the request.
xhr.setRequestHeader("Cookie", "lang=en");

xhr.send();
CURL *curl;
CURLcode res;
curl = curl_easy_init();
if(curl) {
  curl_easy_setopt(curl, CURLOPT_CUSTOMREQUEST, "GET");
  curl_easy_setopt(curl, CURLOPT_URL, "https://sandbox.ecartpay.com/api/transactions");
  curl_easy_setopt(curl, CURLOPT_FOLLOWLOCATION, 1L);
  curl_easy_setopt(curl, CURLOPT_DEFAULT_PROTOCOL, "https");
  struct curl_slist *headers = NULL;
  headers = curl_slist_append(headers, "Authorization: eyJhbGciOiJIUzUxMiIsInR5cCI6IkpXVCJ9.eyJpZCI6IjY3MmE4NTAzNzFiZTBlY2Y1NTRkMDUxNiIsImFjY291bnRfaWQiOiI2NzJhODUwMzcxYmUwZWNmNTU0ZDA1MGMiLCJpYXQiOjE3Mzg2OTA5NDQsImV4cCI6MTczODY5NDU0NH0.eJ7LOLmSwZBVcdol6_7trjeNQBQKjF0IGnJnWrqwpi80Fm5OlezbV2V0rhKmrFA5kW8o7REniUSWEVCIQcrb4A");
  headers = curl_slist_append(headers, "Cookie: lang=en");
  curl_easy_setopt(curl, CURLOPT_HTTPHEADER, headers);
  res = curl_easy_perform(curl);
  curl_slist_free_all(headers);
}
curl_easy_cleanup(curl);
// Axios

const axios = require('axios');

let config = {
  method: 'get',
  maxBodyLength: Infinity,
  url: 'https://sandbox.ecartpay.com/api/transactions',
  headers: { 
    'Authorization': 'eyJhbGciOiJIUzUxMiIsInR5cCI6IkpXVCJ9.eyJpZCI6IjY3MmE4NTAzNzFiZTBlY2Y1NTRkMDUxNiIsImFjY291bnRfaWQiOiI2NzJhODUwMzcxYmUwZWNmNTU0ZDA1MGMiLCJpYXQiOjE3Mzg2OTA5NDQsImV4cCI6MTczODY5NDU0NH0.eJ7LOLmSwZBVcdol6_7trjeNQBQKjF0IGnJnWrqwpi80Fm5OlezbV2V0rhKmrFA5kW8o7REniUSWEVCIQcrb4A', 
    'Cookie': 'lang=en'
  }
};

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

// -------------------------------------------------------------

// Native

var https = require('follow-redirects').https;
var fs = require('fs');

var options = {
  'method': 'GET',
  'hostname': 'sandbox.ecartpay.com',
  'path': '/api/transactions',
  'headers': {
    'Authorization': 'eyJhbGciOiJIUzUxMiIsInR5cCI6IkpXVCJ9.eyJpZCI6IjY3MmE4NTAzNzFiZTBlY2Y1NTRkMDUxNiIsImFjY291bnRfaWQiOiI2NzJhODUwMzcxYmUwZWNmNTU0ZDA1MGMiLCJpYXQiOjE3Mzg2OTA5NDQsImV4cCI6MTczODY5NDU0NH0.eJ7LOLmSwZBVcdol6_7trjeNQBQKjF0IGnJnWrqwpi80Fm5OlezbV2V0rhKmrFA5kW8o7REniUSWEVCIQcrb4A',
    'Cookie': 'lang=en'
  },
  'maxRedirects': 20
};

var req = https.request(options, function (res) {
  var chunks = [];

  res.on("data", function (chunk) {
    chunks.push(chunk);
  });

  res.on("end", function (chunk) {
    var body = Buffer.concat(chunks);
    console.log(body.toString());
  });

  res.on("error", function (error) {
    console.error(error);
  });
});

req.end();

// -------------------------------------------------------------

// Request

var request = require('request');
var options = {
  'method': 'GET',
  'url': 'https://sandbox.ecartpay.com/api/transactions',
  'headers': {
    'Authorization': 'eyJhbGciOiJIUzUxMiIsInR5cCI6IkpXVCJ9.eyJpZCI6IjY3MmE4NTAzNzFiZTBlY2Y1NTRkMDUxNiIsImFjY291bnRfaWQiOiI2NzJhODUwMzcxYmUwZWNmNTU0ZDA1MGMiLCJpYXQiOjE3Mzg2OTA5NDQsImV4cCI6MTczODY5NDU0NH0.eJ7LOLmSwZBVcdol6_7trjeNQBQKjF0IGnJnWrqwpi80Fm5OlezbV2V0rhKmrFA5kW8o7REniUSWEVCIQcrb4A',
    'Cookie': 'lang=en'
  }
};
request(options, function (error, response) {
  if (error) throw new Error(error);
  console.log(response.body);
});

// -------------------------------------------------------------

// Unirest

var unirest = require('unirest');
var req = unirest('GET', 'https://sandbox.ecartpay.com/api/transactions')
  .headers({
    'Authorization': 'eyJhbGciOiJIUzUxMiIsInR5cCI6IkpXVCJ9.eyJpZCI6IjY3MmE4NTAzNzFiZTBlY2Y1NTRkMDUxNiIsImFjY291bnRfaWQiOiI2NzJhODUwMzcxYmUwZWNmNTU0ZDA1MGMiLCJpYXQiOjE3Mzg2OTA5NDQsImV4cCI6MTczODY5NDU0NH0.eJ7LOLmSwZBVcdol6_7trjeNQBQKjF0IGnJnWrqwpi80Fm5OlezbV2V0rhKmrFA5kW8o7REniUSWEVCIQcrb4A',
    'Cookie': 'lang=en'
  })
  .end(function (res) { 
    if (res.error) throw new Error(res.error); 
    console.log(res.raw_body);
  });
#import <Foundation/Foundation.h>

dispatch_semaphore_t sema = dispatch_semaphore_create(0);

NSMutableURLRequest *request = [NSMutableURLRequest requestWithURL:[NSURL URLWithString:@"https://sandbox.ecartpay.com/api/transactions"]
  cachePolicy:NSURLRequestUseProtocolCachePolicy
  timeoutInterval:10.0];
NSDictionary *headers = @{
  @"Authorization": @"eyJhbGciOiJIUzUxMiIsInR5cCI6IkpXVCJ9.eyJpZCI6IjY3MmE4NTAzNzFiZTBlY2Y1NTRkMDUxNiIsImFjY291bnRfaWQiOiI2NzJhODUwMzcxYmUwZWNmNTU0ZDA1MGMiLCJpYXQiOjE3Mzg2OTA5NDQsImV4cCI6MTczODY5NDU0NH0.eJ7LOLmSwZBVcdol6_7trjeNQBQKjF0IGnJnWrqwpi80Fm5OlezbV2V0rhKmrFA5kW8o7REniUSWEVCIQcrb4A",
  @"Cookie": @"lang=en"
};

[request setAllHTTPHeaderFields:headers];

[request setHTTPMethod:@"GET"];

NSURLSession *session = [NSURLSession sharedSession];
NSURLSessionDataTask *dataTask = [session dataTaskWithRequest:request
completionHandler:^(NSData *data, NSURLResponse *response, NSError *error) {
  if (error) {
    NSLog(@"%@", error);
    dispatch_semaphore_signal(sema);
  } else {
    NSHTTPURLResponse *httpResponse = (NSHTTPURLResponse *) response;
    NSError *parseError = nil;
    NSDictionary *responseDictionary = [NSJSONSerialization JSONObjectWithData:data options:0 error:&parseError];
    NSLog(@"%@",responseDictionary);
    dispatch_semaphore_signal(sema);
  }
}];
[dataTask resume];
dispatch_semaphore_wait(sema, DISPATCH_TIME_FOREVER);
open Lwt
open Cohttp
open Cohttp_lwt_unix

let reqBody = 
  let uri = Uri.of_string "https://sandbox.ecartpay.com/api/transactions" in
  let headers = Header.init ()
    |> fun h -> Header.add h "Authorization" "eyJhbGciOiJIUzUxMiIsInR5cCI6IkpXVCJ9.eyJpZCI6IjY3MmE4NTAzNzFiZTBlY2Y1NTRkMDUxNiIsImFjY291bnRfaWQiOiI2NzJhODUwMzcxYmUwZWNmNTU0ZDA1MGMiLCJpYXQiOjE3Mzg2OTA5NDQsImV4cCI6MTczODY5NDU0NH0.eJ7LOLmSwZBVcdol6_7trjeNQBQKjF0IGnJnWrqwpi80Fm5OlezbV2V0rhKmrFA5kW8o7REniUSWEVCIQcrb4A"
    |> fun h -> Header.add h "Cookie" "lang=en"
  in
  Client.call ~headers `GET uri >>= fun (_resp, body) ->
  body |> Cohttp_lwt.Body.to_string >|= fun body -> body

let () =
  let respBody = Lwt_main.run reqBody in
  print_endline (respBody)
// cURL

<?php

$curl = curl_init();

curl_setopt_array($curl, array(
  CURLOPT_URL => 'https://sandbox.ecartpay.com/api/transactions',
  CURLOPT_RETURNTRANSFER => true,
  CURLOPT_ENCODING => '',
  CURLOPT_MAXREDIRS => 10,
  CURLOPT_TIMEOUT => 0,
  CURLOPT_FOLLOWLOCATION => true,
  CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
  CURLOPT_CUSTOMREQUEST => 'GET',
  CURLOPT_HTTPHEADER => array(
    'Authorization: eyJhbGciOiJIUzUxMiIsInR5cCI6IkpXVCJ9.eyJpZCI6IjY3MmE4NTAzNzFiZTBlY2Y1NTRkMDUxNiIsImFjY291bnRfaWQiOiI2NzJhODUwMzcxYmUwZWNmNTU0ZDA1MGMiLCJpYXQiOjE3Mzg2OTA5NDQsImV4cCI6MTczODY5NDU0NH0.eJ7LOLmSwZBVcdol6_7trjeNQBQKjF0IGnJnWrqwpi80Fm5OlezbV2V0rhKmrFA5kW8o7REniUSWEVCIQcrb4A',
    'Cookie: lang=en'
  ),
));

$response = curl_exec($curl);

curl_close($curl);
echo $response;

// -------------------------------------------------------------

// Guzzle

<?php
$client = new Client();
$headers = [
  'Authorization' => 'eyJhbGciOiJIUzUxMiIsInR5cCI6IkpXVCJ9.eyJpZCI6IjY3MmE4NTAzNzFiZTBlY2Y1NTRkMDUxNiIsImFjY291bnRfaWQiOiI2NzJhODUwMzcxYmUwZWNmNTU0ZDA1MGMiLCJpYXQiOjE3Mzg2OTA5NDQsImV4cCI6MTczODY5NDU0NH0.eJ7LOLmSwZBVcdol6_7trjeNQBQKjF0IGnJnWrqwpi80Fm5OlezbV2V0rhKmrFA5kW8o7REniUSWEVCIQcrb4A',
  'Cookie' => 'lang=en'
];
$request = new Request('GET', 'https://sandbox.ecartpay.com/api/transactions', $headers);
$res = $client->sendAsync($request)->wait();
echo $res->getBody();

// -------------------------------------------------------------

// HTTP_Request2

<?php
require_once 'HTTP/Request2.php';
$request = new HTTP_Request2();
$request->setUrl('https://sandbox.ecartpay.com/api/transactions');
$request->setMethod(HTTP_Request2::METHOD_GET);
$request->setConfig(array(
  'follow_redirects' => TRUE
));
$request->setHeader(array(
  'Authorization' => 'eyJhbGciOiJIUzUxMiIsInR5cCI6IkpXVCJ9.eyJpZCI6IjY3MmE4NTAzNzFiZTBlY2Y1NTRkMDUxNiIsImFjY291bnRfaWQiOiI2NzJhODUwMzcxYmUwZWNmNTU0ZDA1MGMiLCJpYXQiOjE3Mzg2OTA5NDQsImV4cCI6MTczODY5NDU0NH0.eJ7LOLmSwZBVcdol6_7trjeNQBQKjF0IGnJnWrqwpi80Fm5OlezbV2V0rhKmrFA5kW8o7REniUSWEVCIQcrb4A',
  'Cookie' => 'lang=en'
));
try {
  $response = $request->send();
  if ($response->getStatus() == 200) {
    echo $response->getBody();
  }
  else {
    echo 'Unexpected HTTP status: ' . $response->getStatus() . ' ' .
    $response->getReasonPhrase();
  }
}
catch(HTTP_Request2_Exception $e) {
  echo 'Error: ' . $e->getMessage();
}

// -------------------------------------------------------------

// pecl_http

<?php
$client = new http\Client;
$request = new http\Client\Request;
$request->setRequestUrl('https://sandbox.ecartpay.com/api/transactions');
$request->setRequestMethod('GET');
$request->setOptions(array());
$request->setHeaders(array(
  'Authorization' => 'eyJhbGciOiJIUzUxMiIsInR5cCI6IkpXVCJ9.eyJpZCI6IjY3MmE4NTAzNzFiZTBlY2Y1NTRkMDUxNiIsImFjY291bnRfaWQiOiI2NzJhODUwMzcxYmUwZWNmNTU0ZDA1MGMiLCJpYXQiOjE3Mzg2OTA5NDQsImV4cCI6MTczODY5NDU0NH0.eJ7LOLmSwZBVcdol6_7trjeNQBQKjF0IGnJnWrqwpi80Fm5OlezbV2V0rhKmrFA5kW8o7REniUSWEVCIQcrb4A',
  'Cookie' => 'lang=en'
));
$client->enqueue($request)->send();
$response = $client->getResponse();
echo $response->getBody();
$headers = New-Object "System.Collections.Generic.Dictionary[[String],[String]]"
$headers.Add("Authorization", "eyJhbGciOiJIUzUxMiIsInR5cCI6IkpXVCJ9.eyJpZCI6IjY3MmE4NTAzNzFiZTBlY2Y1NTRkMDUxNiIsImFjY291bnRfaWQiOiI2NzJhODUwMzcxYmUwZWNmNTU0ZDA1MGMiLCJpYXQiOjE3Mzg2OTA5NDQsImV4cCI6MTczODY5NDU0NH0.eJ7LOLmSwZBVcdol6_7trjeNQBQKjF0IGnJnWrqwpi80Fm5OlezbV2V0rhKmrFA5kW8o7REniUSWEVCIQcrb4A")
$headers.Add("Cookie", "lang=en")

$response = Invoke-RestMethod 'https://sandbox.ecartpay.com/api/transactions' -Method 'GET' -Headers $headers
$response | ConvertTo-Json
# http.client

import http.client

conn = http.client.HTTPSConnection("sandbox.ecartpay.com")
payload = ''
headers = {
  'Authorization': 'eyJhbGciOiJIUzUxMiIsInR5cCI6IkpXVCJ9.eyJpZCI6IjY3MmE4NTAzNzFiZTBlY2Y1NTRkMDUxNiIsImFjY291bnRfaWQiOiI2NzJhODUwMzcxYmUwZWNmNTU0ZDA1MGMiLCJpYXQiOjE3Mzg2OTA5NDQsImV4cCI6MTczODY5NDU0NH0.eJ7LOLmSwZBVcdol6_7trjeNQBQKjF0IGnJnWrqwpi80Fm5OlezbV2V0rhKmrFA5kW8o7REniUSWEVCIQcrb4A',
  'Cookie': 'lang=en'
}
conn.request("GET", "/api/transactions", payload, headers)
res = conn.getresponse()
data = res.read()
print(data.decode("utf-8"))

// -------------------------------------------------------------

# Requests

import requests

url = "https://sandbox.ecartpay.com/api/transactions"

payload = {}
headers = {
  'Authorization': 'eyJhbGciOiJIUzUxMiIsInR5cCI6IkpXVCJ9.eyJpZCI6IjY3MmE4NTAzNzFiZTBlY2Y1NTRkMDUxNiIsImFjY291bnRfaWQiOiI2NzJhODUwMzcxYmUwZWNmNTU0ZDA1MGMiLCJpYXQiOjE3Mzg2OTA5NDQsImV4cCI6MTczODY5NDU0NH0.eJ7LOLmSwZBVcdol6_7trjeNQBQKjF0IGnJnWrqwpi80Fm5OlezbV2V0rhKmrFA5kW8o7REniUSWEVCIQcrb4A',
  'Cookie': 'lang=en'
}

response = requests.request("GET", url, headers=headers, data=payload)

print(response.text)
# httr

library(httr)

headers = c(
  'Authorization' = 'eyJhbGciOiJIUzUxMiIsInR5cCI6IkpXVCJ9.eyJpZCI6IjY3MmE4NTAzNzFiZTBlY2Y1NTRkMDUxNiIsImFjY291bnRfaWQiOiI2NzJhODUwMzcxYmUwZWNmNTU0ZDA1MGMiLCJpYXQiOjE3Mzg2OTA5NDQsImV4cCI6MTczODY5NDU0NH0.eJ7LOLmSwZBVcdol6_7trjeNQBQKjF0IGnJnWrqwpi80Fm5OlezbV2V0rhKmrFA5kW8o7REniUSWEVCIQcrb4A',
  'Cookie' = 'lang=en'
)

res <- VERB("GET", url = "https://sandbox.ecartpay.com/api/transactions", add_headers(headers))

cat(content(res, 'text'))

// -------------------------------------------------------------

# RCurl

library(RCurl)
headers = c(
  "Authorization" = "eyJhbGciOiJIUzUxMiIsInR5cCI6IkpXVCJ9.eyJpZCI6IjY3MmE4NTAzNzFiZTBlY2Y1NTRkMDUxNiIsImFjY291bnRfaWQiOiI2NzJhODUwMzcxYmUwZWNmNTU0ZDA1MGMiLCJpYXQiOjE3Mzg2OTA5NDQsImV4cCI6MTczODY5NDU0NH0.eJ7LOLmSwZBVcdol6_7trjeNQBQKjF0IGnJnWrqwpi80Fm5OlezbV2V0rhKmrFA5kW8o7REniUSWEVCIQcrb4A",
  "Cookie" = "lang=en"
)
res <- getURL("https://sandbox.ecartpay.com/api/transactions", .opts=list(httpheader = headers, followlocation = TRUE))
cat(res)
require "uri"
require "net/http"

url = URI("https://sandbox.ecartpay.com/api/transactions")

https = Net::HTTP.new(url.host, url.port)
https.use_ssl = true

request = Net::HTTP::Get.new(url)
request["Authorization"] = "eyJhbGciOiJIUzUxMiIsInR5cCI6IkpXVCJ9.eyJpZCI6IjY3MmE4NTAzNzFiZTBlY2Y1NTRkMDUxNiIsImFjY291bnRfaWQiOiI2NzJhODUwMzcxYmUwZWNmNTU0ZDA1MGMiLCJpYXQiOjE3Mzg2OTA5NDQsImV4cCI6MTczODY5NDU0NH0.eJ7LOLmSwZBVcdol6_7trjeNQBQKjF0IGnJnWrqwpi80Fm5OlezbV2V0rhKmrFA5kW8o7REniUSWEVCIQcrb4A"
request["Cookie"] = "lang=en"

response = https.request(request)
puts response.read_body
#[tokio::main]
async fn main() -> Result<(), Box<dyn std::error::Error>> {
    let client = reqwest::Client::builder()
        .build()?;

    let mut headers = reqwest::header::HeaderMap::new();
    headers.insert("Authorization", "eyJhbGciOiJIUzUxMiIsInR5cCI6IkpXVCJ9.eyJpZCI6IjY3MmE4NTAzNzFiZTBlY2Y1NTRkMDUxNiIsImFjY291bnRfaWQiOiI2NzJhODUwMzcxYmUwZWNmNTU0ZDA1MGMiLCJpYXQiOjE3Mzg2OTA5NDQsImV4cCI6MTczODY5NDU0NH0.eJ7LOLmSwZBVcdol6_7trjeNQBQKjF0IGnJnWrqwpi80Fm5OlezbV2V0rhKmrFA5kW8o7REniUSWEVCIQcrb4A".parse()?);
    headers.insert("Cookie", "lang=en".parse()?);

    let request = client.request(reqwest::Method::GET, "https://sandbox.ecartpay.com/api/transactions")
        .headers(headers);

    let response = request.send().await?;
    let body = response.text().await?;

    println!("{}", body);

    Ok(())
}
# Httpie

http --follow --timeout 3600 GET 'https://sandbox.ecartpay.com/api/transactions' \
 Authorization:'eyJhbGciOiJIUzUxMiIsInR5cCI6IkpXVCJ9.eyJpZCI6IjY3MmE4NTAzNzFiZTBlY2Y1NTRkMDUxNiIsImFjY291bnRfaWQiOiI2NzJhODUwMzcxYmUwZWNmNTU0ZDA1MGMiLCJpYXQiOjE3Mzg2OTA5NDQsImV4cCI6MTczODY5NDU0NH0.eJ7LOLmSwZBVcdol6_7trjeNQBQKjF0IGnJnWrqwpi80Fm5OlezbV2V0rhKmrFA5kW8o7REniUSWEVCIQcrb4A' \
 Cookie:'lang=en'

// -------------------------------------------------------------

# wget

wget --no-check-certificate --quiet \
  --method GET \
  --timeout=0 \
  --header 'Authorization: eyJhbGciOiJIUzUxMiIsInR5cCI6IkpXVCJ9.eyJpZCI6IjY3MmE4NTAzNzFiZTBlY2Y1NTRkMDUxNiIsImFjY291bnRfaWQiOiI2NzJhODUwMzcxYmUwZWNmNTU0ZDA1MGMiLCJpYXQiOjE3Mzg2OTA5NDQsImV4cCI6MTczODY5NDU0NH0.eJ7LOLmSwZBVcdol6_7trjeNQBQKjF0IGnJnWrqwpi80Fm5OlezbV2V0rhKmrFA5kW8o7REniUSWEVCIQcrb4A' \
  --header 'Cookie: lang=en' \
   'https://sandbox.ecartpay.com/api/transactions'
var request = URLRequest(url: URL(string: "https://sandbox.ecartpay.com/api/transactions")!,timeoutInterval: Double.infinity)
request.addValue("eyJhbGciOiJIUzUxMiIsInR5cCI6IkpXVCJ9.eyJpZCI6IjY3MmE4NTAzNzFiZTBlY2Y1NTRkMDUxNiIsImFjY291bnRfaWQiOiI2NzJhODUwMzcxYmUwZWNmNTU0ZDA1MGMiLCJpYXQiOjE3Mzg2OTA5NDQsImV4cCI6MTczODY5NDU0NH0.eJ7LOLmSwZBVcdol6_7trjeNQBQKjF0IGnJnWrqwpi80Fm5OlezbV2V0rhKmrFA5kW8o7REniUSWEVCIQcrb4A", forHTTPHeaderField: "Authorization")
request.addValue("lang=en", forHTTPHeaderField: "Cookie")

request.httpMethod = "GET"

let task = URLSession.shared.dataTask(with: request) { data, response, error in 
  guard let data = data else {
    print(String(describing: error))
    return
  }
  print(String(data: data, encoding: .utf8)!)
}

task.resume()

Example Response

{
    "count": 83,
    "docs": [
        {
            "id": "6950926005cbfa6601c0dda2",
            "account_id": "68a4c3150b28a9584305a2a6",
            "refund_id": "6950925f05cbfa6601c0dd93",
            "transaction_id": "TR0000016663",
            "type": "charge",
            "status": "paid",
            "amount": 50,
            "fee": 0,
            "fee_details": {
                "fixed": 0,
                "percent": 0,
                "tax": 0,
                "percent_amount": 0,
                "msi_percent": 0,
                "msi_amount": 0,
                "fixed_installments_amount": 0,
                "fixed_installments_percent": 0,
                "installments_fee": 0
            },
            "installments": 1,
            "total": 50,
            "previous": -4387.99,
            "current": -4437.99,
            "currency": "MXN",
            "gateway": "ecartpay",
            "exchange": 1,
            "reference_id": "6950926005cbfa6601c0dd9f",
            "reference": "6950926005cbfa6601c0dda0",
            "reason": "refund",
            "custom_keys": false,
            "charges": [],
            "available_at": "2025-12-28T02:13:52.510Z",
            "b2b_metadata": {
                "b2b_transactions": []
            },
            "created_at": "2025-12-28T02:13:52.633Z",
            "updated_at": "2025-12-28T02:13:53.275Z"
        },
        {
            "id": "69509252a0526f0bc30befe2",
            "account_id": "68a4c3150b28a9584305a2a6",
            "affiliation_number": "SANDBOX-10-12-17",
            "activity_id": "69509250a0526f0bc30befcd",
            "order_id": "69509246a0526f0bc30befb7",
            "customer_id": "68dea001d3d53b7a568e2686",
            "account_customer_id": "68dea146d3d53b7a568e2779",
            "transaction_id": "TR0000016662",
            "type": "payment",
            "status": "refunded",
            "amount": 44.14,
            "fee": 5.86,
            "fee_details": {
                "fixed": 3.6,
                "percent": 2.9,
                "tax": 0.81,
                "percent_amount": 1.45,
                "msi_percent": 0,
                "msi_amount": 0,
                "fixed_installments_amount": 0,
                "fixed_installments_percent": 0,
                "installments_fee": 0
            },
            "installments": 1,
            "total": 50,
            "previous": -4432.13,
            "current": -4387.99,
            "currency": "MXN",
            "gateway": "ecartpay",
            "exchange": 1,
            "reference_id": "69509252a0526f0bc30befde",
            "reference": "69509252a0526f0bc30befdf",
            "custom_keys": false,
            "order": {
                "number": "OR0000043925",
                "status": "refunded",
                "first_name": "Hugo",
                "last_name": "Isaid",
                "email": "[email protected]",
                "phone": "9876543210"
            },
            "charges": [
                {
                    "id": "6203c3fc",
                    "folio": "7e7ff20d",
                    "reference": "0d3d5556",
                    "status": "paid",
                    "type": "card",
                    "currency": "MXN",
                    "amount": 5000,
                    "gateway": "mit",
                    "method": {
                        "name": "Hugo Isaíd",
                        "exp_month": "01",
                        "exp_year": "2050",
                        "type": "credit",
                        "last4": "2235",
                        "brand": "mastercard",
                        "bankname": "ecartpay",
                        "domestic": true
                    },
                    "affiliation_number": "SANDBOX-10-12-17"
                }
            ],
            "available_at": "2025-12-28T02:13:38.177Z",
            "b2b_metadata": {
                "b2b_transactions": []
            },
            "created_at": "2025-12-28T02:13:38.334Z",
            "updated_at": "2025-12-28T02:13:53.275Z"
        },
        {
            "id": "692f1b0cd10221b63a5afe5a",
            "account_id": "68a4c3150b28a9584305a2a6",
            "affiliation_number": "SANDBOX-10-12-17",
            "activity_id": "692f1b0cd10221b63a5afe46",
            "order_id": "692f1ae1d10221b63a5afda1",
            "transaction_id": "TR0000015520",
            "type": "payment",
            "status": "paid",
            "amount": 92.46,
            "fee": 7.54,
            "fee_details": {
                "fixed": 3.6,
                "percent": 2.9,
                "tax": 1.04,
                "percent_amount": 2.9,
                "msi_percent": 0,
                "msi_amount": 0,
                "fixed_installments_amount": 0,
                "fixed_installments_percent": 0,
                "installments_fee": 0
            },
            "installments": 1,
            "total": 100,
            "previous": -4524.59,
            "current": -4432.13,
            "currency": "MXN",
            "gateway": "ecartpay",
            "exchange": 1,
            "reference_id": "692f1b0cd10221b63a5afe56",
            "reference": "692f1b0cd10221b63a5afe57",
            "custom_keys": false,
            "order": {
                "number": "OR0000041825",
                "status": "paid",
                "first_name": "John",
                "last_name": "Doe",
                "email": "[email protected]",
                "phone": "529999999999"
            },
            "charges": [
                {
                    "id": "c13fb710",
                    "folio": "7e761d4f",
                    "reference": "189dac22",
                    "status": "paid",
                    "type": "card",
                    "currency": "MXN",
                    "amount": 10000,
                    "gateway": "mit",
                    "method": {
                        "name": "John Doe",
                        "exp_month": "01",
                        "exp_year": "2050",
                        "type": "credit",
                        "last4": "2151",
                        "brand": "mastercard",
                        "bankname": "ecartpay",
                        "domestic": true
                    },
                    "affiliation_number": "SANDBOX-10-12-17"
                }
            ],
            "available_at": "2025-12-02T16:59:56.420Z",
            "b2b_metadata": {
                "b2b_transactions": []
            },
            "created_at": "2025-12-02T16:59:56.431Z",
            "updated_at": "2025-12-02T16:59:56.431Z"
        },
        {
            "id": "692f199fd10221b63a5afb55",
            "account_id": "68a4c3150b28a9584305a2a6",
            "affiliation_number": "SANDBOX-10-12-17",
            "activity_id": "692f199fd10221b63a5afb41",
            "order_id": "692f194cd10221b63a5afaa4",
            "template_id": "692f1493d33762531c20f54b",
            "transaction_id": "TR0000015511",
            "type": "payment",
            "status": "paid",
            "amount": 189.1,
            "fee": 10.9,
            "fee_details": {
                "fixed": 3.6,
                "percent": 2.9,
                "tax": 1.5,
                "percent_amount": 5.8,
                "msi_percent": 0,
                "msi_amount": 0,
                "fixed_installments_amount": 0,
                "fixed_installments_percent": 0,
                "installments_fee": 0
            },
            "installments": 1,
            "total": 200,
            "previous": -4713.69,
            "current": -4524.59,
            "currency": "MXN",
            "gateway": "ecartpay",
            "exchange": 1,
            "reference_id": "692f199fd10221b63a5afb51",
            "reference": "692f199fd10221b63a5afb52",
            "custom_keys": false,
            "order": {
                "number": "OR0000041812",
                "status": "paid",
                "first_name": "Hugo",
                "last_name": "Morín",
                "email": "[email protected]",
                "phone": "529999999999"
            },
            "charges": [
                {
                    "id": "7238e04b",
                    "folio": "2e4701a9",
                    "reference": "c8d1989e",
                    "status": "paid",
                    "type": "card",
                    "currency": "MXN",
                    "amount": 20000,
                    "gateway": "mit",
                    "method": {
                        "name": "Mastercard Test",
                        "exp_month": "01",
                        "exp_year": "2050",
                        "type": "credit",
                        "last4": "2235",
                        "brand": "mastercard",
                        "bankname": "ecartpay",
                        "domestic": true
                    },
                    "affiliation_number": "SANDBOX-10-12-17"
                }
            ],
            "available_at": "2025-12-02T16:53:51.681Z",
            "b2b_metadata": {
                "b2b_transactions": []
            },
            "created_at": "2025-12-02T16:53:51.692Z",
            "updated_at": "2025-12-02T16:53:51.692Z"
        },
        {
            "id": "692f1798d10221b63a5af6c5",
            "account_id": "68a4c3150b28a9584305a2a6",
            "affiliation_number": "SANDBOX-10-12-17",
            "activity_id": "692f1798d10221b63a5af6b1",
            "order_id": "692f168fd10221b63a5af570",
            "template_id": "692f1493d33762531c20f54b",
            "transaction_id": "TR0000015500",
            "type": "payment",
            "status": "paid",
            "amount": 189.1,
            "fee": 10.9,
            "fee_details": {
                "fixed": 3.6,
                "percent": 2.9,
                "tax": 1.5,
                "percent_amount": 5.8,
                "msi_percent": 0,
                "msi_amount": 0,
                "fixed_installments_amount": 0,
                "fixed_installments_percent": 0,
                "installments_fee": 0
            },
            "installments": 1,
            "total": 200,
            "previous": -4902.79,
            "current": -4713.69,
            "currency": "MXN",
            "gateway": "ecartpay",
            "exchange": 1,
            "reference_id": "692f1798d10221b63a5af6c1",
            "reference": "692f1798d10221b63a5af6c2",
            "custom_keys": false,
            "order": {
                "number": "OR0000041793",
                "status": "paid",
                "first_name": "John",
                "last_name": "Doe",
                "email": "[email protected]",
                "phone": "529999999999"
            },
            "charges": [
                {
                    "id": "25981571",
                    "folio": "9bfffa32",
                    "reference": "7d329b95",
                    "status": "paid",
                    "type": "card",
                    "currency": "MXN",
                    "amount": 20000,
                    "gateway": "mit",
                    "method": {
                        "name": "John Doe",
                        "exp_month": "01",
                        "exp_year": "2050",
                        "type": "credit",
                        "last4": "4242",
                        "brand": "visa",
                        "bankname": "ecartpay",
                        "domestic": true
                    },
                    "affiliation_number": "SANDBOX-10-12-17"
                }
            ],
            "available_at": "2025-12-02T16:45:12.523Z",
            "b2b_metadata": {
                "b2b_transactions": []
            },
            "created_at": "2025-12-02T16:45:12.535Z",
            "updated_at": "2025-12-02T16:45:12.535Z"
        }
    ],
    "pages": 17,
    "token_page": "CN7XARoJKXnJu2KbAQAAIg5aDGlQkmAFy/pmAcDdog==",
    "next_token": "CPPOARoJKdcr9N+aAQAAIg5aDGkvF5jRAiG2Olr2xQ=="
}

This endpoint is ideal for detailed financial analysis, allowing businesses to filter and analyze transaction records.



Retrieve Transaction Summary

Retrieves a summary of the account’s transactions, including total pay-ins and payouts in the specified currency. Note: This endpoint returns balance summaries and does not support pagination or the token_page parameter.

💻

Visit our API Reference to test this endpoint.

Endpoint

GET {{baseURL}}/api/transactions/summary

Headers

  • Authorization: {token}

Query Parameters

ParameterTypeDescription
currencystringThe currency for the summary (e.g., "MXN").

Example Request

curl --location 'https://sandbox.ecartpay.com/api/transactions/summary?currency=MXN' \
--header 'Authorization: eyJhbGciOiJIUzUxMiIsInR5cCI6IkpXVCJ9.eyJpZCI6IjY3MmE4NTAzNzFiZTBlY2Y1NTRkMDUxNiIsImFjY291bnRfaWQiOiI2NzJhODUwMzcxYmUwZWNmNTU0ZDA1MGMiLCJpYXQiOjE3Mzg2OTA5NDQsImV4cCI6MTczODY5NDU0NH0.eJ7LOLmSwZBVcdol6_7trjeNQBQKjF0IGnJnWrqwpi80Fm5OlezbV2V0rhKmrFA5kW8o7REniUSWEVCIQcrb4A' \
--header 'Cookie: lang=en'
package main

import (
  "fmt"
  "net/http"
  "io"
)

func main() {

  url := "https://sandbox.ecartpay.com/api/transactions/summary?currency=MXN"
  method := "GET"

  client := &http.Client {
  }
  req, err := http.NewRequest(method, url, nil)

  if err != nil {
    fmt.Println(err)
    return
  }
  req.Header.Add("Authorization", "eyJhbGciOiJIUzUxMiIsInR5cCI6IkpXVCJ9.eyJpZCI6IjY3MmE4NTAzNzFiZTBlY2Y1NTRkMDUxNiIsImFjY291bnRfaWQiOiI2NzJhODUwMzcxYmUwZWNmNTU0ZDA1MGMiLCJpYXQiOjE3Mzg2OTA5NDQsImV4cCI6MTczODY5NDU0NH0.eJ7LOLmSwZBVcdol6_7trjeNQBQKjF0IGnJnWrqwpi80Fm5OlezbV2V0rhKmrFA5kW8o7REniUSWEVCIQcrb4A")
  req.Header.Add("Cookie", "lang=en")

  res, err := client.Do(req)
  if err != nil {
    fmt.Println(err)
    return
  }
  defer res.Body.Close()

  body, err := io.ReadAll(res.Body)
  if err != nil {
    fmt.Println(err)
    return
  }
  fmt.Println(string(body))
}
GET /api/transactions/summary?currency=MXN HTTP/1.1
Host: sandbox.ecartpay.com
Authorization: eyJhbGciOiJIUzUxMiIsInR5cCI6IkpXVCJ9.eyJpZCI6IjY3MmE4NTAzNzFiZTBlY2Y1NTRkMDUxNiIsImFjY291bnRfaWQiOiI2NzJhODUwMzcxYmUwZWNmNTU0ZDA1MGMiLCJpYXQiOjE3Mzg2OTA5NDQsImV4cCI6MTczODY5NDU0NH0.eJ7LOLmSwZBVcdol6_7trjeNQBQKjF0IGnJnWrqwpi80Fm5OlezbV2V0rhKmrFA5kW8o7REniUSWEVCIQcrb4A
Cookie: lang=en
// OkHttp

OkHttpClient client = new OkHttpClient().newBuilder()
  .build();
MediaType mediaType = MediaType.parse("text/plain");
RequestBody body = RequestBody.create(mediaType, "");
Request request = new Request.Builder()
  .url("https://sandbox.ecartpay.com/api/transactions/summary?currency=MXN")
  .method("GET", body)
  .addHeader("Authorization", "eyJhbGciOiJIUzUxMiIsInR5cCI6IkpXVCJ9.eyJpZCI6IjY3MmE4NTAzNzFiZTBlY2Y1NTRkMDUxNiIsImFjY291bnRfaWQiOiI2NzJhODUwMzcxYmUwZWNmNTU0ZDA1MGMiLCJpYXQiOjE3Mzg2OTA5NDQsImV4cCI6MTczODY5NDU0NH0.eJ7LOLmSwZBVcdol6_7trjeNQBQKjF0IGnJnWrqwpi80Fm5OlezbV2V0rhKmrFA5kW8o7REniUSWEVCIQcrb4A")
  .addHeader("Cookie", "lang=en")
  .build();
Response response = client.newCall(request).execute();

// -------------------------------------------------------------

// Unirest

Unirest.setTimeouts(0, 0);
HttpResponse<String> response = Unirest.get("https://sandbox.ecartpay.com/api/transactions/summary?currency=MXN")
  .header("Authorization", "eyJhbGciOiJIUzUxMiIsInR5cCI6IkpXVCJ9.eyJpZCI6IjY3MmE4NTAzNzFiZTBlY2Y1NTRkMDUxNiIsImFjY291bnRfaWQiOiI2NzJhODUwMzcxYmUwZWNmNTU0ZDA1MGMiLCJpYXQiOjE3Mzg2OTA5NDQsImV4cCI6MTczODY5NDU0NH0.eJ7LOLmSwZBVcdol6_7trjeNQBQKjF0IGnJnWrqwpi80Fm5OlezbV2V0rhKmrFA5kW8o7REniUSWEVCIQcrb4A")
  .header("Cookie", "lang=en")
  .asString();
// Fetch

const myHeaders = new Headers();
myHeaders.append("Authorization", "eyJhbGciOiJIUzUxMiIsInR5cCI6IkpXVCJ9.eyJpZCI6IjY3MmE4NTAzNzFiZTBlY2Y1NTRkMDUxNiIsImFjY291bnRfaWQiOiI2NzJhODUwMzcxYmUwZWNmNTU0ZDA1MGMiLCJpYXQiOjE3Mzg2OTA5NDQsImV4cCI6MTczODY5NDU0NH0.eJ7LOLmSwZBVcdol6_7trjeNQBQKjF0IGnJnWrqwpi80Fm5OlezbV2V0rhKmrFA5kW8o7REniUSWEVCIQcrb4A");
myHeaders.append("Cookie", "lang=en");

const requestOptions = {
  method: "GET",
  headers: myHeaders,
  redirect: "follow"
};

fetch("https://sandbox.ecartpay.com/api/transactions/summary?currency=MXN", requestOptions)
  .then((response) => response.text())
  .then((result) => console.log(result))
  .catch((error) => console.error(error));

// -------------------------------------------------------------

// jQuery

var settings = {
  "url": "https://sandbox.ecartpay.com/api/transactions/summary?currency=MXN",
  "method": "GET",
  "timeout": 0,
  "headers": {
    "Authorization": "eyJhbGciOiJIUzUxMiIsInR5cCI6IkpXVCJ9.eyJpZCI6IjY3MmE4NTAzNzFiZTBlY2Y1NTRkMDUxNiIsImFjY291bnRfaWQiOiI2NzJhODUwMzcxYmUwZWNmNTU0ZDA1MGMiLCJpYXQiOjE3Mzg2OTA5NDQsImV4cCI6MTczODY5NDU0NH0.eJ7LOLmSwZBVcdol6_7trjeNQBQKjF0IGnJnWrqwpi80Fm5OlezbV2V0rhKmrFA5kW8o7REniUSWEVCIQcrb4A",
    "Cookie": "lang=en"
  },
};

$.ajax(settings).done(function (response) {
  console.log(response);
});

// -------------------------------------------------------------

// XHR

// WARNING: For GET requests, body is set to null by browsers.

var xhr = new XMLHttpRequest();
xhr.withCredentials = true;

xhr.addEventListener("readystatechange", function() {
  if(this.readyState === 4) {
    console.log(this.responseText);
  }
});

xhr.open("GET", "https://sandbox.ecartpay.com/api/transactions/summary?currency=MXN");
xhr.setRequestHeader("Authorization", "eyJhbGciOiJIUzUxMiIsInR5cCI6IkpXVCJ9.eyJpZCI6IjY3MmE4NTAzNzFiZTBlY2Y1NTRkMDUxNiIsImFjY291bnRfaWQiOiI2NzJhODUwMzcxYmUwZWNmNTU0ZDA1MGMiLCJpYXQiOjE3Mzg2OTA5NDQsImV4cCI6MTczODY5NDU0NH0.eJ7LOLmSwZBVcdol6_7trjeNQBQKjF0IGnJnWrqwpi80Fm5OlezbV2V0rhKmrFA5kW8o7REniUSWEVCIQcrb4A");
// WARNING: Cookies will be stripped away by the browser before sending the request.
xhr.setRequestHeader("Cookie", "lang=en");

xhr.send();
CURL *curl;
CURLcode res;
curl = curl_easy_init();
if(curl) {
  curl_easy_setopt(curl, CURLOPT_CUSTOMREQUEST, "GET");
  curl_easy_setopt(curl, CURLOPT_URL, "https://sandbox.ecartpay.com/api/transactions/summary?currency=MXN");
  curl_easy_setopt(curl, CURLOPT_FOLLOWLOCATION, 1L);
  curl_easy_setopt(curl, CURLOPT_DEFAULT_PROTOCOL, "https");
  struct curl_slist *headers = NULL;
  headers = curl_slist_append(headers, "Authorization: eyJhbGciOiJIUzUxMiIsInR5cCI6IkpXVCJ9.eyJpZCI6IjY3MmE4NTAzNzFiZTBlY2Y1NTRkMDUxNiIsImFjY291bnRfaWQiOiI2NzJhODUwMzcxYmUwZWNmNTU0ZDA1MGMiLCJpYXQiOjE3Mzg2OTA5NDQsImV4cCI6MTczODY5NDU0NH0.eJ7LOLmSwZBVcdol6_7trjeNQBQKjF0IGnJnWrqwpi80Fm5OlezbV2V0rhKmrFA5kW8o7REniUSWEVCIQcrb4A");
  headers = curl_slist_append(headers, "Cookie: lang=en");
  curl_easy_setopt(curl, CURLOPT_HTTPHEADER, headers);
  res = curl_easy_perform(curl);
  curl_slist_free_all(headers);
}
curl_easy_cleanup(curl);
// Axios

const axios = require('axios');

let config = {
  method: 'get',
  maxBodyLength: Infinity,
  url: 'https://sandbox.ecartpay.com/api/transactions/summary?currency=MXN',
  headers: { 
    'Authorization': 'eyJhbGciOiJIUzUxMiIsInR5cCI6IkpXVCJ9.eyJpZCI6IjY3MmE4NTAzNzFiZTBlY2Y1NTRkMDUxNiIsImFjY291bnRfaWQiOiI2NzJhODUwMzcxYmUwZWNmNTU0ZDA1MGMiLCJpYXQiOjE3Mzg2OTA5NDQsImV4cCI6MTczODY5NDU0NH0.eJ7LOLmSwZBVcdol6_7trjeNQBQKjF0IGnJnWrqwpi80Fm5OlezbV2V0rhKmrFA5kW8o7REniUSWEVCIQcrb4A', 
    'Cookie': 'lang=en'
  }
};

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

// -------------------------------------------------------------

// Native

var https = require('follow-redirects').https;
var fs = require('fs');

var options = {
  'method': 'GET',
  'hostname': 'sandbox.ecartpay.com',
  'path': '/api/transactions/summary?currency=MXN',
  'headers': {
    'Authorization': 'eyJhbGciOiJIUzUxMiIsInR5cCI6IkpXVCJ9.eyJpZCI6IjY3MmE4NTAzNzFiZTBlY2Y1NTRkMDUxNiIsImFjY291bnRfaWQiOiI2NzJhODUwMzcxYmUwZWNmNTU0ZDA1MGMiLCJpYXQiOjE3Mzg2OTA5NDQsImV4cCI6MTczODY5NDU0NH0.eJ7LOLmSwZBVcdol6_7trjeNQBQKjF0IGnJnWrqwpi80Fm5OlezbV2V0rhKmrFA5kW8o7REniUSWEVCIQcrb4A',
    'Cookie': 'lang=en'
  },
  'maxRedirects': 20
};

var req = https.request(options, function (res) {
  var chunks = [];

  res.on("data", function (chunk) {
    chunks.push(chunk);
  });

  res.on("end", function (chunk) {
    var body = Buffer.concat(chunks);
    console.log(body.toString());
  });

  res.on("error", function (error) {
    console.error(error);
  });
});

req.end();

// -------------------------------------------------------------

// Request

var request = require('request');
var options = {
  'method': 'GET',
  'url': 'https://sandbox.ecartpay.com/api/transactions/summary?currency=MXN',
  'headers': {
    'Authorization': 'eyJhbGciOiJIUzUxMiIsInR5cCI6IkpXVCJ9.eyJpZCI6IjY3MmE4NTAzNzFiZTBlY2Y1NTRkMDUxNiIsImFjY291bnRfaWQiOiI2NzJhODUwMzcxYmUwZWNmNTU0ZDA1MGMiLCJpYXQiOjE3Mzg2OTA5NDQsImV4cCI6MTczODY5NDU0NH0.eJ7LOLmSwZBVcdol6_7trjeNQBQKjF0IGnJnWrqwpi80Fm5OlezbV2V0rhKmrFA5kW8o7REniUSWEVCIQcrb4A',
    'Cookie': 'lang=en'
  }
};
request(options, function (error, response) {
  if (error) throw new Error(error);
  console.log(response.body);
});

// -------------------------------------------------------------

// Unirest

var unirest = require('unirest');
var req = unirest('GET', 'https://sandbox.ecartpay.com/api/transactions/summary?currency=MXN')
  .headers({
    'Authorization': 'eyJhbGciOiJIUzUxMiIsInR5cCI6IkpXVCJ9.eyJpZCI6IjY3MmE4NTAzNzFiZTBlY2Y1NTRkMDUxNiIsImFjY291bnRfaWQiOiI2NzJhODUwMzcxYmUwZWNmNTU0ZDA1MGMiLCJpYXQiOjE3Mzg2OTA5NDQsImV4cCI6MTczODY5NDU0NH0.eJ7LOLmSwZBVcdol6_7trjeNQBQKjF0IGnJnWrqwpi80Fm5OlezbV2V0rhKmrFA5kW8o7REniUSWEVCIQcrb4A',
    'Cookie': 'lang=en'
  })
  .end(function (res) { 
    if (res.error) throw new Error(res.error); 
    console.log(res.raw_body);
  });
#import <Foundation/Foundation.h>

dispatch_semaphore_t sema = dispatch_semaphore_create(0);

NSMutableURLRequest *request = [NSMutableURLRequest requestWithURL:[NSURL URLWithString:@"https://sandbox.ecartpay.com/api/transactions/summary?currency=MXN"]
  cachePolicy:NSURLRequestUseProtocolCachePolicy
  timeoutInterval:10.0];
NSDictionary *headers = @{
  @"Authorization": @"eyJhbGciOiJIUzUxMiIsInR5cCI6IkpXVCJ9.eyJpZCI6IjY3MmE4NTAzNzFiZTBlY2Y1NTRkMDUxNiIsImFjY291bnRfaWQiOiI2NzJhODUwMzcxYmUwZWNmNTU0ZDA1MGMiLCJpYXQiOjE3Mzg2OTA5NDQsImV4cCI6MTczODY5NDU0NH0.eJ7LOLmSwZBVcdol6_7trjeNQBQKjF0IGnJnWrqwpi80Fm5OlezbV2V0rhKmrFA5kW8o7REniUSWEVCIQcrb4A",
  @"Cookie": @"lang=en"
};

[request setAllHTTPHeaderFields:headers];

[request setHTTPMethod:@"GET"];

NSURLSession *session = [NSURLSession sharedSession];
NSURLSessionDataTask *dataTask = [session dataTaskWithRequest:request
completionHandler:^(NSData *data, NSURLResponse *response, NSError *error) {
  if (error) {
    NSLog(@"%@", error);
    dispatch_semaphore_signal(sema);
  } else {
    NSHTTPURLResponse *httpResponse = (NSHTTPURLResponse *) response;
    NSError *parseError = nil;
    NSDictionary *responseDictionary = [NSJSONSerialization JSONObjectWithData:data options:0 error:&parseError];
    NSLog(@"%@",responseDictionary);
    dispatch_semaphore_signal(sema);
  }
}];
[dataTask resume];
dispatch_semaphore_wait(sema, DISPATCH_TIME_FOREVER);
open Lwt
open Cohttp
open Cohttp_lwt_unix

let reqBody = 
  let uri = Uri.of_string "https://sandbox.ecartpay.com/api/transactions/summary?currency=MXN" in
  let headers = Header.init ()
    |> fun h -> Header.add h "Authorization" "eyJhbGciOiJIUzUxMiIsInR5cCI6IkpXVCJ9.eyJpZCI6IjY3MmE4NTAzNzFiZTBlY2Y1NTRkMDUxNiIsImFjY291bnRfaWQiOiI2NzJhODUwMzcxYmUwZWNmNTU0ZDA1MGMiLCJpYXQiOjE3Mzg2OTA5NDQsImV4cCI6MTczODY5NDU0NH0.eJ7LOLmSwZBVcdol6_7trjeNQBQKjF0IGnJnWrqwpi80Fm5OlezbV2V0rhKmrFA5kW8o7REniUSWEVCIQcrb4A"
    |> fun h -> Header.add h "Cookie" "lang=en"
  in
  Client.call ~headers `GET uri >>= fun (_resp, body) ->
  body |> Cohttp_lwt.Body.to_string >|= fun body -> body

let () =
  let respBody = Lwt_main.run reqBody in
  print_endline (respBody)
// cURL

<?php

$curl = curl_init();

curl_setopt_array($curl, array(
  CURLOPT_URL => 'https://sandbox.ecartpay.com/api/transactions/summary?currency=MXN',
  CURLOPT_RETURNTRANSFER => true,
  CURLOPT_ENCODING => '',
  CURLOPT_MAXREDIRS => 10,
  CURLOPT_TIMEOUT => 0,
  CURLOPT_FOLLOWLOCATION => true,
  CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
  CURLOPT_CUSTOMREQUEST => 'GET',
  CURLOPT_HTTPHEADER => array(
    'Authorization: eyJhbGciOiJIUzUxMiIsInR5cCI6IkpXVCJ9.eyJpZCI6IjY3MmE4NTAzNzFiZTBlY2Y1NTRkMDUxNiIsImFjY291bnRfaWQiOiI2NzJhODUwMzcxYmUwZWNmNTU0ZDA1MGMiLCJpYXQiOjE3Mzg2OTA5NDQsImV4cCI6MTczODY5NDU0NH0.eJ7LOLmSwZBVcdol6_7trjeNQBQKjF0IGnJnWrqwpi80Fm5OlezbV2V0rhKmrFA5kW8o7REniUSWEVCIQcrb4A',
    'Cookie: lang=en'
  ),
));

$response = curl_exec($curl);

curl_close($curl);
echo $response;

// -------------------------------------------------------------

// Guzzle

<?php
$client = new Client();
$headers = [
  'Authorization' => 'eyJhbGciOiJIUzUxMiIsInR5cCI6IkpXVCJ9.eyJpZCI6IjY3MmE4NTAzNzFiZTBlY2Y1NTRkMDUxNiIsImFjY291bnRfaWQiOiI2NzJhODUwMzcxYmUwZWNmNTU0ZDA1MGMiLCJpYXQiOjE3Mzg2OTA5NDQsImV4cCI6MTczODY5NDU0NH0.eJ7LOLmSwZBVcdol6_7trjeNQBQKjF0IGnJnWrqwpi80Fm5OlezbV2V0rhKmrFA5kW8o7REniUSWEVCIQcrb4A',
  'Cookie' => 'lang=en'
];
$request = new Request('GET', 'https://sandbox.ecartpay.com/api/transactions/summary?currency=MXN', $headers);
$res = $client->sendAsync($request)->wait();
echo $res->getBody();

// -------------------------------------------------------------

// HTTP_Request2

<?php
require_once 'HTTP/Request2.php';
$request = new HTTP_Request2();
$request->setUrl('https://sandbox.ecartpay.com/api/transactions/summary?currency=MXN');
$request->setMethod(HTTP_Request2::METHOD_GET);
$request->setConfig(array(
  'follow_redirects' => TRUE
));
$request->setHeader(array(
  'Authorization' => 'eyJhbGciOiJIUzUxMiIsInR5cCI6IkpXVCJ9.eyJpZCI6IjY3MmE4NTAzNzFiZTBlY2Y1NTRkMDUxNiIsImFjY291bnRfaWQiOiI2NzJhODUwMzcxYmUwZWNmNTU0ZDA1MGMiLCJpYXQiOjE3Mzg2OTA5NDQsImV4cCI6MTczODY5NDU0NH0.eJ7LOLmSwZBVcdol6_7trjeNQBQKjF0IGnJnWrqwpi80Fm5OlezbV2V0rhKmrFA5kW8o7REniUSWEVCIQcrb4A',
  'Cookie' => 'lang=en'
));
try {
  $response = $request->send();
  if ($response->getStatus() == 200) {
    echo $response->getBody();
  }
  else {
    echo 'Unexpected HTTP status: ' . $response->getStatus() . ' ' .
    $response->getReasonPhrase();
  }
}
catch(HTTP_Request2_Exception $e) {
  echo 'Error: ' . $e->getMessage();
}

// -------------------------------------------------------------

// pecl_http

<?php
$client = new http\Client;
$request = new http\Client\Request;
$request->setRequestUrl('https://sandbox.ecartpay.com/api/transactions/summary?currency=MXN');
$request->setRequestMethod('GET');
$request->setOptions(array());
$request->setHeaders(array(
  'Authorization' => 'eyJhbGciOiJIUzUxMiIsInR5cCI6IkpXVCJ9.eyJpZCI6IjY3MmE4NTAzNzFiZTBlY2Y1NTRkMDUxNiIsImFjY291bnRfaWQiOiI2NzJhODUwMzcxYmUwZWNmNTU0ZDA1MGMiLCJpYXQiOjE3Mzg2OTA5NDQsImV4cCI6MTczODY5NDU0NH0.eJ7LOLmSwZBVcdol6_7trjeNQBQKjF0IGnJnWrqwpi80Fm5OlezbV2V0rhKmrFA5kW8o7REniUSWEVCIQcrb4A',
  'Cookie' => 'lang=en'
));
$client->enqueue($request)->send();
$response = $client->getResponse();
echo $response->getBody();
$headers = New-Object "System.Collections.Generic.Dictionary[[String],[String]]"
$headers.Add("Authorization", "eyJhbGciOiJIUzUxMiIsInR5cCI6IkpXVCJ9.eyJpZCI6IjY3MmE4NTAzNzFiZTBlY2Y1NTRkMDUxNiIsImFjY291bnRfaWQiOiI2NzJhODUwMzcxYmUwZWNmNTU0ZDA1MGMiLCJpYXQiOjE3Mzg2OTA5NDQsImV4cCI6MTczODY5NDU0NH0.eJ7LOLmSwZBVcdol6_7trjeNQBQKjF0IGnJnWrqwpi80Fm5OlezbV2V0rhKmrFA5kW8o7REniUSWEVCIQcrb4A")
$headers.Add("Cookie", "lang=en")

$response = Invoke-RestMethod 'https://sandbox.ecartpay.com/api/transactions/summary?currency=MXN' -Method 'GET' -Headers $headers
$response | ConvertTo-Json
# http.client

import http.client

conn = http.client.HTTPSConnection("sandbox.ecartpay.com")
payload = ''
headers = {
  'Authorization': 'eyJhbGciOiJIUzUxMiIsInR5cCI6IkpXVCJ9.eyJpZCI6IjY3MmE4NTAzNzFiZTBlY2Y1NTRkMDUxNiIsImFjY291bnRfaWQiOiI2NzJhODUwMzcxYmUwZWNmNTU0ZDA1MGMiLCJpYXQiOjE3Mzg2OTA5NDQsImV4cCI6MTczODY5NDU0NH0.eJ7LOLmSwZBVcdol6_7trjeNQBQKjF0IGnJnWrqwpi80Fm5OlezbV2V0rhKmrFA5kW8o7REniUSWEVCIQcrb4A',
  'Cookie': 'lang=en'
}
conn.request("GET", "/api/transactions/summary?currency=MXN", payload, headers)
res = conn.getresponse()
data = res.read()
print(data.decode("utf-8"))

// -------------------------------------------------------------

# Requests

import requests

url = "https://sandbox.ecartpay.com/api/transactions/summary?currency=MXN"

payload = {}
headers = {
  'Authorization': 'eyJhbGciOiJIUzUxMiIsInR5cCI6IkpXVCJ9.eyJpZCI6IjY3MmE4NTAzNzFiZTBlY2Y1NTRkMDUxNiIsImFjY291bnRfaWQiOiI2NzJhODUwMzcxYmUwZWNmNTU0ZDA1MGMiLCJpYXQiOjE3Mzg2OTA5NDQsImV4cCI6MTczODY5NDU0NH0.eJ7LOLmSwZBVcdol6_7trjeNQBQKjF0IGnJnWrqwpi80Fm5OlezbV2V0rhKmrFA5kW8o7REniUSWEVCIQcrb4A',
  'Cookie': 'lang=en'
}

response = requests.request("GET", url, headers=headers, data=payload)

print(response.text)
# httr

library(httr)

headers = c(
  'Authorization' = 'eyJhbGciOiJIUzUxMiIsInR5cCI6IkpXVCJ9.eyJpZCI6IjY3MmE4NTAzNzFiZTBlY2Y1NTRkMDUxNiIsImFjY291bnRfaWQiOiI2NzJhODUwMzcxYmUwZWNmNTU0ZDA1MGMiLCJpYXQiOjE3Mzg2OTA5NDQsImV4cCI6MTczODY5NDU0NH0.eJ7LOLmSwZBVcdol6_7trjeNQBQKjF0IGnJnWrqwpi80Fm5OlezbV2V0rhKmrFA5kW8o7REniUSWEVCIQcrb4A',
  'Cookie' = 'lang=en'
)

res <- VERB("GET", url = "https://sandbox.ecartpay.com/api/transactions/summary?currency=MXN", add_headers(headers))

cat(content(res, 'text'))

// -------------------------------------------------------------

# RCurl

library(RCurl)
headers = c(
  "Authorization" = "eyJhbGciOiJIUzUxMiIsInR5cCI6IkpXVCJ9.eyJpZCI6IjY3MmE4NTAzNzFiZTBlY2Y1NTRkMDUxNiIsImFjY291bnRfaWQiOiI2NzJhODUwMzcxYmUwZWNmNTU0ZDA1MGMiLCJpYXQiOjE3Mzg2OTA5NDQsImV4cCI6MTczODY5NDU0NH0.eJ7LOLmSwZBVcdol6_7trjeNQBQKjF0IGnJnWrqwpi80Fm5OlezbV2V0rhKmrFA5kW8o7REniUSWEVCIQcrb4A",
  "Cookie" = "lang=en"
)
res <- getURL("https://sandbox.ecartpay.com/api/transactions/summary?currency=MXN", .opts=list(httpheader = headers, followlocation = TRUE))
cat(res)
require "uri"
require "net/http"

url = URI("https://sandbox.ecartpay.com/api/transactions/summary?currency=MXN")

https = Net::HTTP.new(url.host, url.port)
https.use_ssl = true

request = Net::HTTP::Get.new(url)
request["Authorization"] = "eyJhbGciOiJIUzUxMiIsInR5cCI6IkpXVCJ9.eyJpZCI6IjY3MmE4NTAzNzFiZTBlY2Y1NTRkMDUxNiIsImFjY291bnRfaWQiOiI2NzJhODUwMzcxYmUwZWNmNTU0ZDA1MGMiLCJpYXQiOjE3Mzg2OTA5NDQsImV4cCI6MTczODY5NDU0NH0.eJ7LOLmSwZBVcdol6_7trjeNQBQKjF0IGnJnWrqwpi80Fm5OlezbV2V0rhKmrFA5kW8o7REniUSWEVCIQcrb4A"
request["Cookie"] = "lang=en"

response = https.request(request)
puts response.read_body
#[tokio::main]
async fn main() -> Result<(), Box<dyn std::error::Error>> {
    let client = reqwest::Client::builder()
        .build()?;

    let mut headers = reqwest::header::HeaderMap::new();
    headers.insert("Authorization", "eyJhbGciOiJIUzUxMiIsInR5cCI6IkpXVCJ9.eyJpZCI6IjY3MmE4NTAzNzFiZTBlY2Y1NTRkMDUxNiIsImFjY291bnRfaWQiOiI2NzJhODUwMzcxYmUwZWNmNTU0ZDA1MGMiLCJpYXQiOjE3Mzg2OTA5NDQsImV4cCI6MTczODY5NDU0NH0.eJ7LOLmSwZBVcdol6_7trjeNQBQKjF0IGnJnWrqwpi80Fm5OlezbV2V0rhKmrFA5kW8o7REniUSWEVCIQcrb4A".parse()?);
    headers.insert("Cookie", "lang=en".parse()?);

    let request = client.request(reqwest::Method::GET, "https://sandbox.ecartpay.com/api/transactions/summary?currency=MXN")
        .headers(headers);

    let response = request.send().await?;
    let body = response.text().await?;

    println!("{}", body);

    Ok(())
}
# Httpie

http --follow --timeout 3600 GET 'https://sandbox.ecartpay.com/api/transactions/summary?currency=MXN' \
 Authorization:'eyJhbGciOiJIUzUxMiIsInR5cCI6IkpXVCJ9.eyJpZCI6IjY3MmE4NTAzNzFiZTBlY2Y1NTRkMDUxNiIsImFjY291bnRfaWQiOiI2NzJhODUwMzcxYmUwZWNmNTU0ZDA1MGMiLCJpYXQiOjE3Mzg2OTA5NDQsImV4cCI6MTczODY5NDU0NH0.eJ7LOLmSwZBVcdol6_7trjeNQBQKjF0IGnJnWrqwpi80Fm5OlezbV2V0rhKmrFA5kW8o7REniUSWEVCIQcrb4A' \
 Cookie:'lang=en'

// -------------------------------------------------------------

# wget

wget --no-check-certificate --quiet \
  --method GET \
  --timeout=0 \
  --header 'Authorization: eyJhbGciOiJIUzUxMiIsInR5cCI6IkpXVCJ9.eyJpZCI6IjY3MmE4NTAzNzFiZTBlY2Y1NTRkMDUxNiIsImFjY291bnRfaWQiOiI2NzJhODUwMzcxYmUwZWNmNTU0ZDA1MGMiLCJpYXQiOjE3Mzg2OTA5NDQsImV4cCI6MTczODY5NDU0NH0.eJ7LOLmSwZBVcdol6_7trjeNQBQKjF0IGnJnWrqwpi80Fm5OlezbV2V0rhKmrFA5kW8o7REniUSWEVCIQcrb4A' \
  --header 'Cookie: lang=en' \
   'https://sandbox.ecartpay.com/api/transactions/summary?currency=MXN'
var request = URLRequest(url: URL(string: "https://sandbox.ecartpay.com/api/transactions/summary?currency=MXN")!,timeoutInterval: Double.infinity)
request.addValue("eyJhbGciOiJIUzUxMiIsInR5cCI6IkpXVCJ9.eyJpZCI6IjY3MmE4NTAzNzFiZTBlY2Y1NTRkMDUxNiIsImFjY291bnRfaWQiOiI2NzJhODUwMzcxYmUwZWNmNTU0ZDA1MGMiLCJpYXQiOjE3Mzg2OTA5NDQsImV4cCI6MTczODY5NDU0NH0.eJ7LOLmSwZBVcdol6_7trjeNQBQKjF0IGnJnWrqwpi80Fm5OlezbV2V0rhKmrFA5kW8o7REniUSWEVCIQcrb4A", forHTTPHeaderField: "Authorization")
request.addValue("lang=en", forHTTPHeaderField: "Cookie")

request.httpMethod = "GET"

let task = URLSession.shared.dataTask(with: request) { data, response, error in 
  guard let data = data else {
    print(String(describing: error))
    return
  }
  print(String(data: data, encoding: .utf8)!)
}

task.resume()

Example Response

{
    "total": 9292639.06,
    "currency": "MXN",
    "balances": [
        {
            "exchange": {
                "value": 0.1988,
                "currency": "MXN",
                "amount": 101223.59
            },
            "payments": 7604373.02,
            "charges": 7095200,
            "amount": 509173.02,
            "currency": "ARS"
        },
        {
            "exchange": {
                "value": 3.768,
                "currency": "MXN",
                "amount": 1807505.3
            },
            "payments": 479698.86,
            "charges": 0,
            "amount": 479698.86,
            "currency": "BRL"
        },
        {
            "exchange": {
                "value": 0.0244,
                "currency": "MXN",
                "amount": 934853.03
            },
            "payments": 38345551.9,
            "charges": 31903,
            "amount": 38313648.9,
            "currency": "CLP"
        },
        {
            "exchange": {
                "value": 0.005,
                "currency": "MXN",
                "amount": 99259.71
            },
            "payments": 21049443.57,
            "charges": 1197500,
            "amount": 19851943.57,
            "currency": "COP"
        },
        {
            "exchange": {
                "value": 22.6976,
                "currency": "MXN",
                "amount": 2200296.71
            },
            "payments": 96939.62,
            "charges": 0,
            "amount": 96939.62,
            "currency": "EUR"
        },
        {
            "exchange": {
                "value": 2.523,
                "currency": "MXN",
                "amount": 3943909.49
            },
            "payments": 2264682.52,
            "charges": 701500,
            "amount": 1563182.52,
            "currency": "GTQ"
        },
        {
            "exchange": {
                "value": 0.2648,
                "currency": "MXN",
                "amount": 6951.95
            },
            "payments": 214253.6,
            "charges": 188000,
            "amount": 26253.6,
            "currency": "INR"
        },
        {
            "exchange": {
                "value": 1,
                "currency": "MXN",
                "amount": 188925.31
            },
            "payments": 292793.55,
            "charges": 103868.24,
            "amount": 188925.31,
            "currency": "MXN"
        },
        {
            "exchange": {
                "value": 19.0335,
                "currency": "MXN",
                "amount": 9713.93
            },
            "payments": 6810.36,
            "charges": 6300,
            "amount": 510.36,
            "currency": "USD"
        }
    ]
}

This endpoint provides a high-level view of financial transactions, helping users understand their current balance and its breakdown by currency.



Retrieve a Single Transaction

Retrieve detailed information about a specific transaction, including fees, gateway details, and associated orders.

💻

Visit our API Reference to test this endpoint.

Endpoint

GET {{baseURL}}/api/transactions/{{transaction_id}}

Headers

  • Authorization: {token}

Path Parameters

ParameterTypeDescription
transaction_idstringUnique ID of the transaction to retrieve.

Example Request

curl --location 'https://sandbox.ecartpay.com/api/transactions/678551ec8b3f78f49c915e34' \
--header 'Authorization: eyJhbGciOiJIUzUxMiIsInR5cCI6IkpXVCJ9.eyJpZCI6IjY3MmE4NTAzNzFiZTBlY2Y1NTRkMDUxNiIsImFjY291bnRfaWQiOiI2NzJhODUwMzcxYmUwZWNmNTU0ZDA1MGMiLCJpYXQiOjE3Mzg2OTA5NDQsImV4cCI6MTczODY5NDU0NH0.eJ7LOLmSwZBVcdol6_7trjeNQBQKjF0IGnJnWrqwpi80Fm5OlezbV2V0rhKmrFA5kW8o7REniUSWEVCIQcrb4A' \
--header 'Cookie: lang=en'
package main

import (
  "fmt"
  "net/http"
  "io"
)

func main() {

  url := "https://sandbox.ecartpay.com/api/transactions/678551ec8b3f78f49c915e34"
  method := "GET"

  client := &http.Client {
  }
  req, err := http.NewRequest(method, url, nil)

  if err != nil {
    fmt.Println(err)
    return
  }
  req.Header.Add("Authorization", "eyJhbGciOiJIUzUxMiIsInR5cCI6IkpXVCJ9.eyJpZCI6IjY3MmE4NTAzNzFiZTBlY2Y1NTRkMDUxNiIsImFjY291bnRfaWQiOiI2NzJhODUwMzcxYmUwZWNmNTU0ZDA1MGMiLCJpYXQiOjE3Mzg2OTA5NDQsImV4cCI6MTczODY5NDU0NH0.eJ7LOLmSwZBVcdol6_7trjeNQBQKjF0IGnJnWrqwpi80Fm5OlezbV2V0rhKmrFA5kW8o7REniUSWEVCIQcrb4A")
  req.Header.Add("Cookie", "lang=en")

  res, err := client.Do(req)
  if err != nil {
    fmt.Println(err)
    return
  }
  defer res.Body.Close()

  body, err := io.ReadAll(res.Body)
  if err != nil {
    fmt.Println(err)
    return
  }
  fmt.Println(string(body))
}
GET /api/transactions/678551ec8b3f78f49c915e34 HTTP/1.1
Host: sandbox.ecartpay.com
Authorization: eyJhbGciOiJIUzUxMiIsInR5cCI6IkpXVCJ9.eyJpZCI6IjY3MmE4NTAzNzFiZTBlY2Y1NTRkMDUxNiIsImFjY291bnRfaWQiOiI2NzJhODUwMzcxYmUwZWNmNTU0ZDA1MGMiLCJpYXQiOjE3Mzg2OTA5NDQsImV4cCI6MTczODY5NDU0NH0.eJ7LOLmSwZBVcdol6_7trjeNQBQKjF0IGnJnWrqwpi80Fm5OlezbV2V0rhKmrFA5kW8o7REniUSWEVCIQcrb4A
Cookie: lang=en
// OkHttp

OkHttpClient client = new OkHttpClient().newBuilder()
  .build();
MediaType mediaType = MediaType.parse("text/plain");
RequestBody body = RequestBody.create(mediaType, "");
Request request = new Request.Builder()
  .url("https://sandbox.ecartpay.com/api/transactions/678551ec8b3f78f49c915e34")
  .method("GET", body)
  .addHeader("Authorization", "eyJhbGciOiJIUzUxMiIsInR5cCI6IkpXVCJ9.eyJpZCI6IjY3MmE4NTAzNzFiZTBlY2Y1NTRkMDUxNiIsImFjY291bnRfaWQiOiI2NzJhODUwMzcxYmUwZWNmNTU0ZDA1MGMiLCJpYXQiOjE3Mzg2OTA5NDQsImV4cCI6MTczODY5NDU0NH0.eJ7LOLmSwZBVcdol6_7trjeNQBQKjF0IGnJnWrqwpi80Fm5OlezbV2V0rhKmrFA5kW8o7REniUSWEVCIQcrb4A")
  .addHeader("Cookie", "lang=en")
  .build();
Response response = client.newCall(request).execute();

// -------------------------------------------------------------

// Unirest

Unirest.setTimeouts(0, 0);
HttpResponse<String> response = Unirest.get("https://sandbox.ecartpay.com/api/transactions/678551ec8b3f78f49c915e34")
  .header("Authorization", "eyJhbGciOiJIUzUxMiIsInR5cCI6IkpXVCJ9.eyJpZCI6IjY3MmE4NTAzNzFiZTBlY2Y1NTRkMDUxNiIsImFjY291bnRfaWQiOiI2NzJhODUwMzcxYmUwZWNmNTU0ZDA1MGMiLCJpYXQiOjE3Mzg2OTA5NDQsImV4cCI6MTczODY5NDU0NH0.eJ7LOLmSwZBVcdol6_7trjeNQBQKjF0IGnJnWrqwpi80Fm5OlezbV2V0rhKmrFA5kW8o7REniUSWEVCIQcrb4A")
  .header("Cookie", "lang=en")
  .asString();
// Fetch

const myHeaders = new Headers();
myHeaders.append("Authorization", "eyJhbGciOiJIUzUxMiIsInR5cCI6IkpXVCJ9.eyJpZCI6IjY3MmE4NTAzNzFiZTBlY2Y1NTRkMDUxNiIsImFjY291bnRfaWQiOiI2NzJhODUwMzcxYmUwZWNmNTU0ZDA1MGMiLCJpYXQiOjE3Mzg2OTA5NDQsImV4cCI6MTczODY5NDU0NH0.eJ7LOLmSwZBVcdol6_7trjeNQBQKjF0IGnJnWrqwpi80Fm5OlezbV2V0rhKmrFA5kW8o7REniUSWEVCIQcrb4A");
myHeaders.append("Cookie", "lang=en");

const requestOptions = {
  method: "GET",
  headers: myHeaders,
  redirect: "follow"
};

fetch("https://sandbox.ecartpay.com/api/transactions/678551ec8b3f78f49c915e34", requestOptions)
  .then((response) => response.text())
  .then((result) => console.log(result))
  .catch((error) => console.error(error));

// -------------------------------------------------------------

// jQuery

var settings = {
  "url": "https://sandbox.ecartpay.com/api/transactions/678551ec8b3f78f49c915e34",
  "method": "GET",
  "timeout": 0,
  "headers": {
    "Authorization": "eyJhbGciOiJIUzUxMiIsInR5cCI6IkpXVCJ9.eyJpZCI6IjY3MmE4NTAzNzFiZTBlY2Y1NTRkMDUxNiIsImFjY291bnRfaWQiOiI2NzJhODUwMzcxYmUwZWNmNTU0ZDA1MGMiLCJpYXQiOjE3Mzg2OTA5NDQsImV4cCI6MTczODY5NDU0NH0.eJ7LOLmSwZBVcdol6_7trjeNQBQKjF0IGnJnWrqwpi80Fm5OlezbV2V0rhKmrFA5kW8o7REniUSWEVCIQcrb4A",
    "Cookie": "lang=en"
  },
};

$.ajax(settings).done(function (response) {
  console.log(response);
});

// -------------------------------------------------------------

// XHR

// WARNING: For GET requests, body is set to null by browsers.

var xhr = new XMLHttpRequest();
xhr.withCredentials = true;

xhr.addEventListener("readystatechange", function() {
  if(this.readyState === 4) {
    console.log(this.responseText);
  }
});

xhr.open("GET", "https://sandbox.ecartpay.com/api/transactions/678551ec8b3f78f49c915e34");
xhr.setRequestHeader("Authorization", "eyJhbGciOiJIUzUxMiIsInR5cCI6IkpXVCJ9.eyJpZCI6IjY3MmE4NTAzNzFiZTBlY2Y1NTRkMDUxNiIsImFjY291bnRfaWQiOiI2NzJhODUwMzcxYmUwZWNmNTU0ZDA1MGMiLCJpYXQiOjE3Mzg2OTA5NDQsImV4cCI6MTczODY5NDU0NH0.eJ7LOLmSwZBVcdol6_7trjeNQBQKjF0IGnJnWrqwpi80Fm5OlezbV2V0rhKmrFA5kW8o7REniUSWEVCIQcrb4A");
// WARNING: Cookies will be stripped away by the browser before sending the request.
xhr.setRequestHeader("Cookie", "lang=en");

xhr.send();
CURL *curl;
CURLcode res;
curl = curl_easy_init();
if(curl) {
  curl_easy_setopt(curl, CURLOPT_CUSTOMREQUEST, "GET");
  curl_easy_setopt(curl, CURLOPT_URL, "https://sandbox.ecartpay.com/api/transactions/678551ec8b3f78f49c915e34");
  curl_easy_setopt(curl, CURLOPT_FOLLOWLOCATION, 1L);
  curl_easy_setopt(curl, CURLOPT_DEFAULT_PROTOCOL, "https");
  struct curl_slist *headers = NULL;
  headers = curl_slist_append(headers, "Authorization: eyJhbGciOiJIUzUxMiIsInR5cCI6IkpXVCJ9.eyJpZCI6IjY3MmE4NTAzNzFiZTBlY2Y1NTRkMDUxNiIsImFjY291bnRfaWQiOiI2NzJhODUwMzcxYmUwZWNmNTU0ZDA1MGMiLCJpYXQiOjE3Mzg2OTA5NDQsImV4cCI6MTczODY5NDU0NH0.eJ7LOLmSwZBVcdol6_7trjeNQBQKjF0IGnJnWrqwpi80Fm5OlezbV2V0rhKmrFA5kW8o7REniUSWEVCIQcrb4A");
  headers = curl_slist_append(headers, "Cookie: lang=en");
  curl_easy_setopt(curl, CURLOPT_HTTPHEADER, headers);
  res = curl_easy_perform(curl);
  curl_slist_free_all(headers);
}
curl_easy_cleanup(curl);
// Axios

const axios = require('axios');

let config = {
  method: 'get',
  maxBodyLength: Infinity,
  url: 'https://sandbox.ecartpay.com/api/transactions/678551ec8b3f78f49c915e34',
  headers: { 
    'Authorization': 'eyJhbGciOiJIUzUxMiIsInR5cCI6IkpXVCJ9.eyJpZCI6IjY3MmE4NTAzNzFiZTBlY2Y1NTRkMDUxNiIsImFjY291bnRfaWQiOiI2NzJhODUwMzcxYmUwZWNmNTU0ZDA1MGMiLCJpYXQiOjE3Mzg2OTA5NDQsImV4cCI6MTczODY5NDU0NH0.eJ7LOLmSwZBVcdol6_7trjeNQBQKjF0IGnJnWrqwpi80Fm5OlezbV2V0rhKmrFA5kW8o7REniUSWEVCIQcrb4A', 
    'Cookie': 'lang=en'
  }
};

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

// -------------------------------------------------------------

// Native

var https = require('follow-redirects').https;
var fs = require('fs');

var options = {
  'method': 'GET',
  'hostname': 'sandbox.ecartpay.com',
  'path': '/api/transactions/678551ec8b3f78f49c915e34',
  'headers': {
    'Authorization': 'eyJhbGciOiJIUzUxMiIsInR5cCI6IkpXVCJ9.eyJpZCI6IjY3MmE4NTAzNzFiZTBlY2Y1NTRkMDUxNiIsImFjY291bnRfaWQiOiI2NzJhODUwMzcxYmUwZWNmNTU0ZDA1MGMiLCJpYXQiOjE3Mzg2OTA5NDQsImV4cCI6MTczODY5NDU0NH0.eJ7LOLmSwZBVcdol6_7trjeNQBQKjF0IGnJnWrqwpi80Fm5OlezbV2V0rhKmrFA5kW8o7REniUSWEVCIQcrb4A',
    'Cookie': 'lang=en'
  },
  'maxRedirects': 20
};

var req = https.request(options, function (res) {
  var chunks = [];

  res.on("data", function (chunk) {
    chunks.push(chunk);
  });

  res.on("end", function (chunk) {
    var body = Buffer.concat(chunks);
    console.log(body.toString());
  });

  res.on("error", function (error) {
    console.error(error);
  });
});

req.end();

// -------------------------------------------------------------

// Request

var request = require('request');
var options = {
  'method': 'GET',
  'url': 'https://sandbox.ecartpay.com/api/transactions/678551ec8b3f78f49c915e34',
  'headers': {
    'Authorization': 'eyJhbGciOiJIUzUxMiIsInR5cCI6IkpXVCJ9.eyJpZCI6IjY3MmE4NTAzNzFiZTBlY2Y1NTRkMDUxNiIsImFjY291bnRfaWQiOiI2NzJhODUwMzcxYmUwZWNmNTU0ZDA1MGMiLCJpYXQiOjE3Mzg2OTA5NDQsImV4cCI6MTczODY5NDU0NH0.eJ7LOLmSwZBVcdol6_7trjeNQBQKjF0IGnJnWrqwpi80Fm5OlezbV2V0rhKmrFA5kW8o7REniUSWEVCIQcrb4A',
    'Cookie': 'lang=en'
  }
};
request(options, function (error, response) {
  if (error) throw new Error(error);
  console.log(response.body);
});

// -------------------------------------------------------------

// Unirest

var unirest = require('unirest');
var req = unirest('GET', 'https://sandbox.ecartpay.com/api/transactions/678551ec8b3f78f49c915e34')
  .headers({
    'Authorization': 'eyJhbGciOiJIUzUxMiIsInR5cCI6IkpXVCJ9.eyJpZCI6IjY3MmE4NTAzNzFiZTBlY2Y1NTRkMDUxNiIsImFjY291bnRfaWQiOiI2NzJhODUwMzcxYmUwZWNmNTU0ZDA1MGMiLCJpYXQiOjE3Mzg2OTA5NDQsImV4cCI6MTczODY5NDU0NH0.eJ7LOLmSwZBVcdol6_7trjeNQBQKjF0IGnJnWrqwpi80Fm5OlezbV2V0rhKmrFA5kW8o7REniUSWEVCIQcrb4A',
    'Cookie': 'lang=en'
  })
  .end(function (res) { 
    if (res.error) throw new Error(res.error); 
    console.log(res.raw_body);
  });
#import <Foundation/Foundation.h>

dispatch_semaphore_t sema = dispatch_semaphore_create(0);

NSMutableURLRequest *request = [NSMutableURLRequest requestWithURL:[NSURL URLWithString:@"https://sandbox.ecartpay.com/api/transactions/678551ec8b3f78f49c915e34"]
  cachePolicy:NSURLRequestUseProtocolCachePolicy
  timeoutInterval:10.0];
NSDictionary *headers = @{
  @"Authorization": @"eyJhbGciOiJIUzUxMiIsInR5cCI6IkpXVCJ9.eyJpZCI6IjY3MmE4NTAzNzFiZTBlY2Y1NTRkMDUxNiIsImFjY291bnRfaWQiOiI2NzJhODUwMzcxYmUwZWNmNTU0ZDA1MGMiLCJpYXQiOjE3Mzg2OTA5NDQsImV4cCI6MTczODY5NDU0NH0.eJ7LOLmSwZBVcdol6_7trjeNQBQKjF0IGnJnWrqwpi80Fm5OlezbV2V0rhKmrFA5kW8o7REniUSWEVCIQcrb4A",
  @"Cookie": @"lang=en"
};

[request setAllHTTPHeaderFields:headers];

[request setHTTPMethod:@"GET"];

NSURLSession *session = [NSURLSession sharedSession];
NSURLSessionDataTask *dataTask = [session dataTaskWithRequest:request
completionHandler:^(NSData *data, NSURLResponse *response, NSError *error) {
  if (error) {
    NSLog(@"%@", error);
    dispatch_semaphore_signal(sema);
  } else {
    NSHTTPURLResponse *httpResponse = (NSHTTPURLResponse *) response;
    NSError *parseError = nil;
    NSDictionary *responseDictionary = [NSJSONSerialization JSONObjectWithData:data options:0 error:&parseError];
    NSLog(@"%@",responseDictionary);
    dispatch_semaphore_signal(sema);
  }
}];
[dataTask resume];
dispatch_semaphore_wait(sema, DISPATCH_TIME_FOREVER);
open Lwt
open Cohttp
open Cohttp_lwt_unix

let reqBody = 
  let uri = Uri.of_string "https://sandbox.ecartpay.com/api/transactions/678551ec8b3f78f49c915e34" in
  let headers = Header.init ()
    |> fun h -> Header.add h "Authorization" "eyJhbGciOiJIUzUxMiIsInR5cCI6IkpXVCJ9.eyJpZCI6IjY3MmE4NTAzNzFiZTBlY2Y1NTRkMDUxNiIsImFjY291bnRfaWQiOiI2NzJhODUwMzcxYmUwZWNmNTU0ZDA1MGMiLCJpYXQiOjE3Mzg2OTA5NDQsImV4cCI6MTczODY5NDU0NH0.eJ7LOLmSwZBVcdol6_7trjeNQBQKjF0IGnJnWrqwpi80Fm5OlezbV2V0rhKmrFA5kW8o7REniUSWEVCIQcrb4A"
    |> fun h -> Header.add h "Cookie" "lang=en"
  in
  Client.call ~headers `GET uri >>= fun (_resp, body) ->
  body |> Cohttp_lwt.Body.to_string >|= fun body -> body

let () =
  let respBody = Lwt_main.run reqBody in
  print_endline (respBody)
// cURL

<?php

$curl = curl_init();

curl_setopt_array($curl, array(
  CURLOPT_URL => 'https://sandbox.ecartpay.com/api/transactions/678551ec8b3f78f49c915e34',
  CURLOPT_RETURNTRANSFER => true,
  CURLOPT_ENCODING => '',
  CURLOPT_MAXREDIRS => 10,
  CURLOPT_TIMEOUT => 0,
  CURLOPT_FOLLOWLOCATION => true,
  CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
  CURLOPT_CUSTOMREQUEST => 'GET',
  CURLOPT_HTTPHEADER => array(
    'Authorization: eyJhbGciOiJIUzUxMiIsInR5cCI6IkpXVCJ9.eyJpZCI6IjY3MmE4NTAzNzFiZTBlY2Y1NTRkMDUxNiIsImFjY291bnRfaWQiOiI2NzJhODUwMzcxYmUwZWNmNTU0ZDA1MGMiLCJpYXQiOjE3Mzg2OTA5NDQsImV4cCI6MTczODY5NDU0NH0.eJ7LOLmSwZBVcdol6_7trjeNQBQKjF0IGnJnWrqwpi80Fm5OlezbV2V0rhKmrFA5kW8o7REniUSWEVCIQcrb4A',
    'Cookie: lang=en'
  ),
));

$response = curl_exec($curl);

curl_close($curl);
echo $response;

// -------------------------------------------------------------

// Guzzle

<?php
$client = new Client();
$headers = [
  'Authorization' => 'eyJhbGciOiJIUzUxMiIsInR5cCI6IkpXVCJ9.eyJpZCI6IjY3MmE4NTAzNzFiZTBlY2Y1NTRkMDUxNiIsImFjY291bnRfaWQiOiI2NzJhODUwMzcxYmUwZWNmNTU0ZDA1MGMiLCJpYXQiOjE3Mzg2OTA5NDQsImV4cCI6MTczODY5NDU0NH0.eJ7LOLmSwZBVcdol6_7trjeNQBQKjF0IGnJnWrqwpi80Fm5OlezbV2V0rhKmrFA5kW8o7REniUSWEVCIQcrb4A',
  'Cookie' => 'lang=en'
];
$request = new Request('GET', 'https://sandbox.ecartpay.com/api/transactions/678551ec8b3f78f49c915e34', $headers);
$res = $client->sendAsync($request)->wait();
echo $res->getBody();

// -------------------------------------------------------------

// HTTP_Request2

<?php
require_once 'HTTP/Request2.php';
$request = new HTTP_Request2();
$request->setUrl('https://sandbox.ecartpay.com/api/transactions/678551ec8b3f78f49c915e34');
$request->setMethod(HTTP_Request2::METHOD_GET);
$request->setConfig(array(
  'follow_redirects' => TRUE
));
$request->setHeader(array(
  'Authorization' => 'eyJhbGciOiJIUzUxMiIsInR5cCI6IkpXVCJ9.eyJpZCI6IjY3MmE4NTAzNzFiZTBlY2Y1NTRkMDUxNiIsImFjY291bnRfaWQiOiI2NzJhODUwMzcxYmUwZWNmNTU0ZDA1MGMiLCJpYXQiOjE3Mzg2OTA5NDQsImV4cCI6MTczODY5NDU0NH0.eJ7LOLmSwZBVcdol6_7trjeNQBQKjF0IGnJnWrqwpi80Fm5OlezbV2V0rhKmrFA5kW8o7REniUSWEVCIQcrb4A',
  'Cookie' => 'lang=en'
));
try {
  $response = $request->send();
  if ($response->getStatus() == 200) {
    echo $response->getBody();
  }
  else {
    echo 'Unexpected HTTP status: ' . $response->getStatus() . ' ' .
    $response->getReasonPhrase();
  }
}
catch(HTTP_Request2_Exception $e) {
  echo 'Error: ' . $e->getMessage();
}

// -------------------------------------------------------------

// pecl_http

<?php
$client = new http\Client;
$request = new http\Client\Request;
$request->setRequestUrl('https://sandbox.ecartpay.com/api/transactions/678551ec8b3f78f49c915e34');
$request->setRequestMethod('GET');
$request->setOptions(array());
$request->setHeaders(array(
  'Authorization' => 'eyJhbGciOiJIUzUxMiIsInR5cCI6IkpXVCJ9.eyJpZCI6IjY3MmE4NTAzNzFiZTBlY2Y1NTRkMDUxNiIsImFjY291bnRfaWQiOiI2NzJhODUwMzcxYmUwZWNmNTU0ZDA1MGMiLCJpYXQiOjE3Mzg2OTA5NDQsImV4cCI6MTczODY5NDU0NH0.eJ7LOLmSwZBVcdol6_7trjeNQBQKjF0IGnJnWrqwpi80Fm5OlezbV2V0rhKmrFA5kW8o7REniUSWEVCIQcrb4A',
  'Cookie' => 'lang=en'
));
$client->enqueue($request)->send();
$response = $client->getResponse();
echo $response->getBody();
$headers = New-Object "System.Collections.Generic.Dictionary[[String],[String]]"
$headers.Add("Authorization", "eyJhbGciOiJIUzUxMiIsInR5cCI6IkpXVCJ9.eyJpZCI6IjY3MmE4NTAzNzFiZTBlY2Y1NTRkMDUxNiIsImFjY291bnRfaWQiOiI2NzJhODUwMzcxYmUwZWNmNTU0ZDA1MGMiLCJpYXQiOjE3Mzg2OTA5NDQsImV4cCI6MTczODY5NDU0NH0.eJ7LOLmSwZBVcdol6_7trjeNQBQKjF0IGnJnWrqwpi80Fm5OlezbV2V0rhKmrFA5kW8o7REniUSWEVCIQcrb4A")
$headers.Add("Cookie", "lang=en")

$response = Invoke-RestMethod 'https://sandbox.ecartpay.com/api/transactions/678551ec8b3f78f49c915e34' -Method 'GET' -Headers $headers
$response | ConvertTo-Json
# http.client

import http.client

conn = http.client.HTTPSConnection("sandbox.ecartpay.com")
payload = ''
headers = {
  'Authorization': 'eyJhbGciOiJIUzUxMiIsInR5cCI6IkpXVCJ9.eyJpZCI6IjY3MmE4NTAzNzFiZTBlY2Y1NTRkMDUxNiIsImFjY291bnRfaWQiOiI2NzJhODUwMzcxYmUwZWNmNTU0ZDA1MGMiLCJpYXQiOjE3Mzg2OTA5NDQsImV4cCI6MTczODY5NDU0NH0.eJ7LOLmSwZBVcdol6_7trjeNQBQKjF0IGnJnWrqwpi80Fm5OlezbV2V0rhKmrFA5kW8o7REniUSWEVCIQcrb4A',
  'Cookie': 'lang=en'
}
conn.request("GET", "/api/transactions/678551ec8b3f78f49c915e34", payload, headers)
res = conn.getresponse()
data = res.read()
print(data.decode("utf-8"))

// -------------------------------------------------------------

# Requests

import requests

url = "https://sandbox.ecartpay.com/api/transactions/678551ec8b3f78f49c915e34"

payload = {}
headers = {
  'Authorization': 'eyJhbGciOiJIUzUxMiIsInR5cCI6IkpXVCJ9.eyJpZCI6IjY3MmE4NTAzNzFiZTBlY2Y1NTRkMDUxNiIsImFjY291bnRfaWQiOiI2NzJhODUwMzcxYmUwZWNmNTU0ZDA1MGMiLCJpYXQiOjE3Mzg2OTA5NDQsImV4cCI6MTczODY5NDU0NH0.eJ7LOLmSwZBVcdol6_7trjeNQBQKjF0IGnJnWrqwpi80Fm5OlezbV2V0rhKmrFA5kW8o7REniUSWEVCIQcrb4A',
  'Cookie': 'lang=en'
}

response = requests.request("GET", url, headers=headers, data=payload)

print(response.text)
# httr

library(httr)

headers = c(
  'Authorization' = 'eyJhbGciOiJIUzUxMiIsInR5cCI6IkpXVCJ9.eyJpZCI6IjY3MmE4NTAzNzFiZTBlY2Y1NTRkMDUxNiIsImFjY291bnRfaWQiOiI2NzJhODUwMzcxYmUwZWNmNTU0ZDA1MGMiLCJpYXQiOjE3Mzg2OTA5NDQsImV4cCI6MTczODY5NDU0NH0.eJ7LOLmSwZBVcdol6_7trjeNQBQKjF0IGnJnWrqwpi80Fm5OlezbV2V0rhKmrFA5kW8o7REniUSWEVCIQcrb4A',
  'Cookie' = 'lang=en'
)

res <- VERB("GET", url = "https://sandbox.ecartpay.com/api/transactions/678551ec8b3f78f49c915e34", add_headers(headers))

cat(content(res, 'text'))

// -------------------------------------------------------------

# RCurl

library(RCurl)
headers = c(
  "Authorization" = "eyJhbGciOiJIUzUxMiIsInR5cCI6IkpXVCJ9.eyJpZCI6IjY3MmE4NTAzNzFiZTBlY2Y1NTRkMDUxNiIsImFjY291bnRfaWQiOiI2NzJhODUwMzcxYmUwZWNmNTU0ZDA1MGMiLCJpYXQiOjE3Mzg2OTA5NDQsImV4cCI6MTczODY5NDU0NH0.eJ7LOLmSwZBVcdol6_7trjeNQBQKjF0IGnJnWrqwpi80Fm5OlezbV2V0rhKmrFA5kW8o7REniUSWEVCIQcrb4A",
  "Cookie" = "lang=en"
)
res <- getURL("https://sandbox.ecartpay.com/api/transactions/678551ec8b3f78f49c915e34", .opts=list(httpheader = headers, followlocation = TRUE))
cat(res)
require "uri"
require "net/http"

url = URI("https://sandbox.ecartpay.com/api/transactions/678551ec8b3f78f49c915e34")

https = Net::HTTP.new(url.host, url.port)
https.use_ssl = true

request = Net::HTTP::Get.new(url)
request["Authorization"] = "eyJhbGciOiJIUzUxMiIsInR5cCI6IkpXVCJ9.eyJpZCI6IjY3MmE4NTAzNzFiZTBlY2Y1NTRkMDUxNiIsImFjY291bnRfaWQiOiI2NzJhODUwMzcxYmUwZWNmNTU0ZDA1MGMiLCJpYXQiOjE3Mzg2OTA5NDQsImV4cCI6MTczODY5NDU0NH0.eJ7LOLmSwZBVcdol6_7trjeNQBQKjF0IGnJnWrqwpi80Fm5OlezbV2V0rhKmrFA5kW8o7REniUSWEVCIQcrb4A"
request["Cookie"] = "lang=en"

response = https.request(request)
puts response.read_body
#[tokio::main]
async fn main() -> Result<(), Box<dyn std::error::Error>> {
    let client = reqwest::Client::builder()
        .build()?;

    let mut headers = reqwest::header::HeaderMap::new();
    headers.insert("Authorization", "eyJhbGciOiJIUzUxMiIsInR5cCI6IkpXVCJ9.eyJpZCI6IjY3MmE4NTAzNzFiZTBlY2Y1NTRkMDUxNiIsImFjY291bnRfaWQiOiI2NzJhODUwMzcxYmUwZWNmNTU0ZDA1MGMiLCJpYXQiOjE3Mzg2OTA5NDQsImV4cCI6MTczODY5NDU0NH0.eJ7LOLmSwZBVcdol6_7trjeNQBQKjF0IGnJnWrqwpi80Fm5OlezbV2V0rhKmrFA5kW8o7REniUSWEVCIQcrb4A".parse()?);
    headers.insert("Cookie", "lang=en".parse()?);

    let request = client.request(reqwest::Method::GET, "https://sandbox.ecartpay.com/api/transactions/678551ec8b3f78f49c915e34")
        .headers(headers);

    let response = request.send().await?;
    let body = response.text().await?;

    println!("{}", body);

    Ok(())
}
# Httpie

http --follow --timeout 3600 GET 'https://sandbox.ecartpay.com/api/transactions/678551ec8b3f78f49c915e34' \
 Authorization:'eyJhbGciOiJIUzUxMiIsInR5cCI6IkpXVCJ9.eyJpZCI6IjY3MmE4NTAzNzFiZTBlY2Y1NTRkMDUxNiIsImFjY291bnRfaWQiOiI2NzJhODUwMzcxYmUwZWNmNTU0ZDA1MGMiLCJpYXQiOjE3Mzg2OTA5NDQsImV4cCI6MTczODY5NDU0NH0.eJ7LOLmSwZBVcdol6_7trjeNQBQKjF0IGnJnWrqwpi80Fm5OlezbV2V0rhKmrFA5kW8o7REniUSWEVCIQcrb4A' \
 Cookie:'lang=en'

// -------------------------------------------------------------

# wget

wget --no-check-certificate --quiet \
  --method GET \
  --timeout=0 \
  --header 'Authorization: eyJhbGciOiJIUzUxMiIsInR5cCI6IkpXVCJ9.eyJpZCI6IjY3MmE4NTAzNzFiZTBlY2Y1NTRkMDUxNiIsImFjY291bnRfaWQiOiI2NzJhODUwMzcxYmUwZWNmNTU0ZDA1MGMiLCJpYXQiOjE3Mzg2OTA5NDQsImV4cCI6MTczODY5NDU0NH0.eJ7LOLmSwZBVcdol6_7trjeNQBQKjF0IGnJnWrqwpi80Fm5OlezbV2V0rhKmrFA5kW8o7REniUSWEVCIQcrb4A' \
  --header 'Cookie: lang=en' \
   'https://sandbox.ecartpay.com/api/transactions/678551ec8b3f78f49c915e34'
var request = URLRequest(url: URL(string: "https://sandbox.ecartpay.com/api/transactions/678551ec8b3f78f49c915e34")!,timeoutInterval: Double.infinity)
request.addValue("eyJhbGciOiJIUzUxMiIsInR5cCI6IkpXVCJ9.eyJpZCI6IjY3MmE4NTAzNzFiZTBlY2Y1NTRkMDUxNiIsImFjY291bnRfaWQiOiI2NzJhODUwMzcxYmUwZWNmNTU0ZDA1MGMiLCJpYXQiOjE3Mzg2OTA5NDQsImV4cCI6MTczODY5NDU0NH0.eJ7LOLmSwZBVcdol6_7trjeNQBQKjF0IGnJnWrqwpi80Fm5OlezbV2V0rhKmrFA5kW8o7REniUSWEVCIQcrb4A", forHTTPHeaderField: "Authorization")
request.addValue("lang=en", forHTTPHeaderField: "Cookie")

request.httpMethod = "GET"

let task = URLSession.shared.dataTask(with: request) { data, response, error in 
  guard let data = data else {
    print(String(describing: error))
    return
  }
  print(String(data: data, encoding: .utf8)!)
}

task.resume()

Example Response

{
    "transaction_id": "TR45267158",
    "type": "payment",
    "status": "paid",
    "amount": 245.65,
    "fee": 4.35,
    "previous": 251469.12,
    "current": 251469.12,
    "currency": "MXN",
    "gateway": {
        "gateway": "paypal",
        "type": "paypal"
    },
    "exchange": 1,
    "reference_id": "869",
    "reference": "869",
    "custom_keys": true,
    "order_number": "OR14658051",
    "email": "[email protected]",
    "first_name": "Test Squitin",
    "last_name": "",
    "phone": "8881049069",
    "purchase": false,
    "refunds": {
        "total_amount": 0,
        "total_card": 0,
        "total_pay_cash": 0,
        "remaining_card_amount": 250,
        "remaining_pay_cash_amount": 0
    },
    "total_available": 250,
    "order": {
        "id": "61a53a0ff6ea776ee3b36c9f",
        "account_id": "5d2d436e3199ae000449065b",
        "authorization_id": "60a2bb3d6830a20306e763f9",
        "number": "OR14658051",
        "status": "paid",
        "email": "[email protected]",
        "first_name": "test Squitin",
        "last_name": "",
        "phone": "8881049069",
        "currency": "MXN",
        "items": [
            {
                "name": "Top Up",
                "quantity": 1,
                "price": 250,
                "discount": 0,
                "total": 250,
                "tax": 0
            }
        ],
        "shipping_items": [],
        "discounts": [],
        "totals": {
            "subtotal": 250,
            "total": 250,
            "tax": 0,
            "discount": 0,
            "shipping": 0
        },
        "risk_score": 40,
        "risk_notes": [
            "The address has to many number cards."
        ],
        "reference_id": "869",
        "reference": "869",
        "fee": 4.35,
        "confirmated": false,
        "created_at": "2021-11-29T20:37:35.702Z",
        "updated_at": "2021-11-29T20:38:56.783Z",
        "custom_keys": true,
        "gateway_method_id": "5ee3e4b8e0d3479e93b380b0",
        "keys_id": "611408df355a3338e9c64160",
        "payments": [
            {
                "type": "paypal",
                "gateway": "paypal"
            }
        ],
        "risk": "low",
        "client_billing": [],
        "order_billing": []
    }
}

This endpoint provides a high-level view of a specific financial transaction, identifying the gateway details and transaction fees.



Types of Transactions

Ecart Pay supports three types of transactions:

  • Payment (Payin Received): Represents funds received from customers.
  • Charge (Payout Sent): Refers to funds paid to customers or other entities.

Example Use Case

A business reconciles its account using transaction summaries to identify total revenue and expenses. Using the detailed transaction history, they pinpoint specific customer payments or charges. The withdrawal details are reviewed to track funds transferred to the company’s bank account.

Conclusion

Ecart Pay’s transaction management tools empower businesses with the ability to monitor, reconcile, and analyze their financial activities effectively. By leveraging these features, users can ensure accuracy, transparency, and informed decision-making in their financial operations.