Payment Links

Ecart Pay allows users to create and share secure payment links that serve as an additional payment method. These links offer flexibility and are easily shared through various communication channels.

⚠️

WARNING

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

What You'll Learn:

  1. Understand what are Payment Links and how their features makes them useful.
  2. A brief summary of Payment Links Key Features.
  3. Practical applications for Payment Links in different instances.
  4. How to locate your Payment Link.
  5. Detailed information to help you create a Payment Link request, including: Endpoints, Method, Headers and the Body.
  6. Various examples for Request, Response and Request Body using different technologies and programming languages.

What are Payment Links?

Payment links are an effective way to facilitate transactions without requiring the customer to visit a physical location or even a dedicated online store. They are versatile, secure, and can be shared through any communication channel, such as email, SMS, social media, or instant messaging.

📘

NOTE

When a payment link is used, an order is created and redirects the customer to the checkout window. However, the exact information displayed varies depending on the template used by the merchant.

Why are Payment Links useful?

  1. Ease of Sharing and Accessibility: Payment links can be sent directly to customers, eliminating the need for complex checkout processes.
  2. Customizable Options:
    • Links with pre-set amounts.
    • Expiration dates for time-sensitive transactions.
    • Limited usage links for specific campaigns.
  3. Flexibility for the Customer: Payment links are ideal for remote payments, service-based businesses, or situations where physical POS systems are unavailable.
  4. Efficiency for Businesses: Businesses save time by reducing the need for manual invoicing and follow-ups.

Key Features of Payment Links

  • Expiration Dates: Configure a payment link to expire after a set time.
  • Limited Usage: Define how many times a link can be used.
  • Cash Payments (in_Mexico_): If the customer is verified, they can use links for cash payments. For non-verified customers, there are daily usage limits.
Image 1. Sharing a Link

Image 1. Sharing a Link

Practical Applications

  • E-commerce: Share links for single product purchases.
  • Service Providers: Request payment for completed services.
  • Subscription Models: Use reusable links for recurring payments.

By leveraging payment links and templates, Ecart Pay provides a simple, secure, and efficient way to handle payments, enhancing both the business's and the customer's experience.

🤝

BENEFITS

Unlike Orders, our Payment Links do not require a Customer or a Customer Card to be registered first. This makes the payment process faster and convenient.


Locate your Payment Link

Log into your Ecart Pay account to find your Payment Link:

  1. Upon logging in, you'll see your Home page.

  2. On the left side panel, select the drop-down button for Payments.

  3. Click on Payment Links.

  4. You can find your payment link here.


Create Payment Link

Ecart Pay allows businesses to create payment link templates, which can be customized and reused for different customers and transactions.

Endpoints

  • POST https://ecartpay.com/api/templates
  • POST https://sandbox.ecartpay.com/api/templates (Sandbox only)

Headers

  • Authorization: {token}
  • Content-Type: application/json

Request Payload

The payload for creating a payment link may include:

Body

  • shipping_address: An array with the following details:
    • first_name
    • last_name
    • address1
    • address2
    • country
      • code
      • name
    • state
      • code
    • city
    • postal_code
    • phone
    • reference
  • items
    • name
    • quantity
    • price
  • quantity_uses
  • first_name
  • start_date
  • currency
  • shipping_items
    • name
    • amount
    • carrier

Examples

Request Body

{
    "shipping_address": {
        "first_name": "Stefany",
        "last_name": "Porras",
        "address1": "Belisario Dominguez",
        "address2": "Semillero",
        "country": {
            "code": "US",
            "name": "United States"
        },
        "state": {
            "code": "FL"
        },
        "city": "Miami",
        "postal_code": "33101",
        "phone": "4125684412",
        "reference": "reference"
    },
    "items": [
        {
            "name": "Gold Neck BZ3909",
            "quantity": 1,
            "price": 2
        }
    ], 
    "quantity_uses": -1,
    "first_name": "Stefany",
    "start_date": "2021-06-18 12:00:00",
    "currency": "USD",
    "shipping_items":[
        {
            "name": "Express Shipping",
            "amount": 1,
            "carrier": "OWN"
        }
    ]
}

Request

curl --location 'https://sandbox.ecartpay.com/api/templates' \
--header 'Authorization: eyJhbGciOiJIUzUxMiIsInR5cCI6IkpXVCJ9.eyJpZCI6IjY3MmE4NTAzNzFiZTBlY2Y1NTRkMDUxNiIsImFjY291bnRfaWQiOiI2NzJhODUwMzcxYmUwZWNmNTU0ZDA1MGMiLCJpYXQiOjE3MzgwODY3MzEsImV4cCI6MTczODA5MDMzMX0.sRQIqx5XcoTOsVPTkuBvrXE8bnHlsrnnEVcRkWwW6CaFDpd4-_VGn4DoNJ9DeTDudcI8MqJb7orXB7aWGq0rjQ' \
--header 'Content-Type: application/json' \
--header 'Cookie: lang=en' \
--data '{
    "shipping_address": {
        "first_name": "Stefany",
        "last_name": "Porras",
        "address1": "Belisario Dominguez",
        "address2": "Semillero",
        "country": {
            "code": "US",
            "name": "United States"
        },
        "state": {
            "code": "FL"
        },
        "city": "Miami",
        "postal_code": "33101",
        "phone": "4125684412",
        "reference": "reference"
    },
    "items": [
        {
            "name": "Gold Neck BZ3909",
            "quantity": 1,
            "price": 2
        }
    ], 
    "quantity_uses": -1,
    "first_name": "Stefany",
    "start_date": "2021-06-18 12:00:00",
    "currency": "USD",
    "shipping_items":[
        {
            "name": "Express Shipping",
            "amount": 1,
            "carrier": "OWN"
        }
    ]
}'
package main

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

func main() {

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

  payload := strings.NewReader(`{`+"
"+`
    "shipping_address": {`+"
"+`
        "first_name": "Stefany",`+"
"+`
        "last_name": "Porras",`+"
"+`
        "address1": "Belisario Dominguez",`+"
"+`
        "address2": "Semillero",`+"
"+`
        "country": {`+"
"+`
            "code": "US",`+"
"+`
            "name": "United States"`+"
"+`
        },`+"
"+`
        "state": {`+"
"+`
            "code": "FL"`+"
"+`
        },`+"
"+`
        "city": "Miami",`+"
"+`
        "postal_code": "33101",`+"
"+`
        "phone": "4125684412",`+"
"+`
        "reference": "reference"`+"
"+`
    },`+"
"+`
    "items": [`+"
"+`
        {`+"
"+`
            "name": "Gold Neck BZ3909",`+"
"+`
            "quantity": 1,`+"
"+`
            "price": 2`+"
"+`
        }`+"
"+`
    ], `+"
"+`
    "quantity_uses": -1,`+"
"+`
    "first_name": "Stefany",`+"
"+`
    "start_date": "2021-06-18 12:00:00",`+"
"+`
    "currency": "USD",`+"
"+`
    "shipping_items":[`+"
"+`
        {`+"
"+`
            "name": "Express Shipping",`+"
"+`
            "amount": 1,`+"
"+`
            "carrier": "OWN"`+"
"+`
        }`+"
"+`
    ]`+"
"+`
}`)

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

  if err != nil {
    fmt.Println(err)
    return
  }
  req.Header.Add("Authorization", "eyJhbGciOiJIUzUxMiIsInR5cCI6IkpXVCJ9.eyJpZCI6IjY3MmE4NTAzNzFiZTBlY2Y1NTRkMDUxNiIsImFjY291bnRfaWQiOiI2NzJhODUwMzcxYmUwZWNmNTU0ZDA1MGMiLCJpYXQiOjE3MzgwODY3MzEsImV4cCI6MTczODA5MDMzMX0.sRQIqx5XcoTOsVPTkuBvrXE8bnHlsrnnEVcRkWwW6CaFDpd4-_VGn4DoNJ9DeTDudcI8MqJb7orXB7aWGq0rjQ")
  req.Header.Add("Content-Type", "application/json")
  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))
}
POST /api/templates HTTP/1.1
Host: sandbox.ecartpay.com
Authorization: eyJhbGciOiJIUzUxMiIsInR5cCI6IkpXVCJ9.eyJpZCI6IjY3MmE4NTAzNzFiZTBlY2Y1NTRkMDUxNiIsImFjY291bnRfaWQiOiI2NzJhODUwMzcxYmUwZWNmNTU0ZDA1MGMiLCJpYXQiOjE3MzgwODY3MzEsImV4cCI6MTczODA5MDMzMX0.sRQIqx5XcoTOsVPTkuBvrXE8bnHlsrnnEVcRkWwW6CaFDpd4-_VGn4DoNJ9DeTDudcI8MqJb7orXB7aWGq0rjQ
Content-Type: application/json
Cookie: lang=en
Content-Length: 876

{
    "shipping_address": {
        "first_name": "Stefany",
        "last_name": "Porras",
        "address1": "Belisario Dominguez",
        "address2": "Semillero",
        "country": {
            "code": "US",
            "name": "United States"
        },
        "state": {
            "code": "FL"
        },
        "city": "Miami",
        "postal_code": "33101",
        "phone": "4125684412",
        "reference": "reference"
    },
    "items": [
        {
            "name": "Gold Neck BZ3909",
            "quantity": 1,
            "price": 2
        }
    ], 
    "quantity_uses": -1,
    "first_name": "Stefany",
    "start_date": "2021-06-18 12:00:00",
    "currency": "USD",
    "shipping_items":[
        {
            "name": "Express Shipping",
            "amount": 1,
            "carrier": "OWN"
        }
    ]
}
// OkHttp

OkHttpClient client = new OkHttpClient().newBuilder()
  .build();
MediaType mediaType = MediaType.parse("application/json");
RequestBody body = RequestBody.create(mediaType, "{\r\n    \"shipping_address\": {\r\n        \"first_name\": \"Stefany\",\r\n        \"last_name\": \"Porras\",\r\n        \"address1\": \"Belisario Dominguez\",\r\n        \"address2\": \"Semillero\",\r\n        \"country\": {\r\n            \"code\": \"US\",\r\n            \"name\": \"United States\"\r\n        },\r\n        \"state\": {\r\n            \"code\": \"FL\"\r\n        },\r\n        \"city\": \"Miami\",\r\n        \"postal_code\": \"33101\",\r\n        \"phone\": \"4125684412\",\r\n        \"reference\": \"reference\"\r\n    },\r\n    \"items\": [\r\n        {\r\n            \"name\": \"Gold Neck BZ3909\",\r\n            \"quantity\": 1,\r\n            \"price\": 2\r\n        }\r\n    ], \r\n    \"quantity_uses\": -1,\r\n    \"first_name\": \"Stefany\",\r\n    \"start_date\": \"2021-06-18 12:00:00\",\r\n    \"currency\": \"USD\",\r\n    \"shipping_items\":[\r\n        {\r\n            \"name\": \"Express Shipping\",\r\n            \"amount\": 1,\r\n            \"carrier\": \"OWN\"\r\n        }\r\n    ]\r\n}");
Request request = new Request.Builder()
  .url("https://sandbox.ecartpay.com/api/templates")
  .method("POST", body)
  .addHeader("Authorization", "eyJhbGciOiJIUzUxMiIsInR5cCI6IkpXVCJ9.eyJpZCI6IjY3MmE4NTAzNzFiZTBlY2Y1NTRkMDUxNiIsImFjY291bnRfaWQiOiI2NzJhODUwMzcxYmUwZWNmNTU0ZDA1MGMiLCJpYXQiOjE3MzgwODY3MzEsImV4cCI6MTczODA5MDMzMX0.sRQIqx5XcoTOsVPTkuBvrXE8bnHlsrnnEVcRkWwW6CaFDpd4-_VGn4DoNJ9DeTDudcI8MqJb7orXB7aWGq0rjQ")
  .addHeader("Content-Type", "application/json")
  .addHeader("Cookie", "lang=en")
  .build();
Response response = client.newCall(request).execute();

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

// Unirest

Unirest.setTimeouts(0, 0);
HttpResponse<String> response = Unirest.post("https://sandbox.ecartpay.com/api/templates")
  .header("Authorization", "eyJhbGciOiJIUzUxMiIsInR5cCI6IkpXVCJ9.eyJpZCI6IjY3MmE4NTAzNzFiZTBlY2Y1NTRkMDUxNiIsImFjY291bnRfaWQiOiI2NzJhODUwMzcxYmUwZWNmNTU0ZDA1MGMiLCJpYXQiOjE3MzgwODY3MzEsImV4cCI6MTczODA5MDMzMX0.sRQIqx5XcoTOsVPTkuBvrXE8bnHlsrnnEVcRkWwW6CaFDpd4-_VGn4DoNJ9DeTDudcI8MqJb7orXB7aWGq0rjQ")
  .header("Content-Type", "application/json")
  .header("Cookie", "lang=en")
  .body("{\r\n    \"shipping_address\": {\r\n        \"first_name\": \"Stefany\",\r\n        \"last_name\": \"Porras\",\r\n        \"address1\": \"Belisario Dominguez\",\r\n        \"address2\": \"Semillero\",\r\n        \"country\": {\r\n            \"code\": \"US\",\r\n            \"name\": \"United States\"\r\n        },\r\n        \"state\": {\r\n            \"code\": \"FL\"\r\n        },\r\n        \"city\": \"Miami\",\r\n        \"postal_code\": \"33101\",\r\n        \"phone\": \"4125684412\",\r\n        \"reference\": \"reference\"\r\n    },\r\n    \"items\": [\r\n        {\r\n            \"name\": \"Gold Neck BZ3909\",\r\n            \"quantity\": 1,\r\n            \"price\": 2\r\n        }\r\n    ], \r\n    \"quantity_uses\": -1,\r\n    \"first_name\": \"Stefany\",\r\n    \"start_date\": \"2021-06-18 12:00:00\",\r\n    \"currency\": \"USD\",\r\n    \"shipping_items\":[\r\n        {\r\n            \"name\": \"Express Shipping\",\r\n            \"amount\": 1,\r\n            \"carrier\": \"OWN\"\r\n        }\r\n    ]\r\n}")
  .asString();
// Fetch

const myHeaders = new Headers();
myHeaders.append("Authorization", "eyJhbGciOiJIUzUxMiIsInR5cCI6IkpXVCJ9.eyJpZCI6IjY3MmE4NTAzNzFiZTBlY2Y1NTRkMDUxNiIsImFjY291bnRfaWQiOiI2NzJhODUwMzcxYmUwZWNmNTU0ZDA1MGMiLCJpYXQiOjE3MzgwODY3MzEsImV4cCI6MTczODA5MDMzMX0.sRQIqx5XcoTOsVPTkuBvrXE8bnHlsrnnEVcRkWwW6CaFDpd4-_VGn4DoNJ9DeTDudcI8MqJb7orXB7aWGq0rjQ");
myHeaders.append("Content-Type", "application/json");
myHeaders.append("Cookie", "lang=en");

const raw = JSON.stringify({
  "shipping_address": {
    "first_name": "Stefany",
    "last_name": "Porras",
    "address1": "Belisario Dominguez",
    "address2": "Semillero",
    "country": {
      "code": "US",
      "name": "United States"
    },
    "state": {
      "code": "FL"
    },
    "city": "Miami",
    "postal_code": "33101",
    "phone": "4125684412",
    "reference": "reference"
  },
  "items": [
    {
      "name": "Gold Neck BZ3909",
      "quantity": 1,
      "price": 2
    }
  ],
  "quantity_uses": -1,
  "first_name": "Stefany",
  "start_date": "2021-06-18 12:00:00",
  "currency": "USD",
  "shipping_items": [
    {
      "name": "Express Shipping",
      "amount": 1,
      "carrier": "OWN"
    }
  ]
});

const requestOptions = {
  method: "POST",
  headers: myHeaders,
  body: raw,
  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": "POST",
  "timeout": 0,
  "headers": {
    "Authorization": "eyJhbGciOiJIUzUxMiIsInR5cCI6IkpXVCJ9.eyJpZCI6IjY3MmE4NTAzNzFiZTBlY2Y1NTRkMDUxNiIsImFjY291bnRfaWQiOiI2NzJhODUwMzcxYmUwZWNmNTU0ZDA1MGMiLCJpYXQiOjE3MzgwODY3MzEsImV4cCI6MTczODA5MDMzMX0.sRQIqx5XcoTOsVPTkuBvrXE8bnHlsrnnEVcRkWwW6CaFDpd4-_VGn4DoNJ9DeTDudcI8MqJb7orXB7aWGq0rjQ",
    "Content-Type": "application/json",
    "Cookie": "lang=en"
  },
  "data": JSON.stringify({
    "shipping_address": {
      "first_name": "Stefany",
      "last_name": "Porras",
      "address1": "Belisario Dominguez",
      "address2": "Semillero",
      "country": {
        "code": "US",
        "name": "United States"
      },
      "state": {
        "code": "FL"
      },
      "city": "Miami",
      "postal_code": "33101",
      "phone": "4125684412",
      "reference": "reference"
    },
    "items": [
      {
        "name": "Gold Neck BZ3909",
        "quantity": 1,
        "price": 2
      }
    ],
    "quantity_uses": -1,
    "first_name": "Stefany",
    "start_date": "2021-06-18 12:00:00",
    "currency": "USD",
    "shipping_items": [
      {
        "name": "Express Shipping",
        "amount": 1,
        "carrier": "OWN"
      }
    ]
  }),
};

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

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

// XHR

// WARNING: For POST requests, body is set to null by browsers.
var data = JSON.stringify({
  "shipping_address": {
    "first_name": "Stefany",
    "last_name": "Porras",
    "address1": "Belisario Dominguez",
    "address2": "Semillero",
    "country": {
      "code": "US",
      "name": "United States"
    },
    "state": {
      "code": "FL"
    },
    "city": "Miami",
    "postal_code": "33101",
    "phone": "4125684412",
    "reference": "reference"
  },
  "items": [
    {
      "name": "Gold Neck BZ3909",
      "quantity": 1,
      "price": 2
    }
  ],
  "quantity_uses": -1,
  "first_name": "Stefany",
  "start_date": "2021-06-18 12:00:00",
  "currency": "USD",
  "shipping_items": [
    {
      "name": "Express Shipping",
      "amount": 1,
      "carrier": "OWN"
    }
  ]
});

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

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

xhr.open("POST", "https://sandbox.ecartpay.com/api/templates");
xhr.setRequestHeader("Authorization", "eyJhbGciOiJIUzUxMiIsInR5cCI6IkpXVCJ9.eyJpZCI6IjY3MmE4NTAzNzFiZTBlY2Y1NTRkMDUxNiIsImFjY291bnRfaWQiOiI2NzJhODUwMzcxYmUwZWNmNTU0ZDA1MGMiLCJpYXQiOjE3MzgwODY3MzEsImV4cCI6MTczODA5MDMzMX0.sRQIqx5XcoTOsVPTkuBvrXE8bnHlsrnnEVcRkWwW6CaFDpd4-_VGn4DoNJ9DeTDudcI8MqJb7orXB7aWGq0rjQ");
xhr.setRequestHeader("Content-Type", "application/json");
// WARNING: Cookies will be stripped away by the browser before sending the request.
xhr.setRequestHeader("Cookie", "lang=en");

xhr.send(data);
CURL *curl;
CURLcode res;
curl = curl_easy_init();
if(curl) {
  curl_easy_setopt(curl, CURLOPT_CUSTOMREQUEST, "POST");
  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.eyJpZCI6IjY3MmE4NTAzNzFiZTBlY2Y1NTRkMDUxNiIsImFjY291bnRfaWQiOiI2NzJhODUwMzcxYmUwZWNmNTU0ZDA1MGMiLCJpYXQiOjE3MzgwODY3MzEsImV4cCI6MTczODA5MDMzMX0.sRQIqx5XcoTOsVPTkuBvrXE8bnHlsrnnEVcRkWwW6CaFDpd4-_VGn4DoNJ9DeTDudcI8MqJb7orXB7aWGq0rjQ");
  headers = curl_slist_append(headers, "Content-Type: application/json");
  headers = curl_slist_append(headers, "Cookie: lang=en");
  curl_easy_setopt(curl, CURLOPT_HTTPHEADER, headers);
  const char *data = "{\r\n    \"shipping_address\": {\r\n        \"first_name\": \"Stefany\",\r\n        \"last_name\": \"Porras\",\r\n        \"address1\": \"Belisario Dominguez\",\r\n        \"address2\": \"Semillero\",\r\n        \"country\": {\r\n            \"code\": \"US\",\r\n            \"name\": \"United States\"\r\n        },\r\n        \"state\": {\r\n            \"code\": \"FL\"\r\n        },\r\n        \"city\": \"Miami\",\r\n        \"postal_code\": \"33101\",\r\n        \"phone\": \"4125684412\",\r\n        \"reference\": \"reference\"\r\n    },\r\n    \"items\": [\r\n        {\r\n            \"name\": \"Gold Neck BZ3909\",\r\n            \"quantity\": 1,\r\n            \"price\": 2\r\n        }\r\n    ], \r\n    \"quantity_uses\": -1,\r\n    \"first_name\": \"Stefany\",\r\n    \"start_date\": \"2021-06-18 12:00:00\",\r\n    \"currency\": \"USD\",\r\n    \"shipping_items\":[\r\n        {\r\n            \"name\": \"Express Shipping\",\r\n            \"amount\": 1,\r\n            \"carrier\": \"OWN\"\r\n        }\r\n    ]\r\n}";
  curl_easy_setopt(curl, CURLOPT_POSTFIELDS, data);
  res = curl_easy_perform(curl);
  curl_slist_free_all(headers);
}
curl_easy_cleanup(curl);
// Axios

const axios = require('axios');
let data = JSON.stringify({
  "shipping_address": {
    "first_name": "Stefany",
    "last_name": "Porras",
    "address1": "Belisario Dominguez",
    "address2": "Semillero",
    "country": {
      "code": "US",
      "name": "United States"
    },
    "state": {
      "code": "FL"
    },
    "city": "Miami",
    "postal_code": "33101",
    "phone": "4125684412",
    "reference": "reference"
  },
  "items": [
    {
      "name": "Gold Neck BZ3909",
      "quantity": 1,
      "price": 2
    }
  ],
  "quantity_uses": -1,
  "first_name": "Stefany",
  "start_date": "2021-06-18 12:00:00",
  "currency": "USD",
  "shipping_items": [
    {
      "name": "Express Shipping",
      "amount": 1,
      "carrier": "OWN"
    }
  ]
});

let config = {
  method: 'post',
  maxBodyLength: Infinity,
  url: 'https://sandbox.ecartpay.com/api/templates',
  headers: { 
    'Authorization': 'eyJhbGciOiJIUzUxMiIsInR5cCI6IkpXVCJ9.eyJpZCI6IjY3MmE4NTAzNzFiZTBlY2Y1NTRkMDUxNiIsImFjY291bnRfaWQiOiI2NzJhODUwMzcxYmUwZWNmNTU0ZDA1MGMiLCJpYXQiOjE3MzgwODY3MzEsImV4cCI6MTczODA5MDMzMX0.sRQIqx5XcoTOsVPTkuBvrXE8bnHlsrnnEVcRkWwW6CaFDpd4-_VGn4DoNJ9DeTDudcI8MqJb7orXB7aWGq0rjQ', 
    'Content-Type': 'application/json', 
    'Cookie': 'lang=en'
  },
  data : data
};

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': 'POST',
  'hostname': 'sandbox.ecartpay.com',
  'path': '/api/templates',
  'headers': {
    'Authorization': 'eyJhbGciOiJIUzUxMiIsInR5cCI6IkpXVCJ9.eyJpZCI6IjY3MmE4NTAzNzFiZTBlY2Y1NTRkMDUxNiIsImFjY291bnRfaWQiOiI2NzJhODUwMzcxYmUwZWNmNTU0ZDA1MGMiLCJpYXQiOjE3MzgwODY3MzEsImV4cCI6MTczODA5MDMzMX0.sRQIqx5XcoTOsVPTkuBvrXE8bnHlsrnnEVcRkWwW6CaFDpd4-_VGn4DoNJ9DeTDudcI8MqJb7orXB7aWGq0rjQ',
    'Content-Type': 'application/json',
    '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);
  });
});

var postData = JSON.stringify({
  "shipping_address": {
    "first_name": "Stefany",
    "last_name": "Porras",
    "address1": "Belisario Dominguez",
    "address2": "Semillero",
    "country": {
      "code": "US",
      "name": "United States"
    },
    "state": {
      "code": "FL"
    },
    "city": "Miami",
    "postal_code": "33101",
    "phone": "4125684412",
    "reference": "reference"
  },
  "items": [
    {
      "name": "Gold Neck BZ3909",
      "quantity": 1,
      "price": 2
    }
  ],
  "quantity_uses": -1,
  "first_name": "Stefany",
  "start_date": "2021-06-18 12:00:00",
  "currency": "USD",
  "shipping_items": [
    {
      "name": "Express Shipping",
      "amount": 1,
      "carrier": "OWN"
    }
  ]
});

req.write(postData);

req.end();

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

// Request

var request = require('request');
var options = {
  'method': 'POST',
  'url': 'https://sandbox.ecartpay.com/api/templates',
  'headers': {
    'Authorization': 'eyJhbGciOiJIUzUxMiIsInR5cCI6IkpXVCJ9.eyJpZCI6IjY3MmE4NTAzNzFiZTBlY2Y1NTRkMDUxNiIsImFjY291bnRfaWQiOiI2NzJhODUwMzcxYmUwZWNmNTU0ZDA1MGMiLCJpYXQiOjE3MzgwODY3MzEsImV4cCI6MTczODA5MDMzMX0.sRQIqx5XcoTOsVPTkuBvrXE8bnHlsrnnEVcRkWwW6CaFDpd4-_VGn4DoNJ9DeTDudcI8MqJb7orXB7aWGq0rjQ',
    'Content-Type': 'application/json',
    'Cookie': 'lang=en'
  },
  body: JSON.stringify({
    "shipping_address": {
      "first_name": "Stefany",
      "last_name": "Porras",
      "address1": "Belisario Dominguez",
      "address2": "Semillero",
      "country": {
        "code": "US",
        "name": "United States"
      },
      "state": {
        "code": "FL"
      },
      "city": "Miami",
      "postal_code": "33101",
      "phone": "4125684412",
      "reference": "reference"
    },
    "items": [
      {
        "name": "Gold Neck BZ3909",
        "quantity": 1,
        "price": 2
      }
    ],
    "quantity_uses": -1,
    "first_name": "Stefany",
    "start_date": "2021-06-18 12:00:00",
    "currency": "USD",
    "shipping_items": [
      {
        "name": "Express Shipping",
        "amount": 1,
        "carrier": "OWN"
      }
    ]
  })

};
request(options, function (error, response) {
  if (error) throw new Error(error);
  console.log(response.body);
});

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

// Unirest

var unirest = require('unirest');
var req = unirest('POST', 'https://sandbox.ecartpay.com/api/templates')
  .headers({
    'Authorization': 'eyJhbGciOiJIUzUxMiIsInR5cCI6IkpXVCJ9.eyJpZCI6IjY3MmE4NTAzNzFiZTBlY2Y1NTRkMDUxNiIsImFjY291bnRfaWQiOiI2NzJhODUwMzcxYmUwZWNmNTU0ZDA1MGMiLCJpYXQiOjE3MzgwODY3MzEsImV4cCI6MTczODA5MDMzMX0.sRQIqx5XcoTOsVPTkuBvrXE8bnHlsrnnEVcRkWwW6CaFDpd4-_VGn4DoNJ9DeTDudcI8MqJb7orXB7aWGq0rjQ',
    'Content-Type': 'application/json',
    'Cookie': 'lang=en'
  })
  .send(JSON.stringify({
    "shipping_address": {
      "first_name": "Stefany",
      "last_name": "Porras",
      "address1": "Belisario Dominguez",
      "address2": "Semillero",
      "country": {
        "code": "US",
        "name": "United States"
      },
      "state": {
        "code": "FL"
      },
      "city": "Miami",
      "postal_code": "33101",
      "phone": "4125684412",
      "reference": "reference"
    },
    "items": [
      {
        "name": "Gold Neck BZ3909",
        "quantity": 1,
        "price": 2
      }
    ],
    "quantity_uses": -1,
    "first_name": "Stefany",
    "start_date": "2021-06-18 12:00:00",
    "currency": "USD",
    "shipping_items": [
      {
        "name": "Express Shipping",
        "amount": 1,
        "carrier": "OWN"
      }
    ]
  }))
  .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.eyJpZCI6IjY3MmE4NTAzNzFiZTBlY2Y1NTRkMDUxNiIsImFjY291bnRfaWQiOiI2NzJhODUwMzcxYmUwZWNmNTU0ZDA1MGMiLCJpYXQiOjE3MzgwODY3MzEsImV4cCI6MTczODA5MDMzMX0.sRQIqx5XcoTOsVPTkuBvrXE8bnHlsrnnEVcRkWwW6CaFDpd4-_VGn4DoNJ9DeTDudcI8MqJb7orXB7aWGq0rjQ",
  @"Content-Type": @"application/json",
  @"Cookie": @"lang=en"
};

[request setAllHTTPHeaderFields:headers];
NSData *postData = [[NSData alloc] initWithData:[@"{\r\n    \"shipping_address\": {\r\n        \"first_name\": \"Stefany\",\r\n        \"last_name\": \"Porras\",\r\n        \"address1\": \"Belisario Dominguez\",\r\n        \"address2\": \"Semillero\",\r\n        \"country\": {\r\n            \"code\": \"US\",\r\n            \"name\": \"United States\"\r\n        },\r\n        \"state\": {\r\n            \"code\": \"FL\"\r\n        },\r\n        \"city\": \"Miami\",\r\n        \"postal_code\": \"33101\",\r\n        \"phone\": \"4125684412\",\r\n        \"reference\": \"reference\"\r\n    },\r\n    \"items\": [\r\n        {\r\n            \"name\": \"Gold Neck BZ3909\",\r\n            \"quantity\": 1,\r\n            \"price\": 2\r\n        }\r\n    ], \r\n    \"quantity_uses\": -1,\r\n    \"first_name\": \"Stefany\",\r\n    \"start_date\": \"2021-06-18 12:00:00\",\r\n    \"currency\": \"USD\",\r\n    \"shipping_items\":[\r\n        {\r\n            \"name\": \"Express Shipping\",\r\n            \"amount\": 1,\r\n            \"carrier\": \"OWN\"\r\n        }\r\n    ]\r\n}" dataUsingEncoding:NSUTF8StringEncoding]];
[request setHTTPBody:postData];

[request setHTTPMethod:@"POST"];

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 postData = ref "{\r\n    \"shipping_address\": {\r\n        \"first_name\": \"Stefany\",\r\n        \"last_name\": \"Porras\",\r\n        \"address1\": \"Belisario Dominguez\",\r\n        \"address2\": \"Semillero\",\r\n        \"country\": {\r\n            \"code\": \"US\",\r\n            \"name\": \"United States\"\r\n        },\r\n        \"state\": {\r\n            \"code\": \"FL\"\r\n        },\r\n        \"city\": \"Miami\",\r\n        \"postal_code\": \"33101\",\r\n        \"phone\": \"4125684412\",\r\n        \"reference\": \"reference\"\r\n    },\r\n    \"items\": [\r\n        {\r\n            \"name\": \"Gold Neck BZ3909\",\r\n            \"quantity\": 1,\r\n            \"price\": 2\r\n        }\r\n    ], \r\n    \"quantity_uses\": -1,\r\n    \"first_name\": \"Stefany\",\r\n    \"start_date\": \"2021-06-18 12:00:00\",\r\n    \"currency\": \"USD\",\r\n    \"shipping_items\":[\r\n        {\r\n            \"name\": \"Express Shipping\",\r\n            \"amount\": 1,\r\n            \"carrier\": \"OWN\"\r\n        }\r\n    ]\r\n}";;

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.eyJpZCI6IjY3MmE4NTAzNzFiZTBlY2Y1NTRkMDUxNiIsImFjY291bnRfaWQiOiI2NzJhODUwMzcxYmUwZWNmNTU0ZDA1MGMiLCJpYXQiOjE3MzgwODY3MzEsImV4cCI6MTczODA5MDMzMX0.sRQIqx5XcoTOsVPTkuBvrXE8bnHlsrnnEVcRkWwW6CaFDpd4-_VGn4DoNJ9DeTDudcI8MqJb7orXB7aWGq0rjQ"
    |> fun h -> Header.add h "Content-Type" "application/json"
    |> fun h -> Header.add h "Cookie" "lang=en"
  in
  let body = Cohttp_lwt.Body.of_string !postData in

  Client.call ~headers ~body `POST 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 => 'POST',
  CURLOPT_POSTFIELDS =>'{
    "shipping_address": {
        "first_name": "Stefany",
        "last_name": "Porras",
        "address1": "Belisario Dominguez",
        "address2": "Semillero",
        "country": {
            "code": "US",
            "name": "United States"
        },
        "state": {
            "code": "FL"
        },
        "city": "Miami",
        "postal_code": "33101",
        "phone": "4125684412",
        "reference": "reference"
    },
    "items": [
        {
            "name": "Gold Neck BZ3909",
            "quantity": 1,
            "price": 2
        }
    ], 
    "quantity_uses": -1,
    "first_name": "Stefany",
    "start_date": "2021-06-18 12:00:00",
    "currency": "USD",
    "shipping_items":[
        {
            "name": "Express Shipping",
            "amount": 1,
            "carrier": "OWN"
        }
    ]
}',
  CURLOPT_HTTPHEADER => array(
    'Authorization: eyJhbGciOiJIUzUxMiIsInR5cCI6IkpXVCJ9.eyJpZCI6IjY3MmE4NTAzNzFiZTBlY2Y1NTRkMDUxNiIsImFjY291bnRfaWQiOiI2NzJhODUwMzcxYmUwZWNmNTU0ZDA1MGMiLCJpYXQiOjE3MzgwODY3MzEsImV4cCI6MTczODA5MDMzMX0.sRQIqx5XcoTOsVPTkuBvrXE8bnHlsrnnEVcRkWwW6CaFDpd4-_VGn4DoNJ9DeTDudcI8MqJb7orXB7aWGq0rjQ',
    'Content-Type: application/json',
    'Cookie: lang=en'
  ),
));

$response = curl_exec($curl);

curl_close($curl);
echo $response;

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

// Guzzle

<?php
$client = new Client();
$headers = [
  'Authorization' => 'eyJhbGciOiJIUzUxMiIsInR5cCI6IkpXVCJ9.eyJpZCI6IjY3MmE4NTAzNzFiZTBlY2Y1NTRkMDUxNiIsImFjY291bnRfaWQiOiI2NzJhODUwMzcxYmUwZWNmNTU0ZDA1MGMiLCJpYXQiOjE3MzgwODY3MzEsImV4cCI6MTczODA5MDMzMX0.sRQIqx5XcoTOsVPTkuBvrXE8bnHlsrnnEVcRkWwW6CaFDpd4-_VGn4DoNJ9DeTDudcI8MqJb7orXB7aWGq0rjQ',
  'Content-Type' => 'application/json',
  'Cookie' => 'lang=en'
];
$body = '{
  "shipping_address": {
    "first_name": "Stefany",
    "last_name": "Porras",
    "address1": "Belisario Dominguez",
    "address2": "Semillero",
    "country": {
      "code": "US",
      "name": "United States"
    },
    "state": {
      "code": "FL"
    },
    "city": "Miami",
    "postal_code": "33101",
    "phone": "4125684412",
    "reference": "reference"
  },
  "items": [
    {
      "name": "Gold Neck BZ3909",
      "quantity": 1,
      "price": 2
    }
  ],
  "quantity_uses": -1,
  "first_name": "Stefany",
  "start_date": "2021-06-18 12:00:00",
  "currency": "USD",
  "shipping_items": [
    {
      "name": "Express Shipping",
      "amount": 1,
      "carrier": "OWN"
    }
  ]
}';
$request = new Request('POST', 'https://sandbox.ecartpay.com/api/templates', $headers, $body);
$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_POST);
$request->setConfig(array(
  'follow_redirects' => TRUE
));
$request->setHeader(array(
  'Authorization' => 'eyJhbGciOiJIUzUxMiIsInR5cCI6IkpXVCJ9.eyJpZCI6IjY3MmE4NTAzNzFiZTBlY2Y1NTRkMDUxNiIsImFjY291bnRfaWQiOiI2NzJhODUwMzcxYmUwZWNmNTU0ZDA1MGMiLCJpYXQiOjE3MzgwODY3MzEsImV4cCI6MTczODA5MDMzMX0.sRQIqx5XcoTOsVPTkuBvrXE8bnHlsrnnEVcRkWwW6CaFDpd4-_VGn4DoNJ9DeTDudcI8MqJb7orXB7aWGq0rjQ',
  'Content-Type' => 'application/json',
  'Cookie' => 'lang=en'
));
$request->setBody('{
\n    "shipping_address": {
\n        "first_name": "Stefany",
\n        "last_name": "Porras",
\n        "address1": "Belisario Dominguez",
\n        "address2": "Semillero",
\n        "country": {
\n            "code": "US",
\n            "name": "United States"
\n        },
\n        "state": {
\n            "code": "FL"
\n        },
\n        "city": "Miami",
\n        "postal_code": "33101",
\n        "phone": "4125684412",
\n        "reference": "reference"
\n    },
\n    "items": [
\n        {
\n            "name": "Gold Neck BZ3909",
\n            "quantity": 1,
\n            "price": 2
\n        }
\n    ], 
\n    "quantity_uses": -1,
\n    "first_name": "Stefany",
\n    "start_date": "2021-06-18 12:00:00",
\n    "currency": "USD",
\n    "shipping_items":[
\n        {
\n            "name": "Express Shipping",
\n            "amount": 1,
\n            "carrier": "OWN"
\n        }
\n    ]
\n}');
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('POST');
$body = new http\Message\Body;
$body->append('{
    "shipping_address": {
        "first_name": "Stefany",
        "last_name": "Porras",
        "address1": "Belisario Dominguez",
        "address2": "Semillero",
        "country": {
            "code": "US",
            "name": "United States"
        },
        "state": {
            "code": "FL"
        },
        "city": "Miami",
        "postal_code": "33101",
        "phone": "4125684412",
        "reference": "reference"
    },
    "items": [
        {
            "name": "Gold Neck BZ3909",
            "quantity": 1,
            "price": 2
        }
    ], 
    "quantity_uses": -1,
    "first_name": "Stefany",
    "start_date": "2021-06-18 12:00:00",
    "currency": "USD",
    "shipping_items":[
        {
            "name": "Express Shipping",
            "amount": 1,
            "carrier": "OWN"
        }
    ]
}');
$request->setBody($body);
$request->setOptions(array());
$request->setHeaders(array(
  'Authorization' => 'eyJhbGciOiJIUzUxMiIsInR5cCI6IkpXVCJ9.eyJpZCI6IjY3MmE4NTAzNzFiZTBlY2Y1NTRkMDUxNiIsImFjY291bnRfaWQiOiI2NzJhODUwMzcxYmUwZWNmNTU0ZDA1MGMiLCJpYXQiOjE3MzgwODY3MzEsImV4cCI6MTczODA5MDMzMX0.sRQIqx5XcoTOsVPTkuBvrXE8bnHlsrnnEVcRkWwW6CaFDpd4-_VGn4DoNJ9DeTDudcI8MqJb7orXB7aWGq0rjQ',
  'Content-Type' => 'application/json',
  '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.eyJpZCI6IjY3MmE4NTAzNzFiZTBlY2Y1NTRkMDUxNiIsImFjY291bnRfaWQiOiI2NzJhODUwMzcxYmUwZWNmNTU0ZDA1MGMiLCJpYXQiOjE3MzgwODY3MzEsImV4cCI6MTczODA5MDMzMX0.sRQIqx5XcoTOsVPTkuBvrXE8bnHlsrnnEVcRkWwW6CaFDpd4-_VGn4DoNJ9DeTDudcI8MqJb7orXB7aWGq0rjQ")
$headers.Add("Content-Type", "application/json")
$headers.Add("Cookie", "lang=en")

$body = @"
{
    `"shipping_address`": {
        `"first_name`": `"Stefany`",
        `"last_name`": `"Porras`",
        `"address1`": `"Belisario Dominguez`",
        `"address2`": `"Semillero`",
        `"country`": {
            `"code`": `"US`",
            `"name`": `"United States`"
        },
        `"state`": {
            `"code`": `"FL`"
        },
        `"city`": `"Miami`",
        `"postal_code`": `"33101`",
        `"phone`": `"4125684412`",
        `"reference`": `"reference`"
    },
    `"items`": [
        {
            `"name`": `"Gold Neck BZ3909`",
            `"quantity`": 1,
            `"price`": 2
        }
    ], 
    `"quantity_uses`": -1,
    `"first_name`": `"Stefany`",
    `"start_date`": `"2021-06-18 12:00:00`",
    `"currency`": `"USD`",
    `"shipping_items`":[
        {
            `"name`": `"Express Shipping`",
            `"amount`": 1,
            `"carrier`": `"OWN`"
        }
    ]
}
"@

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

import http.client
import json

conn = http.client.HTTPSConnection("sandbox.ecartpay.com")
payload = json.dumps({
  "shipping_address": {
    "first_name": "Stefany",
    "last_name": "Porras",
    "address1": "Belisario Dominguez",
    "address2": "Semillero",
    "country": {
      "code": "US",
      "name": "United States"
    },
    "state": {
      "code": "FL"
    },
    "city": "Miami",
    "postal_code": "33101",
    "phone": "4125684412",
    "reference": "reference"
  },
  "items": [
    {
      "name": "Gold Neck BZ3909",
      "quantity": 1,
      "price": 2
    }
  ],
  "quantity_uses": -1,
  "first_name": "Stefany",
  "start_date": "2021-06-18 12:00:00",
  "currency": "USD",
  "shipping_items": [
    {
      "name": "Express Shipping",
      "amount": 1,
      "carrier": "OWN"
    }
  ]
})
headers = {
  'Authorization': 'eyJhbGciOiJIUzUxMiIsInR5cCI6IkpXVCJ9.eyJpZCI6IjY3MmE4NTAzNzFiZTBlY2Y1NTRkMDUxNiIsImFjY291bnRfaWQiOiI2NzJhODUwMzcxYmUwZWNmNTU0ZDA1MGMiLCJpYXQiOjE3MzgwODY3MzEsImV4cCI6MTczODA5MDMzMX0.sRQIqx5XcoTOsVPTkuBvrXE8bnHlsrnnEVcRkWwW6CaFDpd4-_VGn4DoNJ9DeTDudcI8MqJb7orXB7aWGq0rjQ',
  'Content-Type': 'application/json',
  'Cookie': 'lang=en'
}
conn.request("POST", "/api/templates", payload, headers)
res = conn.getresponse()
data = res.read()
print(data.decode("utf-8"))

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

# Requests

import requests
import json

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

payload = json.dumps({
  "shipping_address": {
    "first_name": "Stefany",
    "last_name": "Porras",
    "address1": "Belisario Dominguez",
    "address2": "Semillero",
    "country": {
      "code": "US",
      "name": "United States"
    },
    "state": {
      "code": "FL"
    },
    "city": "Miami",
    "postal_code": "33101",
    "phone": "4125684412",
    "reference": "reference"
  },
  "items": [
    {
      "name": "Gold Neck BZ3909",
      "quantity": 1,
      "price": 2
    }
  ],
  "quantity_uses": -1,
  "first_name": "Stefany",
  "start_date": "2021-06-18 12:00:00",
  "currency": "USD",
  "shipping_items": [
    {
      "name": "Express Shipping",
      "amount": 1,
      "carrier": "OWN"
    }
  ]
})
headers = {
  'Authorization': 'eyJhbGciOiJIUzUxMiIsInR5cCI6IkpXVCJ9.eyJpZCI6IjY3MmE4NTAzNzFiZTBlY2Y1NTRkMDUxNiIsImFjY291bnRfaWQiOiI2NzJhODUwMzcxYmUwZWNmNTU0ZDA1MGMiLCJpYXQiOjE3MzgwODY3MzEsImV4cCI6MTczODA5MDMzMX0.sRQIqx5XcoTOsVPTkuBvrXE8bnHlsrnnEVcRkWwW6CaFDpd4-_VGn4DoNJ9DeTDudcI8MqJb7orXB7aWGq0rjQ',
  'Content-Type': 'application/json',
  'Cookie': 'lang=en'
}

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

print(response.text)
# httr

library(httr)

headers = c(
  'Authorization' = 'eyJhbGciOiJIUzUxMiIsInR5cCI6IkpXVCJ9.eyJpZCI6IjY3MmE4NTAzNzFiZTBlY2Y1NTRkMDUxNiIsImFjY291bnRfaWQiOiI2NzJhODUwMzcxYmUwZWNmNTU0ZDA1MGMiLCJpYXQiOjE3MzgwODY3MzEsImV4cCI6MTczODA5MDMzMX0.sRQIqx5XcoTOsVPTkuBvrXE8bnHlsrnnEVcRkWwW6CaFDpd4-_VGn4DoNJ9DeTDudcI8MqJb7orXB7aWGq0rjQ',
  'Content-Type' = 'application/json',
  'Cookie' = 'lang=en'
)

body = '{
  "shipping_address": {
    "first_name": "Stefany",
    "last_name": "Porras",
    "address1": "Belisario Dominguez",
    "address2": "Semillero",
    "country": {
      "code": "US",
      "name": "United States"
    },
    "state": {
      "code": "FL"
    },
    "city": "Miami",
    "postal_code": "33101",
    "phone": "4125684412",
    "reference": "reference"
  },
  "items": [
    {
      "name": "Gold Neck BZ3909",
      "quantity": 1,
      "price": 2
    }
  ],
  "quantity_uses": -1,
  "first_name": "Stefany",
  "start_date": "2021-06-18 12:00:00",
  "currency": "USD",
  "shipping_items": [
    {
      "name": "Express Shipping",
      "amount": 1,
      "carrier": "OWN"
    }
  ]
}';

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

cat(content(res, 'text'))

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

# RCurl

library(RCurl)
headers = c(
  "Authorization" = "eyJhbGciOiJIUzUxMiIsInR5cCI6IkpXVCJ9.eyJpZCI6IjY3MmE4NTAzNzFiZTBlY2Y1NTRkMDUxNiIsImFjY291bnRfaWQiOiI2NzJhODUwMzcxYmUwZWNmNTU0ZDA1MGMiLCJpYXQiOjE3MzgwODY3MzEsImV4cCI6MTczODA5MDMzMX0.sRQIqx5XcoTOsVPTkuBvrXE8bnHlsrnnEVcRkWwW6CaFDpd4-_VGn4DoNJ9DeTDudcI8MqJb7orXB7aWGq0rjQ",
  "Content-Type" = "application/json",
  "Cookie" = "lang=en"
)
params = "{
  \"shipping_address\": {
    \"first_name\": \"Stefany\",
    \"last_name\": \"Porras\",
    \"address1\": \"Belisario Dominguez\",
    \"address2\": \"Semillero\",
    \"country\": {
      \"code\": \"US\",
      \"name\": \"United States\"
    },
    \"state\": {
      \"code\": \"FL\"
    },
    \"city\": \"Miami\",
    \"postal_code\": \"33101\",
    \"phone\": \"4125684412\",
    \"reference\": \"reference\"
  },
  \"items\": [
    {
      \"name\": \"Gold Neck BZ3909\",
      \"quantity\": 1,
      \"price\": 2
    }
  ],
  \"quantity_uses\": -1,
  \"first_name\": \"Stefany\",
  \"start_date\": \"2021-06-18 12:00:00\",
  \"currency\": \"USD\",
  \"shipping_items\": [
    {
      \"name\": \"Express Shipping\",
      \"amount\": 1,
      \"carrier\": \"OWN\"
    }
  ]
}"
res <- postForm("https://sandbox.ecartpay.com/api/templates", .opts=list(postfields = params, httpheader = headers, followlocation = TRUE), style = "httppost")
cat(res)
require "uri"
require "json"
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::Post.new(url)
request["Authorization"] = "eyJhbGciOiJIUzUxMiIsInR5cCI6IkpXVCJ9.eyJpZCI6IjY3MmE4NTAzNzFiZTBlY2Y1NTRkMDUxNiIsImFjY291bnRfaWQiOiI2NzJhODUwMzcxYmUwZWNmNTU0ZDA1MGMiLCJpYXQiOjE3MzgwODY3MzEsImV4cCI6MTczODA5MDMzMX0.sRQIqx5XcoTOsVPTkuBvrXE8bnHlsrnnEVcRkWwW6CaFDpd4-_VGn4DoNJ9DeTDudcI8MqJb7orXB7aWGq0rjQ"
request["Content-Type"] = "application/json"
request["Cookie"] = "lang=en"
request.body = JSON.dump({
  "shipping_address": {
    "first_name": "Stefany",
    "last_name": "Porras",
    "address1": "Belisario Dominguez",
    "address2": "Semillero",
    "country": {
      "code": "US",
      "name": "United States"
    },
    "state": {
      "code": "FL"
    },
    "city": "Miami",
    "postal_code": "33101",
    "phone": "4125684412",
    "reference": "reference"
  },
  "items": [
    {
      "name": "Gold Neck BZ3909",
      "quantity": 1,
      "price": 2
    }
  ],
  "quantity_uses": -1,
  "first_name": "Stefany",
  "start_date": "2021-06-18 12:00:00",
  "currency": "USD",
  "shipping_items": [
    {
      "name": "Express Shipping",
      "amount": 1,
      "carrier": "OWN"
    }
  ]
})

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.eyJpZCI6IjY3MmE4NTAzNzFiZTBlY2Y1NTRkMDUxNiIsImFjY291bnRfaWQiOiI2NzJhODUwMzcxYmUwZWNmNTU0ZDA1MGMiLCJpYXQiOjE3MzgwODY3MzEsImV4cCI6MTczODA5MDMzMX0.sRQIqx5XcoTOsVPTkuBvrXE8bnHlsrnnEVcRkWwW6CaFDpd4-_VGn4DoNJ9DeTDudcI8MqJb7orXB7aWGq0rjQ".parse()?);
    headers.insert("Content-Type", "application/json".parse()?);
    headers.insert("Cookie", "lang=en".parse()?);

    let data = r#"{
    "shipping_address": {
        "first_name": "Stefany",
        "last_name": "Porras",
        "address1": "Belisario Dominguez",
        "address2": "Semillero",
        "country": {
            "code": "US",
            "name": "United States"
        },
        "state": {
            "code": "FL"
        },
        "city": "Miami",
        "postal_code": "33101",
        "phone": "4125684412",
        "reference": "reference"
    },
    "items": [
        {
            "name": "Gold Neck BZ3909",
            "quantity": 1,
            "price": 2
        }
    ],
    "quantity_uses": -1,
    "first_name": "Stefany",
    "start_date": "2021-06-18 12:00:00",
    "currency": "USD",
    "shipping_items": [
        {
            "name": "Express Shipping",
            "amount": 1,
            "carrier": "OWN"
        }
    ]
}"#;

    let json: serde_json::Value = serde_json::from_str(&data)?;

    let request = client.request(reqwest::Method::POST, "https://sandbox.ecartpay.com/api/templates")
        .headers(headers)
        .json(&json);

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

    println!("{}", body);

    Ok(())
}
# Httpie

printf '{
    "shipping_address": {
        "first_name": "Stefany",
        "last_name": "Porras",
        "address1": "Belisario Dominguez",
        "address2": "Semillero",
        "country": {
            "code": "US",
            "name": "United States"
        },
        "state": {
            "code": "FL"
        },
        "city": "Miami",
        "postal_code": "33101",
        "phone": "4125684412",
        "reference": "reference"
    },
    "items": [
        {
            "name": "Gold Neck BZ3909",
            "quantity": 1,
            "price": 2
        }
    ], 
    "quantity_uses": -1,
    "first_name": "Stefany",
    "start_date": "2021-06-18 12:00:00",
    "currency": "USD",
    "shipping_items":[
        {
            "name": "Express Shipping",
            "amount": 1,
            "carrier": "OWN"
        }
    ]
}'| http  --follow --timeout 3600 POST 'https://sandbox.ecartpay.com/api/templates' \
 Authorization:'eyJhbGciOiJIUzUxMiIsInR5cCI6IkpXVCJ9.eyJpZCI6IjY3MmE4NTAzNzFiZTBlY2Y1NTRkMDUxNiIsImFjY291bnRfaWQiOiI2NzJhODUwMzcxYmUwZWNmNTU0ZDA1MGMiLCJpYXQiOjE3MzgwODY3MzEsImV4cCI6MTczODA5MDMzMX0.sRQIqx5XcoTOsVPTkuBvrXE8bnHlsrnnEVcRkWwW6CaFDpd4-_VGn4DoNJ9DeTDudcI8MqJb7orXB7aWGq0rjQ' \
 Content-Type:'application/json' \
 Cookie:'lang=en'

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

# wget

wget --no-check-certificate --quiet \
  --method POST \
  --timeout=0 \
  --header 'Authorization: eyJhbGciOiJIUzUxMiIsInR5cCI6IkpXVCJ9.eyJpZCI6IjY3MmE4NTAzNzFiZTBlY2Y1NTRkMDUxNiIsImFjY291bnRfaWQiOiI2NzJhODUwMzcxYmUwZWNmNTU0ZDA1MGMiLCJpYXQiOjE3MzgwODY3MzEsImV4cCI6MTczODA5MDMzMX0.sRQIqx5XcoTOsVPTkuBvrXE8bnHlsrnnEVcRkWwW6CaFDpd4-_VGn4DoNJ9DeTDudcI8MqJb7orXB7aWGq0rjQ' \
  --header 'Content-Type: application/json' \
  --header 'Cookie: lang=en' \
  --body-data '{
    "shipping_address": {
        "first_name": "Stefany",
        "last_name": "Porras",
        "address1": "Belisario Dominguez",
        "address2": "Semillero",
        "country": {
            "code": "US",
            "name": "United States"
        },
        "state": {
            "code": "FL"
        },
        "city": "Miami",
        "postal_code": "33101",
        "phone": "4125684412",
        "reference": "reference"
    },
    "items": [
        {
            "name": "Gold Neck BZ3909",
            "quantity": 1,
            "price": 2
        }
    ], 
    "quantity_uses": -1,
    "first_name": "Stefany",
    "start_date": "2021-06-18 12:00:00",
    "currency": "USD",
    "shipping_items":[
        {
            "name": "Express Shipping",
            "amount": 1,
            "carrier": "OWN"
        }
    ]
}' \
   'https://sandbox.ecartpay.com/api/templates'
let parameters = "{\r\n    \"shipping_address\": {\r\n        \"first_name\": \"Stefany\",\r\n        \"last_name\": \"Porras\",\r\n        \"address1\": \"Belisario Dominguez\",\r\n        \"address2\": \"Semillero\",\r\n        \"country\": {\r\n            \"code\": \"US\",\r\n            \"name\": \"United States\"\r\n        },\r\n        \"state\": {\r\n            \"code\": \"FL\"\r\n        },\r\n        \"city\": \"Miami\",\r\n        \"postal_code\": \"33101\",\r\n        \"phone\": \"4125684412\",\r\n        \"reference\": \"reference\"\r\n    },\r\n    \"items\": [\r\n        {\r\n            \"name\": \"Gold Neck BZ3909\",\r\n            \"quantity\": 1,\r\n            \"price\": 2\r\n        }\r\n    ], \r\n    \"quantity_uses\": -1,\r\n    \"first_name\": \"Stefany\",\r\n    \"start_date\": \"2021-06-18 12:00:00\",\r\n    \"currency\": \"USD\",\r\n    \"shipping_items\":[\r\n        {\r\n            \"name\": \"Express Shipping\",\r\n            \"amount\": 1,\r\n            \"carrier\": \"OWN\"\r\n        }\r\n    ]\r\n}"
let postData = parameters.data(using: .utf8)

var request = URLRequest(url: URL(string: "https://sandbox.ecartpay.com/api/templates")!,timeoutInterval: Double.infinity)
request.addValue("eyJhbGciOiJIUzUxMiIsInR5cCI6IkpXVCJ9.eyJpZCI6IjY3MmE4NTAzNzFiZTBlY2Y1NTRkMDUxNiIsImFjY291bnRfaWQiOiI2NzJhODUwMzcxYmUwZWNmNTU0ZDA1MGMiLCJpYXQiOjE3MzgwODY3MzEsImV4cCI6MTczODA5MDMzMX0.sRQIqx5XcoTOsVPTkuBvrXE8bnHlsrnnEVcRkWwW6CaFDpd4-_VGn4DoNJ9DeTDudcI8MqJb7orXB7aWGq0rjQ", forHTTPHeaderField: "Authorization")
request.addValue("application/json", forHTTPHeaderField: "Content-Type")
request.addValue("lang=en", forHTTPHeaderField: "Cookie")

request.httpMethod = "POST"
request.httpBody = postData

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()

Response

{
    "id": "61a5427df6ea776ee3b38344",
    "account_id": "5d2d436e3199ae000449065b",
    "authorization_id": "6189d4c4e1fd65512e9c5264",
    "first_name": "Stefany",
    "currency": "USD",
    "shipping_address": {
        "first_name": "Stefany",
        "last_name": "Porras",
        "address1": "Belisario Dominguez",
        "address2": "Semillero",
        "country": {
            "code": "US",
            "name": "United States"
        },
        "state": {
            "code": "FL"
        },
        "city": "Miami",
        "postal_code": "33101",
        "phone": "4125684412",
        "reference": "reference"
    },
    "items": [
        {
            "name": "Gold Neck BZ3909",
            "quantity": 1,
            "price": 2,
            "discount": 0,
            "total": 2,
            "tax": 0
        }
    ],
    "shipping_items": [
        {
            "name": "Express Shipping",
            "amount": 1,
            "carrier": "OWN"
        }
    ],
    "discounts": [],
    "totals": {
        "subtotal": 2,
        "total": 3,
        "tax": 0,
        "discount": 0,
        "shipping": 1
    },
    "start_date": "2021-06-18T12:00:00.000Z",
    "end_date": null,
    "quantity_uses": -1,
    "name": "Gold Neck Payment",
    "number": "TE04725186",
    "created_at": "2021-11-29T21:13:33.947Z",
    "updated_at": "2021-11-29T21:13:33.947Z"
}
Image 2. Payment Link Created

Image 2. Payment Link Created