Documentation

Retrieving Payment Links

When working with payment links in Ecart Pay, you have two primary options for accessing them via API: retrieving all saved links or searching for a specific link.

These options allow for efficient management of payment links, whether you want to review your entire inventory or find a particular one.

Retrieve All Payment Links

This method provides a complete list of all payment link templates saved in your account. It's ideal for generating a general menu or overview of available links.

Endpoint

GET {{baseURL}}/api/templates

Headers

  • Authorization: {token}

Example Request

curl --location 'https://sandbox.ecartpay.com/api/templates' \
--header 'Authorization: eyJhbGciOiJIUzUxMiIsInR5cCI6IkpXVCJ9.eyJpZCI6IjY3MmE4NTAzNzFiZTBlY2Y1NTRkMDUxNiIsImFjY291bnRfaWQiOiI2NzJhODUwMzcxYmUwZWNmNTU0ZDA1MGMiLCJpYXQiOjE3MzgxNjkyMzYsImV4cCI6MTczODE3MjgzNn0.f8YIyb3DyuDEdd3fAISmHV4GwPH8U2IdyO-MIRJ9iTfUEg8OTXSOTsZAgIiPd4j544GGn6g0mqz36-6CJMKofg' \
--header 'Cookie: lang=en'
package main

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

func main() {

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

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

  if err != nil {
    fmt.Println(err)
    return
  }
  req.Header.Add("Authorization", "eyJhbGciOiJIUzUxMiIsInR5cCI6IkpXVCJ9.eyJpZCI6IjY3MmE4NTAzNzFiZTBlY2Y1NTRkMDUxNiIsImFjY291bnRfaWQiOiI2NzJhODUwMzcxYmUwZWNmNTU0ZDA1MGMiLCJpYXQiOjE3MzgxNjkyMzYsImV4cCI6MTczODE3MjgzNn0.f8YIyb3DyuDEdd3fAISmHV4GwPH8U2IdyO-MIRJ9iTfUEg8OTXSOTsZAgIiPd4j544GGn6g0mqz36-6CJMKofg")
  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/templates HTTP/1.1
Host: sandbox.ecartpay.com
Authorization: eyJhbGciOiJIUzUxMiIsInR5cCI6IkpXVCJ9.eyJpZCI6IjY3MmE4NTAzNzFiZTBlY2Y1NTRkMDUxNiIsImFjY291bnRfaWQiOiI2NzJhODUwMzcxYmUwZWNmNTU0ZDA1MGMiLCJpYXQiOjE3MzgxNjkyMzYsImV4cCI6MTczODE3MjgzNn0.f8YIyb3DyuDEdd3fAISmHV4GwPH8U2IdyO-MIRJ9iTfUEg8OTXSOTsZAgIiPd4j544GGn6g0mqz36-6CJMKofg
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/templates")
  .method("GET", body)
  .addHeader("Authorization", "eyJhbGciOiJIUzUxMiIsInR5cCI6IkpXVCJ9.eyJpZCI6IjY3MmE4NTAzNzFiZTBlY2Y1NTRkMDUxNiIsImFjY291bnRfaWQiOiI2NzJhODUwMzcxYmUwZWNmNTU0ZDA1MGMiLCJpYXQiOjE3MzgxNjkyMzYsImV4cCI6MTczODE3MjgzNn0.f8YIyb3DyuDEdd3fAISmHV4GwPH8U2IdyO-MIRJ9iTfUEg8OTXSOTsZAgIiPd4j544GGn6g0mqz36-6CJMKofg")
  .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/templates")
  .header("Authorization", "eyJhbGciOiJIUzUxMiIsInR5cCI6IkpXVCJ9.eyJpZCI6IjY3MmE4NTAzNzFiZTBlY2Y1NTRkMDUxNiIsImFjY291bnRfaWQiOiI2NzJhODUwMzcxYmUwZWNmNTU0ZDA1MGMiLCJpYXQiOjE3MzgxNjkyMzYsImV4cCI6MTczODE3MjgzNn0.f8YIyb3DyuDEdd3fAISmHV4GwPH8U2IdyO-MIRJ9iTfUEg8OTXSOTsZAgIiPd4j544GGn6g0mqz36-6CJMKofg")
  .header("Cookie", "lang=en")
  .asString();
// Fetch

const myHeaders = new Headers();
myHeaders.append("Authorization", "eyJhbGciOiJIUzUxMiIsInR5cCI6IkpXVCJ9.eyJpZCI6IjY3MmE4NTAzNzFiZTBlY2Y1NTRkMDUxNiIsImFjY291bnRfaWQiOiI2NzJhODUwMzcxYmUwZWNmNTU0ZDA1MGMiLCJpYXQiOjE3MzgxNjkyMzYsImV4cCI6MTczODE3MjgzNn0.f8YIyb3DyuDEdd3fAISmHV4GwPH8U2IdyO-MIRJ9iTfUEg8OTXSOTsZAgIiPd4j544GGn6g0mqz36-6CJMKofg");
myHeaders.append("Cookie", "lang=en");

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

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

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

// jQuery

var settings = {
  "url": "https://sandbox.ecartpay.com/api/templates",
  "method": "GET",
  "timeout": 0,
  "headers": {
    "Authorization": "eyJhbGciOiJIUzUxMiIsInR5cCI6IkpXVCJ9.eyJpZCI6IjY3MmE4NTAzNzFiZTBlY2Y1NTRkMDUxNiIsImFjY291bnRfaWQiOiI2NzJhODUwMzcxYmUwZWNmNTU0ZDA1MGMiLCJpYXQiOjE3MzgxNjkyMzYsImV4cCI6MTczODE3MjgzNn0.f8YIyb3DyuDEdd3fAISmHV4GwPH8U2IdyO-MIRJ9iTfUEg8OTXSOTsZAgIiPd4j544GGn6g0mqz36-6CJMKofg",
    "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/templates");
xhr.setRequestHeader("Authorization", "eyJhbGciOiJIUzUxMiIsInR5cCI6IkpXVCJ9.eyJpZCI6IjY3MmE4NTAzNzFiZTBlY2Y1NTRkMDUxNiIsImFjY291bnRfaWQiOiI2NzJhODUwMzcxYmUwZWNmNTU0ZDA1MGMiLCJpYXQiOjE3MzgxNjkyMzYsImV4cCI6MTczODE3MjgzNn0.f8YIyb3DyuDEdd3fAISmHV4GwPH8U2IdyO-MIRJ9iTfUEg8OTXSOTsZAgIiPd4j544GGn6g0mqz36-6CJMKofg");
// 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/templates");
  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.eyJpZCI6IjY3MmE4NTAzNzFiZTBlY2Y1NTRkMDUxNiIsImFjY291bnRfaWQiOiI2NzJhODUwMzcxYmUwZWNmNTU0ZDA1MGMiLCJpYXQiOjE3MzgxNjkyMzYsImV4cCI6MTczODE3MjgzNn0.f8YIyb3DyuDEdd3fAISmHV4GwPH8U2IdyO-MIRJ9iTfUEg8OTXSOTsZAgIiPd4j544GGn6g0mqz36-6CJMKofg");
  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/templates',
  headers: { 
    'Authorization': 'eyJhbGciOiJIUzUxMiIsInR5cCI6IkpXVCJ9.eyJpZCI6IjY3MmE4NTAzNzFiZTBlY2Y1NTRkMDUxNiIsImFjY291bnRfaWQiOiI2NzJhODUwMzcxYmUwZWNmNTU0ZDA1MGMiLCJpYXQiOjE3MzgxNjkyMzYsImV4cCI6MTczODE3MjgzNn0.f8YIyb3DyuDEdd3fAISmHV4GwPH8U2IdyO-MIRJ9iTfUEg8OTXSOTsZAgIiPd4j544GGn6g0mqz36-6CJMKofg', 
    '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/templates',
  'headers': {
    'Authorization': 'eyJhbGciOiJIUzUxMiIsInR5cCI6IkpXVCJ9.eyJpZCI6IjY3MmE4NTAzNzFiZTBlY2Y1NTRkMDUxNiIsImFjY291bnRfaWQiOiI2NzJhODUwMzcxYmUwZWNmNTU0ZDA1MGMiLCJpYXQiOjE3MzgxNjkyMzYsImV4cCI6MTczODE3MjgzNn0.f8YIyb3DyuDEdd3fAISmHV4GwPH8U2IdyO-MIRJ9iTfUEg8OTXSOTsZAgIiPd4j544GGn6g0mqz36-6CJMKofg',
    '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/templates',
  'headers': {
    'Authorization': 'eyJhbGciOiJIUzUxMiIsInR5cCI6IkpXVCJ9.eyJpZCI6IjY3MmE4NTAzNzFiZTBlY2Y1NTRkMDUxNiIsImFjY291bnRfaWQiOiI2NzJhODUwMzcxYmUwZWNmNTU0ZDA1MGMiLCJpYXQiOjE3MzgxNjkyMzYsImV4cCI6MTczODE3MjgzNn0.f8YIyb3DyuDEdd3fAISmHV4GwPH8U2IdyO-MIRJ9iTfUEg8OTXSOTsZAgIiPd4j544GGn6g0mqz36-6CJMKofg',
    '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/templates')
  .headers({
    'Authorization': 'eyJhbGciOiJIUzUxMiIsInR5cCI6IkpXVCJ9.eyJpZCI6IjY3MmE4NTAzNzFiZTBlY2Y1NTRkMDUxNiIsImFjY291bnRfaWQiOiI2NzJhODUwMzcxYmUwZWNmNTU0ZDA1MGMiLCJpYXQiOjE3MzgxNjkyMzYsImV4cCI6MTczODE3MjgzNn0.f8YIyb3DyuDEdd3fAISmHV4GwPH8U2IdyO-MIRJ9iTfUEg8OTXSOTsZAgIiPd4j544GGn6g0mqz36-6CJMKofg',
    '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/templates"]
  cachePolicy:NSURLRequestUseProtocolCachePolicy
  timeoutInterval:10.0];
NSDictionary *headers = @{
  @"Authorization": @"eyJhbGciOiJIUzUxMiIsInR5cCI6IkpXVCJ9.eyJpZCI6IjY3MmE4NTAzNzFiZTBlY2Y1NTRkMDUxNiIsImFjY291bnRfaWQiOiI2NzJhODUwMzcxYmUwZWNmNTU0ZDA1MGMiLCJpYXQiOjE3MzgxNjkyMzYsImV4cCI6MTczODE3MjgzNn0.f8YIyb3DyuDEdd3fAISmHV4GwPH8U2IdyO-MIRJ9iTfUEg8OTXSOTsZAgIiPd4j544GGn6g0mqz36-6CJMKofg",
  @"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/templates" in
  let headers = Header.init ()
    |> fun h -> Header.add h "Authorization" "eyJhbGciOiJIUzUxMiIsInR5cCI6IkpXVCJ9.eyJpZCI6IjY3MmE4NTAzNzFiZTBlY2Y1NTRkMDUxNiIsImFjY291bnRfaWQiOiI2NzJhODUwMzcxYmUwZWNmNTU0ZDA1MGMiLCJpYXQiOjE3MzgxNjkyMzYsImV4cCI6MTczODE3MjgzNn0.f8YIyb3DyuDEdd3fAISmHV4GwPH8U2IdyO-MIRJ9iTfUEg8OTXSOTsZAgIiPd4j544GGn6g0mqz36-6CJMKofg"
    |> 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/templates',
  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.eyJpZCI6IjY3MmE4NTAzNzFiZTBlY2Y1NTRkMDUxNiIsImFjY291bnRfaWQiOiI2NzJhODUwMzcxYmUwZWNmNTU0ZDA1MGMiLCJpYXQiOjE3MzgxNjkyMzYsImV4cCI6MTczODE3MjgzNn0.f8YIyb3DyuDEdd3fAISmHV4GwPH8U2IdyO-MIRJ9iTfUEg8OTXSOTsZAgIiPd4j544GGn6g0mqz36-6CJMKofg',
    'Cookie: lang=en'
  ),
));

$response = curl_exec($curl);

curl_close($curl);
echo $response;

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

// Guzzle

<?php
$client = new Client();
$headers = [
  'Authorization' => 'eyJhbGciOiJIUzUxMiIsInR5cCI6IkpXVCJ9.eyJpZCI6IjY3MmE4NTAzNzFiZTBlY2Y1NTRkMDUxNiIsImFjY291bnRfaWQiOiI2NzJhODUwMzcxYmUwZWNmNTU0ZDA1MGMiLCJpYXQiOjE3MzgxNjkyMzYsImV4cCI6MTczODE3MjgzNn0.f8YIyb3DyuDEdd3fAISmHV4GwPH8U2IdyO-MIRJ9iTfUEg8OTXSOTsZAgIiPd4j544GGn6g0mqz36-6CJMKofg',
  'Cookie' => 'lang=en'
];
$request = new Request('GET', 'https://sandbox.ecartpay.com/api/templates', $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/templates');
$request->setMethod(HTTP_Request2::METHOD_GET);
$request->setConfig(array(
  'follow_redirects' => TRUE
));
$request->setHeader(array(
  'Authorization' => 'eyJhbGciOiJIUzUxMiIsInR5cCI6IkpXVCJ9.eyJpZCI6IjY3MmE4NTAzNzFiZTBlY2Y1NTRkMDUxNiIsImFjY291bnRfaWQiOiI2NzJhODUwMzcxYmUwZWNmNTU0ZDA1MGMiLCJpYXQiOjE3MzgxNjkyMzYsImV4cCI6MTczODE3MjgzNn0.f8YIyb3DyuDEdd3fAISmHV4GwPH8U2IdyO-MIRJ9iTfUEg8OTXSOTsZAgIiPd4j544GGn6g0mqz36-6CJMKofg',
  '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/templates');
$request->setRequestMethod('GET');
$request->setOptions(array());
$request->setHeaders(array(
  'Authorization' => 'eyJhbGciOiJIUzUxMiIsInR5cCI6IkpXVCJ9.eyJpZCI6IjY3MmE4NTAzNzFiZTBlY2Y1NTRkMDUxNiIsImFjY291bnRfaWQiOiI2NzJhODUwMzcxYmUwZWNmNTU0ZDA1MGMiLCJpYXQiOjE3MzgxNjkyMzYsImV4cCI6MTczODE3MjgzNn0.f8YIyb3DyuDEdd3fAISmHV4GwPH8U2IdyO-MIRJ9iTfUEg8OTXSOTsZAgIiPd4j544GGn6g0mqz36-6CJMKofg',
  '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.eyJpZCI6IjY3MmE4NTAzNzFiZTBlY2Y1NTRkMDUxNiIsImFjY291bnRfaWQiOiI2NzJhODUwMzcxYmUwZWNmNTU0ZDA1MGMiLCJpYXQiOjE3MzgxNjkyMzYsImV4cCI6MTczODE3MjgzNn0.f8YIyb3DyuDEdd3fAISmHV4GwPH8U2IdyO-MIRJ9iTfUEg8OTXSOTsZAgIiPd4j544GGn6g0mqz36-6CJMKofg")
$headers.Add("Cookie", "lang=en")

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

import http.client

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

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

# Requests

import requests

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

payload = {}
headers = {
  'Authorization': 'eyJhbGciOiJIUzUxMiIsInR5cCI6IkpXVCJ9.eyJpZCI6IjY3MmE4NTAzNzFiZTBlY2Y1NTRkMDUxNiIsImFjY291bnRfaWQiOiI2NzJhODUwMzcxYmUwZWNmNTU0ZDA1MGMiLCJpYXQiOjE3MzgxNjkyMzYsImV4cCI6MTczODE3MjgzNn0.f8YIyb3DyuDEdd3fAISmHV4GwPH8U2IdyO-MIRJ9iTfUEg8OTXSOTsZAgIiPd4j544GGn6g0mqz36-6CJMKofg',
  'Cookie': 'lang=en'
}

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

print(response.text)
# httr

library(httr)

headers = c(
  'Authorization' = 'eyJhbGciOiJIUzUxMiIsInR5cCI6IkpXVCJ9.eyJpZCI6IjY3MmE4NTAzNzFiZTBlY2Y1NTRkMDUxNiIsImFjY291bnRfaWQiOiI2NzJhODUwMzcxYmUwZWNmNTU0ZDA1MGMiLCJpYXQiOjE3MzgxNjkyMzYsImV4cCI6MTczODE3MjgzNn0.f8YIyb3DyuDEdd3fAISmHV4GwPH8U2IdyO-MIRJ9iTfUEg8OTXSOTsZAgIiPd4j544GGn6g0mqz36-6CJMKofg',
  'Cookie' = 'lang=en'
)

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

cat(content(res, 'text'))

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

# RCurl

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

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

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

request = Net::HTTP::Get.new(url)
request["Authorization"] = "eyJhbGciOiJIUzUxMiIsInR5cCI6IkpXVCJ9.eyJpZCI6IjY3MmE4NTAzNzFiZTBlY2Y1NTRkMDUxNiIsImFjY291bnRfaWQiOiI2NzJhODUwMzcxYmUwZWNmNTU0ZDA1MGMiLCJpYXQiOjE3MzgxNjkyMzYsImV4cCI6MTczODE3MjgzNn0.f8YIyb3DyuDEdd3fAISmHV4GwPH8U2IdyO-MIRJ9iTfUEg8OTXSOTsZAgIiPd4j544GGn6g0mqz36-6CJMKofg"
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.eyJpZCI6IjY3MmE4NTAzNzFiZTBlY2Y1NTRkMDUxNiIsImFjY291bnRfaWQiOiI2NzJhODUwMzcxYmUwZWNmNTU0ZDA1MGMiLCJpYXQiOjE3MzgxNjkyMzYsImV4cCI6MTczODE3MjgzNn0.f8YIyb3DyuDEdd3fAISmHV4GwPH8U2IdyO-MIRJ9iTfUEg8OTXSOTsZAgIiPd4j544GGn6g0mqz36-6CJMKofg".parse()?);
    headers.insert("Cookie", "lang=en".parse()?);

    let request = client.request(reqwest::Method::GET, "https://sandbox.ecartpay.com/api/templates")
        .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/templates' \
 Authorization:'eyJhbGciOiJIUzUxMiIsInR5cCI6IkpXVCJ9.eyJpZCI6IjY3MmE4NTAzNzFiZTBlY2Y1NTRkMDUxNiIsImFjY291bnRfaWQiOiI2NzJhODUwMzcxYmUwZWNmNTU0ZDA1MGMiLCJpYXQiOjE3MzgxNjkyMzYsImV4cCI6MTczODE3MjgzNn0.f8YIyb3DyuDEdd3fAISmHV4GwPH8U2IdyO-MIRJ9iTfUEg8OTXSOTsZAgIiPd4j544GGn6g0mqz36-6CJMKofg' \
 Cookie:'lang=en'

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

# wget

wget --no-check-certificate --quiet \
  --method GET \
  --timeout=0 \
  --header 'Authorization: eyJhbGciOiJIUzUxMiIsInR5cCI6IkpXVCJ9.eyJpZCI6IjY3MmE4NTAzNzFiZTBlY2Y1NTRkMDUxNiIsImFjY291bnRfaWQiOiI2NzJhODUwMzcxYmUwZWNmNTU0ZDA1MGMiLCJpYXQiOjE3MzgxNjkyMzYsImV4cCI6MTczODE3MjgzNn0.f8YIyb3DyuDEdd3fAISmHV4GwPH8U2IdyO-MIRJ9iTfUEg8OTXSOTsZAgIiPd4j544GGn6g0mqz36-6CJMKofg' \
  --header 'Cookie: lang=en' \
   'https://sandbox.ecartpay.com/api/templates'
var request = URLRequest(url: URL(string: "https://sandbox.ecartpay.com/api/templates")!,timeoutInterval: Double.infinity)
request.addValue("eyJhbGciOiJIUzUxMiIsInR5cCI6IkpXVCJ9.eyJpZCI6IjY3MmE4NTAzNzFiZTBlY2Y1NTRkMDUxNiIsImFjY291bnRfaWQiOiI2NzJhODUwMzcxYmUwZWNmNTU0ZDA1MGMiLCJpYXQiOjE3MzgxNjkyMzYsImV4cCI6MTczODE3MjgzNn0.f8YIyb3DyuDEdd3fAISmHV4GwPH8U2IdyO-MIRJ9iTfUEg8OTXSOTsZAgIiPd4j544GGn6g0mqz36-6CJMKofg", 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

[
    {
        "id": "6148d0adf6066a0016195dcc",
        "end_date": null,
        "name": "Testing three",
        "currency": "MXN",
        "items": [
            {
                "discount": 0,
                "tax": 0,
                "name": "Blue Shirt",
                "price": 100,
                "quantity": 1,
                "total": 100
            }
        ],
        "start_date": "2021-09-20T18:11:22.000Z",
        "quantity_uses": 1,
        "shipping_items": [],
        "account_id": "5fab2d24f16a2000045fc047",
        "authorization_id": "612569ee77e4a467df8ee3d9",
        "number": "TE43218315",
        "discounts": [],
        "totals": {
            "subtotal": 100,
            "discount": 0,
            "tax": 0,
            "shipping": 0,
            "total": 100
        },
        "created_at": "2021-09-20T18:19:25.987Z",
        "updated_at": "2021-09-20T18:19:25.987Z"
    },
    {
        "id": "6148cecaf6066a0016195dc5",
        "end_date": null,
        "name": "Testing two",
        "currency": "MXN",
        "items": [
            {
                "discount": 0,
                "tax": 0,
                "name": "Pink shirt",
                "price": 250,
                "quantity": 1,
                "total": 250
            }
        ],
        "start_date": "2021-09-20T18:10:57.000Z",
        "quantity_uses": -1,
        "shipping_items": [],
        "account_id": "5fab2d24f16a2000045fc047",
        "authorization_id": "612569ee77e4a467df8ee3d9",
        "number": "TE45830821",
        "discounts": [],
        "totals": {
            "subtotal": 250,
            "discount": 0,
            "tax": 0,
            "shipping": 0,
            "total": 250
        },
        "created_at": "2021-09-20T18:11:22.554Z",
        "updated_at": "2021-09-20T18:11:22.554Z"
    },
    {
        "id": "6148c4f1f6066a0016195d8c",
        "end_date": null,
        "name": "test",
        "currency": "MXN",
        "items": [
            {
                "discount": 0,
                "tax": 0,
                "name": "Pink T-shirt",
                "price": 10,
                "quantity": 1,
                "total": 10
            }
        ],
        "start_date": "2021-09-20T17:28:50.000Z",
        "quantity_uses": 1,
        "shipping_items": [],
        "account_id": "5fab2d24f16a2000045fc047",
        "authorization_id": "612569ee77e4a467df8ee3d9",
        "number": "TE45113116",
        "discounts": [],
        "totals": {
            "subtotal": 10,
            "discount": 0,
            "tax": 0,
            "shipping": 0,
            "total": 10
        },
        "created_at": "2021-09-20T17:29:21.961Z",
        "updated_at": "2021-09-20T17:29:21.961Z"
    }
]
Image 1. Retrieving All the Payment Links

Image 1. Retrieving All the Payment Links

Retrieve a Specific Payment Link

If you need to search for a particular payment link, you can use this endpoint. It functions as a filter, returning detailed information for one specific template based on its ID.

Endpoint

GET {{baseURL}}/api/templates/{{id}}/info

Headers

  • Authorization: {token}

Example Request

curl --location 'https://sandbox.ecartpay.com/api/templates/65a864a93df1d9cacf436c5a/info' \
--header 'Authorization: eyJhbGciOiJIUzUxMiIsInR5cCI6IkpXVCJ9.eyJpZCI6IjY3MmE4NTAzNzFiZTBlY2Y1NTRkMDUxNiIsImFjY291bnRfaWQiOiI2NzJhODUwMzcxYmUwZWNmNTU0ZDA1MGMiLCJpYXQiOjE3MzgxNjkyMzYsImV4cCI6MTczODE3MjgzNn0.f8YIyb3DyuDEdd3fAISmHV4GwPH8U2IdyO-MIRJ9iTfUEg8OTXSOTsZAgIiPd4j544GGn6g0mqz36-6CJMKofg' \
--header 'Cookie: lang=en'
package main

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

func main() {

  url := "https://sandbox.ecartpay.com/api/templates/65a864a93df1d9cacf436c5a/info"
  method := "GET"

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

  if err != nil {
    fmt.Println(err)
    return
  }
  req.Header.Add("Authorization", "eyJhbGciOiJIUzUxMiIsInR5cCI6IkpXVCJ9.eyJpZCI6IjY3MmE4NTAzNzFiZTBlY2Y1NTRkMDUxNiIsImFjY291bnRfaWQiOiI2NzJhODUwMzcxYmUwZWNmNTU0ZDA1MGMiLCJpYXQiOjE3MzgxNjkyMzYsImV4cCI6MTczODE3MjgzNn0.f8YIyb3DyuDEdd3fAISmHV4GwPH8U2IdyO-MIRJ9iTfUEg8OTXSOTsZAgIiPd4j544GGn6g0mqz36-6CJMKofg")
  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/templates/65a864a93df1d9cacf436c5a/info HTTP/1.1
Host: sandbox.ecartpay.com
Authorization: eyJhbGciOiJIUzUxMiIsInR5cCI6IkpXVCJ9.eyJpZCI6IjY3MmE4NTAzNzFiZTBlY2Y1NTRkMDUxNiIsImFjY291bnRfaWQiOiI2NzJhODUwMzcxYmUwZWNmNTU0ZDA1MGMiLCJpYXQiOjE3MzgxNjkyMzYsImV4cCI6MTczODE3MjgzNn0.f8YIyb3DyuDEdd3fAISmHV4GwPH8U2IdyO-MIRJ9iTfUEg8OTXSOTsZAgIiPd4j544GGn6g0mqz36-6CJMKofg
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/templates/65a864a93df1d9cacf436c5a/info")
  .method("GET", body)
  .addHeader("Authorization", "eyJhbGciOiJIUzUxMiIsInR5cCI6IkpXVCJ9.eyJpZCI6IjY3MmE4NTAzNzFiZTBlY2Y1NTRkMDUxNiIsImFjY291bnRfaWQiOiI2NzJhODUwMzcxYmUwZWNmNTU0ZDA1MGMiLCJpYXQiOjE3MzgxNjkyMzYsImV4cCI6MTczODE3MjgzNn0.f8YIyb3DyuDEdd3fAISmHV4GwPH8U2IdyO-MIRJ9iTfUEg8OTXSOTsZAgIiPd4j544GGn6g0mqz36-6CJMKofg")
  .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/templates/65a864a93df1d9cacf436c5a/info")
  .header("Authorization", "eyJhbGciOiJIUzUxMiIsInR5cCI6IkpXVCJ9.eyJpZCI6IjY3MmE4NTAzNzFiZTBlY2Y1NTRkMDUxNiIsImFjY291bnRfaWQiOiI2NzJhODUwMzcxYmUwZWNmNTU0ZDA1MGMiLCJpYXQiOjE3MzgxNjkyMzYsImV4cCI6MTczODE3MjgzNn0.f8YIyb3DyuDEdd3fAISmHV4GwPH8U2IdyO-MIRJ9iTfUEg8OTXSOTsZAgIiPd4j544GGn6g0mqz36-6CJMKofg")
  .header("Cookie", "lang=en")
  .asString();
// Fetch

const myHeaders = new Headers();
myHeaders.append("Authorization", "eyJhbGciOiJIUzUxMiIsInR5cCI6IkpXVCJ9.eyJpZCI6IjY3MmE4NTAzNzFiZTBlY2Y1NTRkMDUxNiIsImFjY291bnRfaWQiOiI2NzJhODUwMzcxYmUwZWNmNTU0ZDA1MGMiLCJpYXQiOjE3MzgxNjkyMzYsImV4cCI6MTczODE3MjgzNn0.f8YIyb3DyuDEdd3fAISmHV4GwPH8U2IdyO-MIRJ9iTfUEg8OTXSOTsZAgIiPd4j544GGn6g0mqz36-6CJMKofg");
myHeaders.append("Cookie", "lang=en");

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

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

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

// jQuery

var settings = {
  "url": "https://sandbox.ecartpay.com/api/templates/65a864a93df1d9cacf436c5a/info",
  "method": "GET",
  "timeout": 0,
  "headers": {
    "Authorization": "eyJhbGciOiJIUzUxMiIsInR5cCI6IkpXVCJ9.eyJpZCI6IjY3MmE4NTAzNzFiZTBlY2Y1NTRkMDUxNiIsImFjY291bnRfaWQiOiI2NzJhODUwMzcxYmUwZWNmNTU0ZDA1MGMiLCJpYXQiOjE3MzgxNjkyMzYsImV4cCI6MTczODE3MjgzNn0.f8YIyb3DyuDEdd3fAISmHV4GwPH8U2IdyO-MIRJ9iTfUEg8OTXSOTsZAgIiPd4j544GGn6g0mqz36-6CJMKofg",
    "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/templates/65a864a93df1d9cacf436c5a/info");
xhr.setRequestHeader("Authorization", "eyJhbGciOiJIUzUxMiIsInR5cCI6IkpXVCJ9.eyJpZCI6IjY3MmE4NTAzNzFiZTBlY2Y1NTRkMDUxNiIsImFjY291bnRfaWQiOiI2NzJhODUwMzcxYmUwZWNmNTU0ZDA1MGMiLCJpYXQiOjE3MzgxNjkyMzYsImV4cCI6MTczODE3MjgzNn0.f8YIyb3DyuDEdd3fAISmHV4GwPH8U2IdyO-MIRJ9iTfUEg8OTXSOTsZAgIiPd4j544GGn6g0mqz36-6CJMKofg");
// 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/templates/65a864a93df1d9cacf436c5a/info");
  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.eyJpZCI6IjY3MmE4NTAzNzFiZTBlY2Y1NTRkMDUxNiIsImFjY291bnRfaWQiOiI2NzJhODUwMzcxYmUwZWNmNTU0ZDA1MGMiLCJpYXQiOjE3MzgxNjkyMzYsImV4cCI6MTczODE3MjgzNn0.f8YIyb3DyuDEdd3fAISmHV4GwPH8U2IdyO-MIRJ9iTfUEg8OTXSOTsZAgIiPd4j544GGn6g0mqz36-6CJMKofg");
  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/templates/65a864a93df1d9cacf436c5a/info',
  headers: { 
    'Authorization': 'eyJhbGciOiJIUzUxMiIsInR5cCI6IkpXVCJ9.eyJpZCI6IjY3MmE4NTAzNzFiZTBlY2Y1NTRkMDUxNiIsImFjY291bnRfaWQiOiI2NzJhODUwMzcxYmUwZWNmNTU0ZDA1MGMiLCJpYXQiOjE3MzgxNjkyMzYsImV4cCI6MTczODE3MjgzNn0.f8YIyb3DyuDEdd3fAISmHV4GwPH8U2IdyO-MIRJ9iTfUEg8OTXSOTsZAgIiPd4j544GGn6g0mqz36-6CJMKofg', 
    '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/templates/65a864a93df1d9cacf436c5a/info',
  'headers': {
    'Authorization': 'eyJhbGciOiJIUzUxMiIsInR5cCI6IkpXVCJ9.eyJpZCI6IjY3MmE4NTAzNzFiZTBlY2Y1NTRkMDUxNiIsImFjY291bnRfaWQiOiI2NzJhODUwMzcxYmUwZWNmNTU0ZDA1MGMiLCJpYXQiOjE3MzgxNjkyMzYsImV4cCI6MTczODE3MjgzNn0.f8YIyb3DyuDEdd3fAISmHV4GwPH8U2IdyO-MIRJ9iTfUEg8OTXSOTsZAgIiPd4j544GGn6g0mqz36-6CJMKofg',
    '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/templates/65a864a93df1d9cacf436c5a/info',
  'headers': {
    'Authorization': 'eyJhbGciOiJIUzUxMiIsInR5cCI6IkpXVCJ9.eyJpZCI6IjY3MmE4NTAzNzFiZTBlY2Y1NTRkMDUxNiIsImFjY291bnRfaWQiOiI2NzJhODUwMzcxYmUwZWNmNTU0ZDA1MGMiLCJpYXQiOjE3MzgxNjkyMzYsImV4cCI6MTczODE3MjgzNn0.f8YIyb3DyuDEdd3fAISmHV4GwPH8U2IdyO-MIRJ9iTfUEg8OTXSOTsZAgIiPd4j544GGn6g0mqz36-6CJMKofg',
    '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/templates/65a864a93df1d9cacf436c5a/info')
  .headers({
    'Authorization': 'eyJhbGciOiJIUzUxMiIsInR5cCI6IkpXVCJ9.eyJpZCI6IjY3MmE4NTAzNzFiZTBlY2Y1NTRkMDUxNiIsImFjY291bnRfaWQiOiI2NzJhODUwMzcxYmUwZWNmNTU0ZDA1MGMiLCJpYXQiOjE3MzgxNjkyMzYsImV4cCI6MTczODE3MjgzNn0.f8YIyb3DyuDEdd3fAISmHV4GwPH8U2IdyO-MIRJ9iTfUEg8OTXSOTsZAgIiPd4j544GGn6g0mqz36-6CJMKofg',
    '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/templates/65a864a93df1d9cacf436c5a/info"]
  cachePolicy:NSURLRequestUseProtocolCachePolicy
  timeoutInterval:10.0];
NSDictionary *headers = @{
  @"Authorization": @"eyJhbGciOiJIUzUxMiIsInR5cCI6IkpXVCJ9.eyJpZCI6IjY3MmE4NTAzNzFiZTBlY2Y1NTRkMDUxNiIsImFjY291bnRfaWQiOiI2NzJhODUwMzcxYmUwZWNmNTU0ZDA1MGMiLCJpYXQiOjE3MzgxNjkyMzYsImV4cCI6MTczODE3MjgzNn0.f8YIyb3DyuDEdd3fAISmHV4GwPH8U2IdyO-MIRJ9iTfUEg8OTXSOTsZAgIiPd4j544GGn6g0mqz36-6CJMKofg",
  @"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/templates/65a864a93df1d9cacf436c5a/info" in
  let headers = Header.init ()
    |> fun h -> Header.add h "Authorization" "eyJhbGciOiJIUzUxMiIsInR5cCI6IkpXVCJ9.eyJpZCI6IjY3MmE4NTAzNzFiZTBlY2Y1NTRkMDUxNiIsImFjY291bnRfaWQiOiI2NzJhODUwMzcxYmUwZWNmNTU0ZDA1MGMiLCJpYXQiOjE3MzgxNjkyMzYsImV4cCI6MTczODE3MjgzNn0.f8YIyb3DyuDEdd3fAISmHV4GwPH8U2IdyO-MIRJ9iTfUEg8OTXSOTsZAgIiPd4j544GGn6g0mqz36-6CJMKofg"
    |> 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/templates/65a864a93df1d9cacf436c5a/info',
  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.eyJpZCI6IjY3MmE4NTAzNzFiZTBlY2Y1NTRkMDUxNiIsImFjY291bnRfaWQiOiI2NzJhODUwMzcxYmUwZWNmNTU0ZDA1MGMiLCJpYXQiOjE3MzgxNjkyMzYsImV4cCI6MTczODE3MjgzNn0.f8YIyb3DyuDEdd3fAISmHV4GwPH8U2IdyO-MIRJ9iTfUEg8OTXSOTsZAgIiPd4j544GGn6g0mqz36-6CJMKofg',
    'Cookie: lang=en'
  ),
));

$response = curl_exec($curl);

curl_close($curl);
echo $response;

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

// Guzzle

<?php
$client = new Client();
$headers = [
  'Authorization' => 'eyJhbGciOiJIUzUxMiIsInR5cCI6IkpXVCJ9.eyJpZCI6IjY3MmE4NTAzNzFiZTBlY2Y1NTRkMDUxNiIsImFjY291bnRfaWQiOiI2NzJhODUwMzcxYmUwZWNmNTU0ZDA1MGMiLCJpYXQiOjE3MzgxNjkyMzYsImV4cCI6MTczODE3MjgzNn0.f8YIyb3DyuDEdd3fAISmHV4GwPH8U2IdyO-MIRJ9iTfUEg8OTXSOTsZAgIiPd4j544GGn6g0mqz36-6CJMKofg',
  'Cookie' => 'lang=en'
];
$request = new Request('GET', 'https://sandbox.ecartpay.com/api/templates/65a864a93df1d9cacf436c5a/info', $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/templates/65a864a93df1d9cacf436c5a/info');
$request->setMethod(HTTP_Request2::METHOD_GET);
$request->setConfig(array(
  'follow_redirects' => TRUE
));
$request->setHeader(array(
  'Authorization' => 'eyJhbGciOiJIUzUxMiIsInR5cCI6IkpXVCJ9.eyJpZCI6IjY3MmE4NTAzNzFiZTBlY2Y1NTRkMDUxNiIsImFjY291bnRfaWQiOiI2NzJhODUwMzcxYmUwZWNmNTU0ZDA1MGMiLCJpYXQiOjE3MzgxNjkyMzYsImV4cCI6MTczODE3MjgzNn0.f8YIyb3DyuDEdd3fAISmHV4GwPH8U2IdyO-MIRJ9iTfUEg8OTXSOTsZAgIiPd4j544GGn6g0mqz36-6CJMKofg',
  '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/templates/65a864a93df1d9cacf436c5a/info');
$request->setRequestMethod('GET');
$request->setOptions(array());
$request->setHeaders(array(
  'Authorization' => 'eyJhbGciOiJIUzUxMiIsInR5cCI6IkpXVCJ9.eyJpZCI6IjY3MmE4NTAzNzFiZTBlY2Y1NTRkMDUxNiIsImFjY291bnRfaWQiOiI2NzJhODUwMzcxYmUwZWNmNTU0ZDA1MGMiLCJpYXQiOjE3MzgxNjkyMzYsImV4cCI6MTczODE3MjgzNn0.f8YIyb3DyuDEdd3fAISmHV4GwPH8U2IdyO-MIRJ9iTfUEg8OTXSOTsZAgIiPd4j544GGn6g0mqz36-6CJMKofg',
  '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.eyJpZCI6IjY3MmE4NTAzNzFiZTBlY2Y1NTRkMDUxNiIsImFjY291bnRfaWQiOiI2NzJhODUwMzcxYmUwZWNmNTU0ZDA1MGMiLCJpYXQiOjE3MzgxNjkyMzYsImV4cCI6MTczODE3MjgzNn0.f8YIyb3DyuDEdd3fAISmHV4GwPH8U2IdyO-MIRJ9iTfUEg8OTXSOTsZAgIiPd4j544GGn6g0mqz36-6CJMKofg")
$headers.Add("Cookie", "lang=en")

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

import http.client

conn = http.client.HTTPSConnection("sandbox.ecartpay.com")
payload = ''
headers = {
  'Authorization': 'eyJhbGciOiJIUzUxMiIsInR5cCI6IkpXVCJ9.eyJpZCI6IjY3MmE4NTAzNzFiZTBlY2Y1NTRkMDUxNiIsImFjY291bnRfaWQiOiI2NzJhODUwMzcxYmUwZWNmNTU0ZDA1MGMiLCJpYXQiOjE3MzgxNjkyMzYsImV4cCI6MTczODE3MjgzNn0.f8YIyb3DyuDEdd3fAISmHV4GwPH8U2IdyO-MIRJ9iTfUEg8OTXSOTsZAgIiPd4j544GGn6g0mqz36-6CJMKofg',
  'Cookie': 'lang=en'
}
conn.request("GET", "/api/templates/65a864a93df1d9cacf436c5a/info", payload, headers)
res = conn.getresponse()
data = res.read()
print(data.decode("utf-8"))

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

# Requests

import requests

url = "https://sandbox.ecartpay.com/api/templates/65a864a93df1d9cacf436c5a/info"

payload = {}
headers = {
  'Authorization': 'eyJhbGciOiJIUzUxMiIsInR5cCI6IkpXVCJ9.eyJpZCI6IjY3MmE4NTAzNzFiZTBlY2Y1NTRkMDUxNiIsImFjY291bnRfaWQiOiI2NzJhODUwMzcxYmUwZWNmNTU0ZDA1MGMiLCJpYXQiOjE3MzgxNjkyMzYsImV4cCI6MTczODE3MjgzNn0.f8YIyb3DyuDEdd3fAISmHV4GwPH8U2IdyO-MIRJ9iTfUEg8OTXSOTsZAgIiPd4j544GGn6g0mqz36-6CJMKofg',
  'Cookie': 'lang=en'
}

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

print(response.text)
# httr

library(httr)

headers = c(
  'Authorization' = 'eyJhbGciOiJIUzUxMiIsInR5cCI6IkpXVCJ9.eyJpZCI6IjY3MmE4NTAzNzFiZTBlY2Y1NTRkMDUxNiIsImFjY291bnRfaWQiOiI2NzJhODUwMzcxYmUwZWNmNTU0ZDA1MGMiLCJpYXQiOjE3MzgxNjkyMzYsImV4cCI6MTczODE3MjgzNn0.f8YIyb3DyuDEdd3fAISmHV4GwPH8U2IdyO-MIRJ9iTfUEg8OTXSOTsZAgIiPd4j544GGn6g0mqz36-6CJMKofg',
  'Cookie' = 'lang=en'
)

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

cat(content(res, 'text'))

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

# RCurl

library(RCurl)
headers = c(
  "Authorization" = "eyJhbGciOiJIUzUxMiIsInR5cCI6IkpXVCJ9.eyJpZCI6IjY3MmE4NTAzNzFiZTBlY2Y1NTRkMDUxNiIsImFjY291bnRfaWQiOiI2NzJhODUwMzcxYmUwZWNmNTU0ZDA1MGMiLCJpYXQiOjE3MzgxNjkyMzYsImV4cCI6MTczODE3MjgzNn0.f8YIyb3DyuDEdd3fAISmHV4GwPH8U2IdyO-MIRJ9iTfUEg8OTXSOTsZAgIiPd4j544GGn6g0mqz36-6CJMKofg",
  "Cookie" = "lang=en"
)
res <- getURL("https://sandbox.ecartpay.com/api/templates/65a864a93df1d9cacf436c5a/info", .opts=list(httpheader = headers, followlocation = TRUE))
cat(res)
require "uri"
require "net/http"

url = URI("https://sandbox.ecartpay.com/api/templates/65a864a93df1d9cacf436c5a/info")

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

request = Net::HTTP::Get.new(url)
request["Authorization"] = "eyJhbGciOiJIUzUxMiIsInR5cCI6IkpXVCJ9.eyJpZCI6IjY3MmE4NTAzNzFiZTBlY2Y1NTRkMDUxNiIsImFjY291bnRfaWQiOiI2NzJhODUwMzcxYmUwZWNmNTU0ZDA1MGMiLCJpYXQiOjE3MzgxNjkyMzYsImV4cCI6MTczODE3MjgzNn0.f8YIyb3DyuDEdd3fAISmHV4GwPH8U2IdyO-MIRJ9iTfUEg8OTXSOTsZAgIiPd4j544GGn6g0mqz36-6CJMKofg"
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.eyJpZCI6IjY3MmE4NTAzNzFiZTBlY2Y1NTRkMDUxNiIsImFjY291bnRfaWQiOiI2NzJhODUwMzcxYmUwZWNmNTU0ZDA1MGMiLCJpYXQiOjE3MzgxNjkyMzYsImV4cCI6MTczODE3MjgzNn0.f8YIyb3DyuDEdd3fAISmHV4GwPH8U2IdyO-MIRJ9iTfUEg8OTXSOTsZAgIiPd4j544GGn6g0mqz36-6CJMKofg".parse()?);
    headers.insert("Cookie", "lang=en".parse()?);

    let request = client.request(reqwest::Method::GET, "https://sandbox.ecartpay.com/api/templates/65a864a93df1d9cacf436c5a/info")
        .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/templates/65a864a93df1d9cacf436c5a/info' \
 Authorization:'eyJhbGciOiJIUzUxMiIsInR5cCI6IkpXVCJ9.eyJpZCI6IjY3MmE4NTAzNzFiZTBlY2Y1NTRkMDUxNiIsImFjY291bnRfaWQiOiI2NzJhODUwMzcxYmUwZWNmNTU0ZDA1MGMiLCJpYXQiOjE3MzgxNjkyMzYsImV4cCI6MTczODE3MjgzNn0.f8YIyb3DyuDEdd3fAISmHV4GwPH8U2IdyO-MIRJ9iTfUEg8OTXSOTsZAgIiPd4j544GGn6g0mqz36-6CJMKofg' \
 Cookie:'lang=en'

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

# wget

wget --no-check-certificate --quiet \
  --method GET \
  --timeout=0 \
  --header 'Authorization: eyJhbGciOiJIUzUxMiIsInR5cCI6IkpXVCJ9.eyJpZCI6IjY3MmE4NTAzNzFiZTBlY2Y1NTRkMDUxNiIsImFjY291bnRfaWQiOiI2NzJhODUwMzcxYmUwZWNmNTU0ZDA1MGMiLCJpYXQiOjE3MzgxNjkyMzYsImV4cCI6MTczODE3MjgzNn0.f8YIyb3DyuDEdd3fAISmHV4GwPH8U2IdyO-MIRJ9iTfUEg8OTXSOTsZAgIiPd4j544GGn6g0mqz36-6CJMKofg' \
  --header 'Cookie: lang=en' \
   'https://sandbox.ecartpay.com/api/templates/65a864a93df1d9cacf436c5a/info'
var request = URLRequest(url: URL(string: "https://sandbox.ecartpay.com/api/templates/65a864a93df1d9cacf436c5a/info")!,timeoutInterval: Double.infinity)
request.addValue("eyJhbGciOiJIUzUxMiIsInR5cCI6IkpXVCJ9.eyJpZCI6IjY3MmE4NTAzNzFiZTBlY2Y1NTRkMDUxNiIsImFjY291bnRfaWQiOiI2NzJhODUwMzcxYmUwZWNmNTU0ZDA1MGMiLCJpYXQiOjE3MzgxNjkyMzYsImV4cCI6MTczODE3MjgzNn0.f8YIyb3DyuDEdd3fAISmHV4GwPH8U2IdyO-MIRJ9iTfUEg8OTXSOTsZAgIiPd4j544GGn6g0mqz36-6CJMKofg", 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

{
    "id": "6189ca8e4d497c0018f22f36",
    "end_date": null,
    "name": "Recarga 100 usd",
    "currency": "USD",
    "items": [
        {
            "discount": 0,
            "tax": 0,
            "name": "Recarga",
            "price": 100,
            "quantity": 1,
            "total": 100
        }
    ],
    "start_date": "2021-11-09T01:10:22.000Z",
    "quantity_uses": -1,
    "shipping_items": [],
    "account_id": "5d2d436e3199ae000449065b",
    "authorization_id": "60f603b246df510b2c18b07a",
    "number": "TE53303647",
    "discounts": [],
    "totals": {
        "subtotal": 100,
        "discount": 0,
        "tax": 0,
        "shipping": 0,
        "total": 100
    },
    "created_at": "2021-11-09T01:10:38.256Z",
    "updated_at": "2021-11-09T01:10:38.256Z"
}
Image 2. Retrieving a Single Payment Link

Image 2. Retrieving a Single Payment Link

Use Cases

  • General Menu: Use the "Get All Payment Links" endpoint to generate a list of all available templates for easy reference or selection.
  • Search Tool: Use the "Get Specific Payment Link" endpoint to quickly locate and retrieve detailed information about a single link when needed.

These options make it simple to manage and utilize payment links in an organized and efficient manner, tailored to your business needs.