Chargebacks
Ecart Pay facilitates the chargeback process by serving as an intermediary between merchants and card issuers, ensuring a structured resolution.
Chargebacks are a critical mechanism in payment systems, designed to protect cardholders from unauthorized or incorrect charges. However, they can also be challenging for merchants as they often require thorough documentation and adherence to strict timelines. Ecart Pay streamlines this process by offering tools and guidance to help merchants address disputes effectively.
This entry details the chargeback process, its types, the required documentation, and how Ecart Pay supports merchants in managing disputes efficiently.
What are Chargebacks?
A chargeback is a dispute initiated when a cardholder contacts their card issuer to challenge a transaction. This typically occurs when the cardholder does not recognize or agree with a charge on their statement. The card issuer notifies Ecart Pay of the dispute, initiating the chargeback process.
Reasons for Chargebacks
Cardholders may initiate chargebacks for the following reasons:
- Fraud: When the cardholder does not recognize the charge, suspecting unauthorized activity.
- Processing Errors: Due to technical issues between the merchant and the issuing bank, such as duplicate charges.
- Authorization Issues: When a transaction is declined but still processed. Also when a transactions is completed without proper authorization.
- Consumer Disputes: When the cardholder claims they did not receive the product or service, or it did not match the description.
Why Is It Important to Provide a Chargeback Option?
Offering a chargeback option enhances customer trust and ensures compliance with industry standards. It protects cardholders from fraudulent or erroneous transactions and encourages fair dispute resolution. For merchants, managing chargebacks effectively prevents financial losses and maintains their reputation.
How to Create a Chargeback (on Code)
This endpoint is used to create custom checkouts in the Ecart Pay system. By providing customer and transaction details, businesses can generate a unique checkout link for seamless payments.
Endpoint
POST {{baseURL}}/api/chargebacks
Headers
Authorization: {token}
Request Body
{
"payout_id": "{{payout_id}}",
"reason": "I did not get the product."
}
Example Request
curl --location 'https://sandbox.ecartpay.com/api/chargebacks' \
--header 'Authorization: eyJhbGciOiJIUzUxMiIsInR5cCI6IkpXVCJ9.eyJpZCI6IjY3MmE4NTAzNzFiZTBlY2Y1NTRkMDUxNiIsImFjY291bnRfaWQiOiI2NzJhODUwMzcxYmUwZWNmNTU0ZDA1MGMiLCJpYXQiOjE3Mzk1NDc1MjUsImV4cCI6MTczOTU1MTEyNX0.Vxz-SbPuift-7_DL_ZXYrsxJr_dTKOrch2-FYokgWlk8xgDq0g7sUNxT_emPp0eB3X4EeIrjTCAqbjZPSscn8Q' \
--header 'Content-Type: application/json' \
--header 'Cookie: lang=en' \
--data '{
"payout_id": "653aa3f22d4d6fb3c35a479a",
"reason": "I did not get the product."
}'
package main
import (
"fmt"
"strings"
"net/http"
"io"
)
func main() {
url := "https://sandbox.ecartpay.com/api/chargebacks"
method := "POST"
payload := strings.NewReader(`{
"payout_id": "653aa3f22d4d6fb3c35a479a",
"reason": "I did not get the product."
}`)
client := &http.Client {
}
req, err := http.NewRequest(method, url, payload)
if err != nil {
fmt.Println(err)
return
}
req.Header.Add("Authorization", "eyJhbGciOiJIUzUxMiIsInR5cCI6IkpXVCJ9.eyJpZCI6IjY3MmE4NTAzNzFiZTBlY2Y1NTRkMDUxNiIsImFjY291bnRfaWQiOiI2NzJhODUwMzcxYmUwZWNmNTU0ZDA1MGMiLCJpYXQiOjE3Mzk1NDc1MjUsImV4cCI6MTczOTU1MTEyNX0.Vxz-SbPuift-7_DL_ZXYrsxJr_dTKOrch2-FYokgWlk8xgDq0g7sUNxT_emPp0eB3X4EeIrjTCAqbjZPSscn8Q")
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/chargebacks HTTP/1.1
Host: sandbox.ecartpay.com
Authorization: eyJhbGciOiJIUzUxMiIsInR5cCI6IkpXVCJ9.eyJpZCI6IjY3MmE4NTAzNzFiZTBlY2Y1NTRkMDUxNiIsImFjY291bnRfaWQiOiI2NzJhODUwMzcxYmUwZWNmNTU0ZDA1MGMiLCJpYXQiOjE3Mzk1NDc1MjUsImV4cCI6MTczOTU1MTEyNX0.Vxz-SbPuift-7_DL_ZXYrsxJr_dTKOrch2-FYokgWlk8xgDq0g7sUNxT_emPp0eB3X4EeIrjTCAqbjZPSscn8Q
Content-Type: application/json
Cookie: lang=en
Content-Length: 91
{
"payout_id": "653aa3f22d4d6fb3c35a479a",
"reason": "I did not get the product."
}
// OkHttp
OkHttpClient client = new OkHttpClient().newBuilder()
.build();
MediaType mediaType = MediaType.parse("application/json");
RequestBody body = RequestBody.create(mediaType, "{\n \"payout_id\": \"653aa3f22d4d6fb3c35a479a\",\n \"reason\": \"I did not get the product.\"\n}");
Request request = new Request.Builder()
.url("https://sandbox.ecartpay.com/api/chargebacks")
.method("POST", body)
.addHeader("Authorization", "eyJhbGciOiJIUzUxMiIsInR5cCI6IkpXVCJ9.eyJpZCI6IjY3MmE4NTAzNzFiZTBlY2Y1NTRkMDUxNiIsImFjY291bnRfaWQiOiI2NzJhODUwMzcxYmUwZWNmNTU0ZDA1MGMiLCJpYXQiOjE3Mzk1NDc1MjUsImV4cCI6MTczOTU1MTEyNX0.Vxz-SbPuift-7_DL_ZXYrsxJr_dTKOrch2-FYokgWlk8xgDq0g7sUNxT_emPp0eB3X4EeIrjTCAqbjZPSscn8Q")
.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/chargebacks")
.header("Authorization", "eyJhbGciOiJIUzUxMiIsInR5cCI6IkpXVCJ9.eyJpZCI6IjY3MmE4NTAzNzFiZTBlY2Y1NTRkMDUxNiIsImFjY291bnRfaWQiOiI2NzJhODUwMzcxYmUwZWNmNTU0ZDA1MGMiLCJpYXQiOjE3Mzk1NDc1MjUsImV4cCI6MTczOTU1MTEyNX0.Vxz-SbPuift-7_DL_ZXYrsxJr_dTKOrch2-FYokgWlk8xgDq0g7sUNxT_emPp0eB3X4EeIrjTCAqbjZPSscn8Q")
.header("Content-Type", "application/json")
.header("Cookie", "lang=en")
.body("{\n \"payout_id\": \"653aa3f22d4d6fb3c35a479a\",\n \"reason\": \"I did not get the product.\"\n}")
.asString();
// Fetch
const myHeaders = new Headers();
myHeaders.append("Authorization", "eyJhbGciOiJIUzUxMiIsInR5cCI6IkpXVCJ9.eyJpZCI6IjY3MmE4NTAzNzFiZTBlY2Y1NTRkMDUxNiIsImFjY291bnRfaWQiOiI2NzJhODUwMzcxYmUwZWNmNTU0ZDA1MGMiLCJpYXQiOjE3Mzk1NDc1MjUsImV4cCI6MTczOTU1MTEyNX0.Vxz-SbPuift-7_DL_ZXYrsxJr_dTKOrch2-FYokgWlk8xgDq0g7sUNxT_emPp0eB3X4EeIrjTCAqbjZPSscn8Q");
myHeaders.append("Content-Type", "application/json");
myHeaders.append("Cookie", "lang=en");
const raw = JSON.stringify({
"payout_id": "653aa3f22d4d6fb3c35a479a",
"reason": "I did not get the product."
});
const requestOptions = {
method: "POST",
headers: myHeaders,
body: raw,
redirect: "follow"
};
fetch("https://sandbox.ecartpay.com/api/chargebacks", requestOptions)
.then((response) => response.text())
.then((result) => console.log(result))
.catch((error) => console.error(error));
// -------------------------------------------------------------
// jQuery
var settings = {
"url": "https://sandbox.ecartpay.com/api/chargebacks",
"method": "POST",
"timeout": 0,
"headers": {
"Authorization": "eyJhbGciOiJIUzUxMiIsInR5cCI6IkpXVCJ9.eyJpZCI6IjY3MmE4NTAzNzFiZTBlY2Y1NTRkMDUxNiIsImFjY291bnRfaWQiOiI2NzJhODUwMzcxYmUwZWNmNTU0ZDA1MGMiLCJpYXQiOjE3Mzk1NDc1MjUsImV4cCI6MTczOTU1MTEyNX0.Vxz-SbPuift-7_DL_ZXYrsxJr_dTKOrch2-FYokgWlk8xgDq0g7sUNxT_emPp0eB3X4EeIrjTCAqbjZPSscn8Q",
"Content-Type": "application/json",
"Cookie": "lang=en"
},
"data": JSON.stringify({
"payout_id": "653aa3f22d4d6fb3c35a479a",
"reason": "I did not get the product."
}),
};
$.ajax(settings).done(function (response) {
console.log(response);
});
// -------------------------------------------------------------
// XHR
// WARNING: For POST requests, body is set to null by browsers.
var data = JSON.stringify({
"payout_id": "653aa3f22d4d6fb3c35a479a",
"reason": "I did not get the product."
});
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/chargebacks");
xhr.setRequestHeader("Authorization", "eyJhbGciOiJIUzUxMiIsInR5cCI6IkpXVCJ9.eyJpZCI6IjY3MmE4NTAzNzFiZTBlY2Y1NTRkMDUxNiIsImFjY291bnRfaWQiOiI2NzJhODUwMzcxYmUwZWNmNTU0ZDA1MGMiLCJpYXQiOjE3Mzk1NDc1MjUsImV4cCI6MTczOTU1MTEyNX0.Vxz-SbPuift-7_DL_ZXYrsxJr_dTKOrch2-FYokgWlk8xgDq0g7sUNxT_emPp0eB3X4EeIrjTCAqbjZPSscn8Q");
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/chargebacks");
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.eyJpZCI6IjY3MmE4NTAzNzFiZTBlY2Y1NTRkMDUxNiIsImFjY291bnRfaWQiOiI2NzJhODUwMzcxYmUwZWNmNTU0ZDA1MGMiLCJpYXQiOjE3Mzk1NDc1MjUsImV4cCI6MTczOTU1MTEyNX0.Vxz-SbPuift-7_DL_ZXYrsxJr_dTKOrch2-FYokgWlk8xgDq0g7sUNxT_emPp0eB3X4EeIrjTCAqbjZPSscn8Q");
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 = "{\n \"payout_id\": \"653aa3f22d4d6fb3c35a479a\",\n \"reason\": \"I did not get the product.\"\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({
"payout_id": "653aa3f22d4d6fb3c35a479a",
"reason": "I did not get the product."
});
let config = {
method: 'post',
maxBodyLength: Infinity,
url: 'https://sandbox.ecartpay.com/api/chargebacks',
headers: {
'Authorization': 'eyJhbGciOiJIUzUxMiIsInR5cCI6IkpXVCJ9.eyJpZCI6IjY3MmE4NTAzNzFiZTBlY2Y1NTRkMDUxNiIsImFjY291bnRfaWQiOiI2NzJhODUwMzcxYmUwZWNmNTU0ZDA1MGMiLCJpYXQiOjE3Mzk1NDc1MjUsImV4cCI6MTczOTU1MTEyNX0.Vxz-SbPuift-7_DL_ZXYrsxJr_dTKOrch2-FYokgWlk8xgDq0g7sUNxT_emPp0eB3X4EeIrjTCAqbjZPSscn8Q',
'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/chargebacks',
'headers': {
'Authorization': 'eyJhbGciOiJIUzUxMiIsInR5cCI6IkpXVCJ9.eyJpZCI6IjY3MmE4NTAzNzFiZTBlY2Y1NTRkMDUxNiIsImFjY291bnRfaWQiOiI2NzJhODUwMzcxYmUwZWNmNTU0ZDA1MGMiLCJpYXQiOjE3Mzk1NDc1MjUsImV4cCI6MTczOTU1MTEyNX0.Vxz-SbPuift-7_DL_ZXYrsxJr_dTKOrch2-FYokgWlk8xgDq0g7sUNxT_emPp0eB3X4EeIrjTCAqbjZPSscn8Q',
'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({
"payout_id": "653aa3f22d4d6fb3c35a479a",
"reason": "I did not get the product."
});
req.write(postData);
req.end();
// -------------------------------------------------------------
// Request
var request = require('request');
var options = {
'method': 'POST',
'url': 'https://sandbox.ecartpay.com/api/chargebacks',
'headers': {
'Authorization': 'eyJhbGciOiJIUzUxMiIsInR5cCI6IkpXVCJ9.eyJpZCI6IjY3MmE4NTAzNzFiZTBlY2Y1NTRkMDUxNiIsImFjY291bnRfaWQiOiI2NzJhODUwMzcxYmUwZWNmNTU0ZDA1MGMiLCJpYXQiOjE3Mzk1NDc1MjUsImV4cCI6MTczOTU1MTEyNX0.Vxz-SbPuift-7_DL_ZXYrsxJr_dTKOrch2-FYokgWlk8xgDq0g7sUNxT_emPp0eB3X4EeIrjTCAqbjZPSscn8Q',
'Content-Type': 'application/json',
'Cookie': 'lang=en'
},
body: JSON.stringify({
"payout_id": "653aa3f22d4d6fb3c35a479a",
"reason": "I did not get the product."
})
};
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/chargebacks')
.headers({
'Authorization': 'eyJhbGciOiJIUzUxMiIsInR5cCI6IkpXVCJ9.eyJpZCI6IjY3MmE4NTAzNzFiZTBlY2Y1NTRkMDUxNiIsImFjY291bnRfaWQiOiI2NzJhODUwMzcxYmUwZWNmNTU0ZDA1MGMiLCJpYXQiOjE3Mzk1NDc1MjUsImV4cCI6MTczOTU1MTEyNX0.Vxz-SbPuift-7_DL_ZXYrsxJr_dTKOrch2-FYokgWlk8xgDq0g7sUNxT_emPp0eB3X4EeIrjTCAqbjZPSscn8Q',
'Content-Type': 'application/json',
'Cookie': 'lang=en'
})
.send(JSON.stringify({
"payout_id": "653aa3f22d4d6fb3c35a479a",
"reason": "I did not get the product."
}))
.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/chargebacks"]
cachePolicy:NSURLRequestUseProtocolCachePolicy
timeoutInterval:10.0];
NSDictionary *headers = @{
@"Authorization": @"eyJhbGciOiJIUzUxMiIsInR5cCI6IkpXVCJ9.eyJpZCI6IjY3MmE4NTAzNzFiZTBlY2Y1NTRkMDUxNiIsImFjY291bnRfaWQiOiI2NzJhODUwMzcxYmUwZWNmNTU0ZDA1MGMiLCJpYXQiOjE3Mzk1NDc1MjUsImV4cCI6MTczOTU1MTEyNX0.Vxz-SbPuift-7_DL_ZXYrsxJr_dTKOrch2-FYokgWlk8xgDq0g7sUNxT_emPp0eB3X4EeIrjTCAqbjZPSscn8Q",
@"Content-Type": @"application/json",
@"Cookie": @"lang=en"
};
[request setAllHTTPHeaderFields:headers];
NSData *postData = [[NSData alloc] initWithData:[@"{\n \"payout_id\": \"653aa3f22d4d6fb3c35a479a\",\n \"reason\": \"I did not get the product.\"\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 "{\n \"payout_id\": \"653aa3f22d4d6fb3c35a479a\",\n \"reason\": \"I did not get the product.\"\n}";;
let reqBody =
let uri = Uri.of_string "https://sandbox.ecartpay.com/api/chargebacks" in
let headers = Header.init ()
|> fun h -> Header.add h "Authorization" "eyJhbGciOiJIUzUxMiIsInR5cCI6IkpXVCJ9.eyJpZCI6IjY3MmE4NTAzNzFiZTBlY2Y1NTRkMDUxNiIsImFjY291bnRfaWQiOiI2NzJhODUwMzcxYmUwZWNmNTU0ZDA1MGMiLCJpYXQiOjE3Mzk1NDc1MjUsImV4cCI6MTczOTU1MTEyNX0.Vxz-SbPuift-7_DL_ZXYrsxJr_dTKOrch2-FYokgWlk8xgDq0g7sUNxT_emPp0eB3X4EeIrjTCAqbjZPSscn8Q"
|> 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/chargebacks',
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 =>'{
"payout_id": "653aa3f22d4d6fb3c35a479a",
"reason": "I did not get the product."
}',
CURLOPT_HTTPHEADER => array(
'Authorization: eyJhbGciOiJIUzUxMiIsInR5cCI6IkpXVCJ9.eyJpZCI6IjY3MmE4NTAzNzFiZTBlY2Y1NTRkMDUxNiIsImFjY291bnRfaWQiOiI2NzJhODUwMzcxYmUwZWNmNTU0ZDA1MGMiLCJpYXQiOjE3Mzk1NDc1MjUsImV4cCI6MTczOTU1MTEyNX0.Vxz-SbPuift-7_DL_ZXYrsxJr_dTKOrch2-FYokgWlk8xgDq0g7sUNxT_emPp0eB3X4EeIrjTCAqbjZPSscn8Q',
'Content-Type: application/json',
'Cookie: lang=en'
),
));
$response = curl_exec($curl);
curl_close($curl);
echo $response;
// -------------------------------------------------------------
// Guzzle
<?php
$client = new Client();
$headers = [
'Authorization' => 'eyJhbGciOiJIUzUxMiIsInR5cCI6IkpXVCJ9.eyJpZCI6IjY3MmE4NTAzNzFiZTBlY2Y1NTRkMDUxNiIsImFjY291bnRfaWQiOiI2NzJhODUwMzcxYmUwZWNmNTU0ZDA1MGMiLCJpYXQiOjE3Mzk1NDc1MjUsImV4cCI6MTczOTU1MTEyNX0.Vxz-SbPuift-7_DL_ZXYrsxJr_dTKOrch2-FYokgWlk8xgDq0g7sUNxT_emPp0eB3X4EeIrjTCAqbjZPSscn8Q',
'Content-Type' => 'application/json',
'Cookie' => 'lang=en'
];
$body = '{
"payout_id": "653aa3f22d4d6fb3c35a479a",
"reason": "I did not get the product."
}';
$request = new Request('POST', 'https://sandbox.ecartpay.com/api/chargebacks', $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/chargebacks');
$request->setMethod(HTTP_Request2::METHOD_POST);
$request->setConfig(array(
'follow_redirects' => TRUE
));
$request->setHeader(array(
'Authorization' => 'eyJhbGciOiJIUzUxMiIsInR5cCI6IkpXVCJ9.eyJpZCI6IjY3MmE4NTAzNzFiZTBlY2Y1NTRkMDUxNiIsImFjY291bnRfaWQiOiI2NzJhODUwMzcxYmUwZWNmNTU0ZDA1MGMiLCJpYXQiOjE3Mzk1NDc1MjUsImV4cCI6MTczOTU1MTEyNX0.Vxz-SbPuift-7_DL_ZXYrsxJr_dTKOrch2-FYokgWlk8xgDq0g7sUNxT_emPp0eB3X4EeIrjTCAqbjZPSscn8Q',
'Content-Type' => 'application/json',
'Cookie' => 'lang=en'
));
$request->setBody('{\n "payout_id": "653aa3f22d4d6fb3c35a479a",\n "reason": "I did not get the product."\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/chargebacks');
$request->setRequestMethod('POST');
$body = new http\Message\Body;
$body->append('{
"payout_id": "653aa3f22d4d6fb3c35a479a",
"reason": "I did not get the product."
}');
$request->setBody($body);
$request->setOptions(array());
$request->setHeaders(array(
'Authorization' => 'eyJhbGciOiJIUzUxMiIsInR5cCI6IkpXVCJ9.eyJpZCI6IjY3MmE4NTAzNzFiZTBlY2Y1NTRkMDUxNiIsImFjY291bnRfaWQiOiI2NzJhODUwMzcxYmUwZWNmNTU0ZDA1MGMiLCJpYXQiOjE3Mzk1NDc1MjUsImV4cCI6MTczOTU1MTEyNX0.Vxz-SbPuift-7_DL_ZXYrsxJr_dTKOrch2-FYokgWlk8xgDq0g7sUNxT_emPp0eB3X4EeIrjTCAqbjZPSscn8Q',
'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.eyJpZCI6IjY3MmE4NTAzNzFiZTBlY2Y1NTRkMDUxNiIsImFjY291bnRfaWQiOiI2NzJhODUwMzcxYmUwZWNmNTU0ZDA1MGMiLCJpYXQiOjE3Mzk1NDc1MjUsImV4cCI6MTczOTU1MTEyNX0.Vxz-SbPuift-7_DL_ZXYrsxJr_dTKOrch2-FYokgWlk8xgDq0g7sUNxT_emPp0eB3X4EeIrjTCAqbjZPSscn8Q")
$headers.Add("Content-Type", "application/json")
$headers.Add("Cookie", "lang=en")
$body = @"
{
`"payout_id`": `"653aa3f22d4d6fb3c35a479a`",
`"reason`": `"I did not get the product.`"
}
"@
$response = Invoke-RestMethod 'https://sandbox.ecartpay.com/api/chargebacks' -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({
"payout_id": "653aa3f22d4d6fb3c35a479a",
"reason": "I did not get the product."
})
headers = {
'Authorization': 'eyJhbGciOiJIUzUxMiIsInR5cCI6IkpXVCJ9.eyJpZCI6IjY3MmE4NTAzNzFiZTBlY2Y1NTRkMDUxNiIsImFjY291bnRfaWQiOiI2NzJhODUwMzcxYmUwZWNmNTU0ZDA1MGMiLCJpYXQiOjE3Mzk1NDc1MjUsImV4cCI6MTczOTU1MTEyNX0.Vxz-SbPuift-7_DL_ZXYrsxJr_dTKOrch2-FYokgWlk8xgDq0g7sUNxT_emPp0eB3X4EeIrjTCAqbjZPSscn8Q',
'Content-Type': 'application/json',
'Cookie': 'lang=en'
}
conn.request("POST", "/api/chargebacks", payload, headers)
res = conn.getresponse()
data = res.read()
print(data.decode("utf-8"))
// -------------------------------------------------------------
# Requests
import requests
import json
url = "https://sandbox.ecartpay.com/api/chargebacks"
payload = json.dumps({
"payout_id": "653aa3f22d4d6fb3c35a479a",
"reason": "I did not get the product."
})
headers = {
'Authorization': 'eyJhbGciOiJIUzUxMiIsInR5cCI6IkpXVCJ9.eyJpZCI6IjY3MmE4NTAzNzFiZTBlY2Y1NTRkMDUxNiIsImFjY291bnRfaWQiOiI2NzJhODUwMzcxYmUwZWNmNTU0ZDA1MGMiLCJpYXQiOjE3Mzk1NDc1MjUsImV4cCI6MTczOTU1MTEyNX0.Vxz-SbPuift-7_DL_ZXYrsxJr_dTKOrch2-FYokgWlk8xgDq0g7sUNxT_emPp0eB3X4EeIrjTCAqbjZPSscn8Q',
'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.eyJpZCI6IjY3MmE4NTAzNzFiZTBlY2Y1NTRkMDUxNiIsImFjY291bnRfaWQiOiI2NzJhODUwMzcxYmUwZWNmNTU0ZDA1MGMiLCJpYXQiOjE3Mzk1NDc1MjUsImV4cCI6MTczOTU1MTEyNX0.Vxz-SbPuift-7_DL_ZXYrsxJr_dTKOrch2-FYokgWlk8xgDq0g7sUNxT_emPp0eB3X4EeIrjTCAqbjZPSscn8Q',
'Content-Type' = 'application/json',
'Cookie' = 'lang=en'
)
body = '{
"payout_id": "653aa3f22d4d6fb3c35a479a",
"reason": "I did not get the product."
}';
res <- VERB("POST", url = "https://sandbox.ecartpay.com/api/chargebacks", body = body, add_headers(headers))
cat(content(res, 'text'))
// -------------------------------------------------------------
# RCurl
library(RCurl)
headers = c(
"Authorization" = "eyJhbGciOiJIUzUxMiIsInR5cCI6IkpXVCJ9.eyJpZCI6IjY3MmE4NTAzNzFiZTBlY2Y1NTRkMDUxNiIsImFjY291bnRfaWQiOiI2NzJhODUwMzcxYmUwZWNmNTU0ZDA1MGMiLCJpYXQiOjE3Mzk1NDc1MjUsImV4cCI6MTczOTU1MTEyNX0.Vxz-SbPuift-7_DL_ZXYrsxJr_dTKOrch2-FYokgWlk8xgDq0g7sUNxT_emPp0eB3X4EeIrjTCAqbjZPSscn8Q",
"Content-Type" = "application/json",
"Cookie" = "lang=en"
)
params = "{
\"payout_id\": \"653aa3f22d4d6fb3c35a479a\",
\"reason\": \"I did not get the product.\"
}"
res <- postForm("https://sandbox.ecartpay.com/api/chargebacks", .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/chargebacks")
https = Net::HTTP.new(url.host, url.port)
https.use_ssl = true
request = Net::HTTP::Post.new(url)
request["Authorization"] = "eyJhbGciOiJIUzUxMiIsInR5cCI6IkpXVCJ9.eyJpZCI6IjY3MmE4NTAzNzFiZTBlY2Y1NTRkMDUxNiIsImFjY291bnRfaWQiOiI2NzJhODUwMzcxYmUwZWNmNTU0ZDA1MGMiLCJpYXQiOjE3Mzk1NDc1MjUsImV4cCI6MTczOTU1MTEyNX0.Vxz-SbPuift-7_DL_ZXYrsxJr_dTKOrch2-FYokgWlk8xgDq0g7sUNxT_emPp0eB3X4EeIrjTCAqbjZPSscn8Q"
request["Content-Type"] = "application/json"
request["Cookie"] = "lang=en"
request.body = JSON.dump({
"payout_id": "653aa3f22d4d6fb3c35a479a",
"reason": "I did not get the product."
})
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.eyJpZCI6IjY3MmE4NTAzNzFiZTBlY2Y1NTRkMDUxNiIsImFjY291bnRfaWQiOiI2NzJhODUwMzcxYmUwZWNmNTU0ZDA1MGMiLCJpYXQiOjE3Mzk1NDc1MjUsImV4cCI6MTczOTU1MTEyNX0.Vxz-SbPuift-7_DL_ZXYrsxJr_dTKOrch2-FYokgWlk8xgDq0g7sUNxT_emPp0eB3X4EeIrjTCAqbjZPSscn8Q".parse()?);
headers.insert("Content-Type", "application/json".parse()?);
headers.insert("Cookie", "lang=en".parse()?);
let data = r#"{
"payout_id": "653aa3f22d4d6fb3c35a479a",
"reason": "I did not get the product."
}"#;
let json: serde_json::Value = serde_json::from_str(&data)?;
let request = client.request(reqwest::Method::POST, "https://sandbox.ecartpay.com/api/chargebacks")
.headers(headers)
.json(&json);
let response = request.send().await?;
let body = response.text().await?;
println!("{}", body);
Ok(())
}
# Httpie
printf '{
"payout_id": "653aa3f22d4d6fb3c35a479a",
"reason": "I did not get the product."
}'| http --follow --timeout 3600 POST 'https://sandbox.ecartpay.com/api/chargebacks' \
Authorization:'eyJhbGciOiJIUzUxMiIsInR5cCI6IkpXVCJ9.eyJpZCI6IjY3MmE4NTAzNzFiZTBlY2Y1NTRkMDUxNiIsImFjY291bnRfaWQiOiI2NzJhODUwMzcxYmUwZWNmNTU0ZDA1MGMiLCJpYXQiOjE3Mzk1NDc1MjUsImV4cCI6MTczOTU1MTEyNX0.Vxz-SbPuift-7_DL_ZXYrsxJr_dTKOrch2-FYokgWlk8xgDq0g7sUNxT_emPp0eB3X4EeIrjTCAqbjZPSscn8Q' \
Content-Type:'application/json' \
Cookie:'lang=en'
// -------------------------------------------------------------
# wget
wget --no-check-certificate --quiet \
--method POST \
--timeout=0 \
--header 'Authorization: eyJhbGciOiJIUzUxMiIsInR5cCI6IkpXVCJ9.eyJpZCI6IjY3MmE4NTAzNzFiZTBlY2Y1NTRkMDUxNiIsImFjY291bnRfaWQiOiI2NzJhODUwMzcxYmUwZWNmNTU0ZDA1MGMiLCJpYXQiOjE3Mzk1NDc1MjUsImV4cCI6MTczOTU1MTEyNX0.Vxz-SbPuift-7_DL_ZXYrsxJr_dTKOrch2-FYokgWlk8xgDq0g7sUNxT_emPp0eB3X4EeIrjTCAqbjZPSscn8Q' \
--header 'Content-Type: application/json' \
--header 'Cookie: lang=en' \
--body-data '{
"payout_id": "653aa3f22d4d6fb3c35a479a",
"reason": "I did not get the product."
}' \
'https://sandbox.ecartpay.com/api/chargebacks'
let parameters = "{\n \"payout_id\": \"653aa3f22d4d6fb3c35a479a\",\n \"reason\": \"I did not get the product.\"\n}"
let postData = parameters.data(using: .utf8)
var request = URLRequest(url: URL(string: "https://sandbox.ecartpay.com/api/chargebacks")!,timeoutInterval: Double.infinity)
request.addValue("eyJhbGciOiJIUzUxMiIsInR5cCI6IkpXVCJ9.eyJpZCI6IjY3MmE4NTAzNzFiZTBlY2Y1NTRkMDUxNiIsImFjY291bnRfaWQiOiI2NzJhODUwMzcxYmUwZWNmNTU0ZDA1MGMiLCJpYXQiOjE3Mzk1NDc1MjUsImV4cCI6MTczOTU1MTEyNX0.Vxz-SbPuift-7_DL_ZXYrsxJr_dTKOrch2-FYokgWlk8xgDq0g7sUNxT_emPp0eB3X4EeIrjTCAqbjZPSscn8Q", 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()
Example Response
{
"transaction_id": "653aa3f42d4d6fb3c35a47ce",
"account_id": "618dac6f05dcae00168cfa2d",
"payout_id": "653aa3f22d4d6fb3c35a479a",
"gateway": "pay",
"status": "created",
"amount": 1,
"currency": "USD",
"reason": "I did not get the product.",
"created_by": "5fab3b20b40b0a613e1b6f15",
"expiration_at": "2023-11-02T18:11:46.435Z",
"documents": [],
"id": "653aabe21eded36fa9298387",
"files": [],
"created_at": "2023-10-26T18:11:46.451Z",
"updated_at": "2023-10-26T18:11:46.451Z"
}
Chargeback Flow
The chargeback process follows these steps:
- Dispute Initiation: The cardholder raises a dispute with their card issuer.
- Issuer Notification: The card issuer notifies Ecart Pay, which informs the merchant and requests supporting documentation.
- Merchant Response: The merchant submits required documentation within five calendar days.
- Issuer Review: The issuing bank reviews the provided evidence and decides the case within 45 days.
- Resolution:
- If resolved in the merchant’s favor, Ecart Pay releases the withheld funds.
- If resolved in the cardholder’s favor, Ecart Pay refunds the transaction to the cardholder through the issuer.
Information Required by Ecart Pay
To resolve a chargeback, Ecart Pay may request the following:
Parameter | Description |
---|---|
Proof of Purchase | Receipt, voucher, or sales slip. |
Invoice | A detailed invoice of the transaction. |
Customer Identification | Identification documents of the cardholder. |
Delivery Confirmation | Proof of product or service delivery. |
Additional Documentation | Any evidence supporting the merchant's case. |
Retrieving Chargebacks
Endpoint
GET {{baseURL}}/api/chargebacks
Headers
Authorization: {token}
Example Request
curl --location 'https://sandbox.ecartpay.com/api/chargebacks' \
--header 'Authorization: eyJhbGciOiJIUzUxMiIsInR5cCI6IkpXVCJ9.eyJpZCI6IjY3MmE4NTAzNzFiZTBlY2Y1NTRkMDUxNiIsImFjY291bnRfaWQiOiI2NzJhODUwMzcxYmUwZWNmNTU0ZDA1MGMiLCJpYXQiOjE3Mzk1NDc1MjUsImV4cCI6MTczOTU1MTEyNX0.Vxz-SbPuift-7_DL_ZXYrsxJr_dTKOrch2-FYokgWlk8xgDq0g7sUNxT_emPp0eB3X4EeIrjTCAqbjZPSscn8Q' \
--header 'Cookie: lang=en'
package main
import (
"fmt"
"net/http"
"io"
)
func main() {
url := "https://sandbox.ecartpay.com/api/chargebacks"
method := "GET"
client := &http.Client {
}
req, err := http.NewRequest(method, url, nil)
if err != nil {
fmt.Println(err)
return
}
req.Header.Add("Authorization", "eyJhbGciOiJIUzUxMiIsInR5cCI6IkpXVCJ9.eyJpZCI6IjY3MmE4NTAzNzFiZTBlY2Y1NTRkMDUxNiIsImFjY291bnRfaWQiOiI2NzJhODUwMzcxYmUwZWNmNTU0ZDA1MGMiLCJpYXQiOjE3Mzk1NDc1MjUsImV4cCI6MTczOTU1MTEyNX0.Vxz-SbPuift-7_DL_ZXYrsxJr_dTKOrch2-FYokgWlk8xgDq0g7sUNxT_emPp0eB3X4EeIrjTCAqbjZPSscn8Q")
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/chargebacks HTTP/1.1
Host: sandbox.ecartpay.com
Authorization: eyJhbGciOiJIUzUxMiIsInR5cCI6IkpXVCJ9.eyJpZCI6IjY3MmE4NTAzNzFiZTBlY2Y1NTRkMDUxNiIsImFjY291bnRfaWQiOiI2NzJhODUwMzcxYmUwZWNmNTU0ZDA1MGMiLCJpYXQiOjE3Mzk1NDc1MjUsImV4cCI6MTczOTU1MTEyNX0.Vxz-SbPuift-7_DL_ZXYrsxJr_dTKOrch2-FYokgWlk8xgDq0g7sUNxT_emPp0eB3X4EeIrjTCAqbjZPSscn8Q
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/chargebacks")
.method("GET", body)
.addHeader("Authorization", "eyJhbGciOiJIUzUxMiIsInR5cCI6IkpXVCJ9.eyJpZCI6IjY3MmE4NTAzNzFiZTBlY2Y1NTRkMDUxNiIsImFjY291bnRfaWQiOiI2NzJhODUwMzcxYmUwZWNmNTU0ZDA1MGMiLCJpYXQiOjE3Mzk1NDc1MjUsImV4cCI6MTczOTU1MTEyNX0.Vxz-SbPuift-7_DL_ZXYrsxJr_dTKOrch2-FYokgWlk8xgDq0g7sUNxT_emPp0eB3X4EeIrjTCAqbjZPSscn8Q")
.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/chargebacks")
.header("Authorization", "eyJhbGciOiJIUzUxMiIsInR5cCI6IkpXVCJ9.eyJpZCI6IjY3MmE4NTAzNzFiZTBlY2Y1NTRkMDUxNiIsImFjY291bnRfaWQiOiI2NzJhODUwMzcxYmUwZWNmNTU0ZDA1MGMiLCJpYXQiOjE3Mzk1NDc1MjUsImV4cCI6MTczOTU1MTEyNX0.Vxz-SbPuift-7_DL_ZXYrsxJr_dTKOrch2-FYokgWlk8xgDq0g7sUNxT_emPp0eB3X4EeIrjTCAqbjZPSscn8Q")
.header("Cookie", "lang=en")
.asString();
// Fetch
const myHeaders = new Headers();
myHeaders.append("Authorization", "eyJhbGciOiJIUzUxMiIsInR5cCI6IkpXVCJ9.eyJpZCI6IjY3MmE4NTAzNzFiZTBlY2Y1NTRkMDUxNiIsImFjY291bnRfaWQiOiI2NzJhODUwMzcxYmUwZWNmNTU0ZDA1MGMiLCJpYXQiOjE3Mzk1NDc1MjUsImV4cCI6MTczOTU1MTEyNX0.Vxz-SbPuift-7_DL_ZXYrsxJr_dTKOrch2-FYokgWlk8xgDq0g7sUNxT_emPp0eB3X4EeIrjTCAqbjZPSscn8Q");
myHeaders.append("Cookie", "lang=en");
const requestOptions = {
method: "GET",
headers: myHeaders,
redirect: "follow"
};
fetch("https://sandbox.ecartpay.com/api/chargebacks", requestOptions)
.then((response) => response.text())
.then((result) => console.log(result))
.catch((error) => console.error(error));
// -------------------------------------------------------------
// jQuery
var settings = {
"url": "https://sandbox.ecartpay.com/api/chargebacks",
"method": "GET",
"timeout": 0,
"headers": {
"Authorization": "eyJhbGciOiJIUzUxMiIsInR5cCI6IkpXVCJ9.eyJpZCI6IjY3MmE4NTAzNzFiZTBlY2Y1NTRkMDUxNiIsImFjY291bnRfaWQiOiI2NzJhODUwMzcxYmUwZWNmNTU0ZDA1MGMiLCJpYXQiOjE3Mzk1NDc1MjUsImV4cCI6MTczOTU1MTEyNX0.Vxz-SbPuift-7_DL_ZXYrsxJr_dTKOrch2-FYokgWlk8xgDq0g7sUNxT_emPp0eB3X4EeIrjTCAqbjZPSscn8Q",
"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/chargebacks");
xhr.setRequestHeader("Authorization", "eyJhbGciOiJIUzUxMiIsInR5cCI6IkpXVCJ9.eyJpZCI6IjY3MmE4NTAzNzFiZTBlY2Y1NTRkMDUxNiIsImFjY291bnRfaWQiOiI2NzJhODUwMzcxYmUwZWNmNTU0ZDA1MGMiLCJpYXQiOjE3Mzk1NDc1MjUsImV4cCI6MTczOTU1MTEyNX0.Vxz-SbPuift-7_DL_ZXYrsxJr_dTKOrch2-FYokgWlk8xgDq0g7sUNxT_emPp0eB3X4EeIrjTCAqbjZPSscn8Q");
// 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/chargebacks");
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.eyJpZCI6IjY3MmE4NTAzNzFiZTBlY2Y1NTRkMDUxNiIsImFjY291bnRfaWQiOiI2NzJhODUwMzcxYmUwZWNmNTU0ZDA1MGMiLCJpYXQiOjE3Mzk1NDc1MjUsImV4cCI6MTczOTU1MTEyNX0.Vxz-SbPuift-7_DL_ZXYrsxJr_dTKOrch2-FYokgWlk8xgDq0g7sUNxT_emPp0eB3X4EeIrjTCAqbjZPSscn8Q");
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/chargebacks',
headers: {
'Authorization': 'eyJhbGciOiJIUzUxMiIsInR5cCI6IkpXVCJ9.eyJpZCI6IjY3MmE4NTAzNzFiZTBlY2Y1NTRkMDUxNiIsImFjY291bnRfaWQiOiI2NzJhODUwMzcxYmUwZWNmNTU0ZDA1MGMiLCJpYXQiOjE3Mzk1NDc1MjUsImV4cCI6MTczOTU1MTEyNX0.Vxz-SbPuift-7_DL_ZXYrsxJr_dTKOrch2-FYokgWlk8xgDq0g7sUNxT_emPp0eB3X4EeIrjTCAqbjZPSscn8Q',
'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/chargebacks',
'headers': {
'Authorization': 'eyJhbGciOiJIUzUxMiIsInR5cCI6IkpXVCJ9.eyJpZCI6IjY3MmE4NTAzNzFiZTBlY2Y1NTRkMDUxNiIsImFjY291bnRfaWQiOiI2NzJhODUwMzcxYmUwZWNmNTU0ZDA1MGMiLCJpYXQiOjE3Mzk1NDc1MjUsImV4cCI6MTczOTU1MTEyNX0.Vxz-SbPuift-7_DL_ZXYrsxJr_dTKOrch2-FYokgWlk8xgDq0g7sUNxT_emPp0eB3X4EeIrjTCAqbjZPSscn8Q',
'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/chargebacks',
'headers': {
'Authorization': 'eyJhbGciOiJIUzUxMiIsInR5cCI6IkpXVCJ9.eyJpZCI6IjY3MmE4NTAzNzFiZTBlY2Y1NTRkMDUxNiIsImFjY291bnRfaWQiOiI2NzJhODUwMzcxYmUwZWNmNTU0ZDA1MGMiLCJpYXQiOjE3Mzk1NDc1MjUsImV4cCI6MTczOTU1MTEyNX0.Vxz-SbPuift-7_DL_ZXYrsxJr_dTKOrch2-FYokgWlk8xgDq0g7sUNxT_emPp0eB3X4EeIrjTCAqbjZPSscn8Q',
'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/chargebacks')
.headers({
'Authorization': 'eyJhbGciOiJIUzUxMiIsInR5cCI6IkpXVCJ9.eyJpZCI6IjY3MmE4NTAzNzFiZTBlY2Y1NTRkMDUxNiIsImFjY291bnRfaWQiOiI2NzJhODUwMzcxYmUwZWNmNTU0ZDA1MGMiLCJpYXQiOjE3Mzk1NDc1MjUsImV4cCI6MTczOTU1MTEyNX0.Vxz-SbPuift-7_DL_ZXYrsxJr_dTKOrch2-FYokgWlk8xgDq0g7sUNxT_emPp0eB3X4EeIrjTCAqbjZPSscn8Q',
'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/chargebacks"]
cachePolicy:NSURLRequestUseProtocolCachePolicy
timeoutInterval:10.0];
NSDictionary *headers = @{
@"Authorization": @"eyJhbGciOiJIUzUxMiIsInR5cCI6IkpXVCJ9.eyJpZCI6IjY3MmE4NTAzNzFiZTBlY2Y1NTRkMDUxNiIsImFjY291bnRfaWQiOiI2NzJhODUwMzcxYmUwZWNmNTU0ZDA1MGMiLCJpYXQiOjE3Mzk1NDc1MjUsImV4cCI6MTczOTU1MTEyNX0.Vxz-SbPuift-7_DL_ZXYrsxJr_dTKOrch2-FYokgWlk8xgDq0g7sUNxT_emPp0eB3X4EeIrjTCAqbjZPSscn8Q",
@"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/chargebacks" in
let headers = Header.init ()
|> fun h -> Header.add h "Authorization" "eyJhbGciOiJIUzUxMiIsInR5cCI6IkpXVCJ9.eyJpZCI6IjY3MmE4NTAzNzFiZTBlY2Y1NTRkMDUxNiIsImFjY291bnRfaWQiOiI2NzJhODUwMzcxYmUwZWNmNTU0ZDA1MGMiLCJpYXQiOjE3Mzk1NDc1MjUsImV4cCI6MTczOTU1MTEyNX0.Vxz-SbPuift-7_DL_ZXYrsxJr_dTKOrch2-FYokgWlk8xgDq0g7sUNxT_emPp0eB3X4EeIrjTCAqbjZPSscn8Q"
|> 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/chargebacks',
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.eyJpZCI6IjY3MmE4NTAzNzFiZTBlY2Y1NTRkMDUxNiIsImFjY291bnRfaWQiOiI2NzJhODUwMzcxYmUwZWNmNTU0ZDA1MGMiLCJpYXQiOjE3Mzk1NDc1MjUsImV4cCI6MTczOTU1MTEyNX0.Vxz-SbPuift-7_DL_ZXYrsxJr_dTKOrch2-FYokgWlk8xgDq0g7sUNxT_emPp0eB3X4EeIrjTCAqbjZPSscn8Q',
'Cookie: lang=en'
),
));
$response = curl_exec($curl);
curl_close($curl);
echo $response;
// -------------------------------------------------------------
// Guzzle
<?php
$client = new Client();
$headers = [
'Authorization' => 'eyJhbGciOiJIUzUxMiIsInR5cCI6IkpXVCJ9.eyJpZCI6IjY3MmE4NTAzNzFiZTBlY2Y1NTRkMDUxNiIsImFjY291bnRfaWQiOiI2NzJhODUwMzcxYmUwZWNmNTU0ZDA1MGMiLCJpYXQiOjE3Mzk1NDc1MjUsImV4cCI6MTczOTU1MTEyNX0.Vxz-SbPuift-7_DL_ZXYrsxJr_dTKOrch2-FYokgWlk8xgDq0g7sUNxT_emPp0eB3X4EeIrjTCAqbjZPSscn8Q',
'Cookie' => 'lang=en'
];
$request = new Request('GET', 'https://sandbox.ecartpay.com/api/chargebacks', $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/chargebacks');
$request->setMethod(HTTP_Request2::METHOD_GET);
$request->setConfig(array(
'follow_redirects' => TRUE
));
$request->setHeader(array(
'Authorization' => 'eyJhbGciOiJIUzUxMiIsInR5cCI6IkpXVCJ9.eyJpZCI6IjY3MmE4NTAzNzFiZTBlY2Y1NTRkMDUxNiIsImFjY291bnRfaWQiOiI2NzJhODUwMzcxYmUwZWNmNTU0ZDA1MGMiLCJpYXQiOjE3Mzk1NDc1MjUsImV4cCI6MTczOTU1MTEyNX0.Vxz-SbPuift-7_DL_ZXYrsxJr_dTKOrch2-FYokgWlk8xgDq0g7sUNxT_emPp0eB3X4EeIrjTCAqbjZPSscn8Q',
'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/chargebacks');
$request->setRequestMethod('GET');
$request->setOptions(array());
$request->setHeaders(array(
'Authorization' => 'eyJhbGciOiJIUzUxMiIsInR5cCI6IkpXVCJ9.eyJpZCI6IjY3MmE4NTAzNzFiZTBlY2Y1NTRkMDUxNiIsImFjY291bnRfaWQiOiI2NzJhODUwMzcxYmUwZWNmNTU0ZDA1MGMiLCJpYXQiOjE3Mzk1NDc1MjUsImV4cCI6MTczOTU1MTEyNX0.Vxz-SbPuift-7_DL_ZXYrsxJr_dTKOrch2-FYokgWlk8xgDq0g7sUNxT_emPp0eB3X4EeIrjTCAqbjZPSscn8Q',
'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.eyJpZCI6IjY3MmE4NTAzNzFiZTBlY2Y1NTRkMDUxNiIsImFjY291bnRfaWQiOiI2NzJhODUwMzcxYmUwZWNmNTU0ZDA1MGMiLCJpYXQiOjE3Mzk1NDc1MjUsImV4cCI6MTczOTU1MTEyNX0.Vxz-SbPuift-7_DL_ZXYrsxJr_dTKOrch2-FYokgWlk8xgDq0g7sUNxT_emPp0eB3X4EeIrjTCAqbjZPSscn8Q")
$headers.Add("Cookie", "lang=en")
$response = Invoke-RestMethod 'https://sandbox.ecartpay.com/api/chargebacks' -Method 'GET' -Headers $headers
$response | ConvertTo-Json
# http.client
import http.client
conn = http.client.HTTPSConnection("sandbox.ecartpay.com")
payload = ''
headers = {
'Authorization': 'eyJhbGciOiJIUzUxMiIsInR5cCI6IkpXVCJ9.eyJpZCI6IjY3MmE4NTAzNzFiZTBlY2Y1NTRkMDUxNiIsImFjY291bnRfaWQiOiI2NzJhODUwMzcxYmUwZWNmNTU0ZDA1MGMiLCJpYXQiOjE3Mzk1NDc1MjUsImV4cCI6MTczOTU1MTEyNX0.Vxz-SbPuift-7_DL_ZXYrsxJr_dTKOrch2-FYokgWlk8xgDq0g7sUNxT_emPp0eB3X4EeIrjTCAqbjZPSscn8Q',
'Cookie': 'lang=en'
}
conn.request("GET", "/api/chargebacks", payload, headers)
res = conn.getresponse()
data = res.read()
print(data.decode("utf-8"))
// -------------------------------------------------------------
# Requests
import requests
url = "https://sandbox.ecartpay.com/api/chargebacks"
payload = {}
headers = {
'Authorization': 'eyJhbGciOiJIUzUxMiIsInR5cCI6IkpXVCJ9.eyJpZCI6IjY3MmE4NTAzNzFiZTBlY2Y1NTRkMDUxNiIsImFjY291bnRfaWQiOiI2NzJhODUwMzcxYmUwZWNmNTU0ZDA1MGMiLCJpYXQiOjE3Mzk1NDc1MjUsImV4cCI6MTczOTU1MTEyNX0.Vxz-SbPuift-7_DL_ZXYrsxJr_dTKOrch2-FYokgWlk8xgDq0g7sUNxT_emPp0eB3X4EeIrjTCAqbjZPSscn8Q',
'Cookie': 'lang=en'
}
response = requests.request("GET", url, headers=headers, data=payload)
print(response.text)
# httr
library(httr)
headers = c(
'Authorization' = 'eyJhbGciOiJIUzUxMiIsInR5cCI6IkpXVCJ9.eyJpZCI6IjY3MmE4NTAzNzFiZTBlY2Y1NTRkMDUxNiIsImFjY291bnRfaWQiOiI2NzJhODUwMzcxYmUwZWNmNTU0ZDA1MGMiLCJpYXQiOjE3Mzk1NDc1MjUsImV4cCI6MTczOTU1MTEyNX0.Vxz-SbPuift-7_DL_ZXYrsxJr_dTKOrch2-FYokgWlk8xgDq0g7sUNxT_emPp0eB3X4EeIrjTCAqbjZPSscn8Q',
'Cookie' = 'lang=en'
)
res <- VERB("GET", url = "https://sandbox.ecartpay.com/api/chargebacks", add_headers(headers))
cat(content(res, 'text'))
// -------------------------------------------------------------
# RCurl
library(RCurl)
headers = c(
"Authorization" = "eyJhbGciOiJIUzUxMiIsInR5cCI6IkpXVCJ9.eyJpZCI6IjY3MmE4NTAzNzFiZTBlY2Y1NTRkMDUxNiIsImFjY291bnRfaWQiOiI2NzJhODUwMzcxYmUwZWNmNTU0ZDA1MGMiLCJpYXQiOjE3Mzk1NDc1MjUsImV4cCI6MTczOTU1MTEyNX0.Vxz-SbPuift-7_DL_ZXYrsxJr_dTKOrch2-FYokgWlk8xgDq0g7sUNxT_emPp0eB3X4EeIrjTCAqbjZPSscn8Q",
"Cookie" = "lang=en"
)
res <- getURL("https://sandbox.ecartpay.com/api/chargebacks", .opts=list(httpheader = headers, followlocation = TRUE))
cat(res)
require "uri"
require "net/http"
url = URI("https://sandbox.ecartpay.com/api/chargebacks")
https = Net::HTTP.new(url.host, url.port)
https.use_ssl = true
request = Net::HTTP::Get.new(url)
request["Authorization"] = "eyJhbGciOiJIUzUxMiIsInR5cCI6IkpXVCJ9.eyJpZCI6IjY3MmE4NTAzNzFiZTBlY2Y1NTRkMDUxNiIsImFjY291bnRfaWQiOiI2NzJhODUwMzcxYmUwZWNmNTU0ZDA1MGMiLCJpYXQiOjE3Mzk1NDc1MjUsImV4cCI6MTczOTU1MTEyNX0.Vxz-SbPuift-7_DL_ZXYrsxJr_dTKOrch2-FYokgWlk8xgDq0g7sUNxT_emPp0eB3X4EeIrjTCAqbjZPSscn8Q"
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.eyJpZCI6IjY3MmE4NTAzNzFiZTBlY2Y1NTRkMDUxNiIsImFjY291bnRfaWQiOiI2NzJhODUwMzcxYmUwZWNmNTU0ZDA1MGMiLCJpYXQiOjE3Mzk1NDc1MjUsImV4cCI6MTczOTU1MTEyNX0.Vxz-SbPuift-7_DL_ZXYrsxJr_dTKOrch2-FYokgWlk8xgDq0g7sUNxT_emPp0eB3X4EeIrjTCAqbjZPSscn8Q".parse()?);
headers.insert("Cookie", "lang=en".parse()?);
let request = client.request(reqwest::Method::GET, "https://sandbox.ecartpay.com/api/chargebacks")
.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/chargebacks' \
Authorization:'eyJhbGciOiJIUzUxMiIsInR5cCI6IkpXVCJ9.eyJpZCI6IjY3MmE4NTAzNzFiZTBlY2Y1NTRkMDUxNiIsImFjY291bnRfaWQiOiI2NzJhODUwMzcxYmUwZWNmNTU0ZDA1MGMiLCJpYXQiOjE3Mzk1NDc1MjUsImV4cCI6MTczOTU1MTEyNX0.Vxz-SbPuift-7_DL_ZXYrsxJr_dTKOrch2-FYokgWlk8xgDq0g7sUNxT_emPp0eB3X4EeIrjTCAqbjZPSscn8Q' \
Cookie:'lang=en'
// -------------------------------------------------------------
# wget
wget --no-check-certificate --quiet \
--method GET \
--timeout=0 \
--header 'Authorization: eyJhbGciOiJIUzUxMiIsInR5cCI6IkpXVCJ9.eyJpZCI6IjY3MmE4NTAzNzFiZTBlY2Y1NTRkMDUxNiIsImFjY291bnRfaWQiOiI2NzJhODUwMzcxYmUwZWNmNTU0ZDA1MGMiLCJpYXQiOjE3Mzk1NDc1MjUsImV4cCI6MTczOTU1MTEyNX0.Vxz-SbPuift-7_DL_ZXYrsxJr_dTKOrch2-FYokgWlk8xgDq0g7sUNxT_emPp0eB3X4EeIrjTCAqbjZPSscn8Q' \
--header 'Cookie: lang=en' \
'https://sandbox.ecartpay.com/api/chargebacks'
var request = URLRequest(url: URL(string: "https://sandbox.ecartpay.com/api/chargebacks")!,timeoutInterval: Double.infinity)
request.addValue("eyJhbGciOiJIUzUxMiIsInR5cCI6IkpXVCJ9.eyJpZCI6IjY3MmE4NTAzNzFiZTBlY2Y1NTRkMDUxNiIsImFjY291bnRfaWQiOiI2NzJhODUwMzcxYmUwZWNmNTU0ZDA1MGMiLCJpYXQiOjE3Mzk1NDc1MjUsImV4cCI6MTczOTU1MTEyNX0.Vxz-SbPuift-7_DL_ZXYrsxJr_dTKOrch2-FYokgWlk8xgDq0g7sUNxT_emPp0eB3X4EeIrjTCAqbjZPSscn8Q", forHTTPHeaderField: "Authorization")
request.addValue("lang=en", forHTTPHeaderField: "Cookie")
request.httpMethod = "GET"
let task = URLSession.shared.dataTask(with: request) { data, response, error in
guard let data = data else {
print(String(describing: error))
return
}
print(String(data: data, encoding: .utf8)!)
}
task.resume()
Example Response
{
"count": 1,
"docs": [
{
"id": "646275d23963944d8d8f01b0",
"amount": 500,
"status": "created",
"charge_id": "93474",
"gateway": "ecartpay",
"membership": "9031086",
"brand": "mastercard",
"currency": "MXN",
"reason": "68 - Transacci�n de orden telef�nico/correo/internet fraudulenta",
"transaction_at": "2023-04-15 05:39:00",
"expiration_at": "2023-05-02 06:00:00",
"created_at": "2023-05-15T18:11:30.839Z",
"updated_at": "2023-05-15T18:11:30.839Z",
"account_id": "5fab3b20b40b0a613e1b6f15",
"order_id": "644c4f07b8cf760e7a6ae019",
"transaction_id": "644c4f23b8cf760e7a6ae090",
"transaction": {
"id": "644c4f23b8cf760e7a6ae090",
"account_id": "5fab3b20b40b0a613e1b6f15",
"order_id": "644c4f07b8cf760e7a6ae019",
"customer_id": "5fab3b20b40b0a613e1b6f15",
"account_customer_id": "5e7a532ea09026000426b0cf",
"transaction_id": "TR42502045",
"type": "payment",
"status": "paid",
"amount": 92.46,
"fee": 7.54,
"previous": 28724.34,
"current": 28816.8,
"currency": "MXN",
"gateway": "ecartpay",
"exchange": 1,
"reference_id": "644c4f23b8cf760e7a6ae08d",
"reference": "644c4f23b8cf760e7a6ae08e",
"custom_keys": false,
"order": {
"number": "OR44468315",
"status": "paid",
"first_name": "Roberto Alejandro",
"last_name": "de la Cruz",
"email": "[email protected]",
"phone": "8123688056"
},
"charges": [
{
"status": "authorized",
"capture_id": "699900032023",
"type": "ecartpay",
"currency": "MXN",
"amount": "100.00",
"gateway": "ecartpay",
"paid_at": "28/04/2023 16:56:35",
"payment_solution": "CREDITO/BANCO EXTRANJERO/Visa",
"payment_method": {
"name": "Roberto Alejandro",
"last4": "4242",
"exp_month": "10",
"exp_year": "24"
}
}
],
"token": "5dd46c87cc83a64ec9e8a8d8dc382a633a28d538d1907a355d61bad713cb19abc64955a09c9ec00e481b6c355b41a682cf62c76ea67ba83c42d5c8e341df2a03",
"created_at": "2023-04-28T22:56:35.212Z",
"updated_at": "2023-04-28T22:56:35.581Z"
}
}
],
"pages": 1
}
Retrieve a Single Chargeback
Endpoint
GET {{baseURL}}/api/chargebacks/{{id}}
Headers
Authorization: {token}
Example Request
curl --location 'https://sandbox.ecartpay.com/api/chargebacks/5f331fb9f7480d71f16b91e9' \
--header 'Authorization: eyJhbGciOiJIUzUxMiIsInR5cCI6IkpXVCJ9.eyJpZCI6IjY3MmE4NTAzNzFiZTBlY2Y1NTRkMDUxNiIsImFjY291bnRfaWQiOiI2NzJhODUwMzcxYmUwZWNmNTU0ZDA1MGMiLCJpYXQiOjE3Mzk1NDc1MjUsImV4cCI6MTczOTU1MTEyNX0.Vxz-SbPuift-7_DL_ZXYrsxJr_dTKOrch2-FYokgWlk8xgDq0g7sUNxT_emPp0eB3X4EeIrjTCAqbjZPSscn8Q' \
--header 'Cookie: lang=en'
package main
import (
"fmt"
"net/http"
"io"
)
func main() {
url := "https://sandbox.ecartpay.com/api/chargebacks/5f331fb9f7480d71f16b91e9"
method := "GET"
client := &http.Client {
}
req, err := http.NewRequest(method, url, nil)
if err != nil {
fmt.Println(err)
return
}
req.Header.Add("Authorization", "eyJhbGciOiJIUzUxMiIsInR5cCI6IkpXVCJ9.eyJpZCI6IjY3MmE4NTAzNzFiZTBlY2Y1NTRkMDUxNiIsImFjY291bnRfaWQiOiI2NzJhODUwMzcxYmUwZWNmNTU0ZDA1MGMiLCJpYXQiOjE3Mzk1NDc1MjUsImV4cCI6MTczOTU1MTEyNX0.Vxz-SbPuift-7_DL_ZXYrsxJr_dTKOrch2-FYokgWlk8xgDq0g7sUNxT_emPp0eB3X4EeIrjTCAqbjZPSscn8Q")
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/chargebacks/5f331fb9f7480d71f16b91e9 HTTP/1.1
Host: sandbox.ecartpay.com
Authorization: eyJhbGciOiJIUzUxMiIsInR5cCI6IkpXVCJ9.eyJpZCI6IjY3MmE4NTAzNzFiZTBlY2Y1NTRkMDUxNiIsImFjY291bnRfaWQiOiI2NzJhODUwMzcxYmUwZWNmNTU0ZDA1MGMiLCJpYXQiOjE3Mzk1NDc1MjUsImV4cCI6MTczOTU1MTEyNX0.Vxz-SbPuift-7_DL_ZXYrsxJr_dTKOrch2-FYokgWlk8xgDq0g7sUNxT_emPp0eB3X4EeIrjTCAqbjZPSscn8Q
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/chargebacks/5f331fb9f7480d71f16b91e9")
.method("GET", body)
.addHeader("Authorization", "eyJhbGciOiJIUzUxMiIsInR5cCI6IkpXVCJ9.eyJpZCI6IjY3MmE4NTAzNzFiZTBlY2Y1NTRkMDUxNiIsImFjY291bnRfaWQiOiI2NzJhODUwMzcxYmUwZWNmNTU0ZDA1MGMiLCJpYXQiOjE3Mzk1NDc1MjUsImV4cCI6MTczOTU1MTEyNX0.Vxz-SbPuift-7_DL_ZXYrsxJr_dTKOrch2-FYokgWlk8xgDq0g7sUNxT_emPp0eB3X4EeIrjTCAqbjZPSscn8Q")
.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/chargebacks/5f331fb9f7480d71f16b91e9")
.header("Authorization", "eyJhbGciOiJIUzUxMiIsInR5cCI6IkpXVCJ9.eyJpZCI6IjY3MmE4NTAzNzFiZTBlY2Y1NTRkMDUxNiIsImFjY291bnRfaWQiOiI2NzJhODUwMzcxYmUwZWNmNTU0ZDA1MGMiLCJpYXQiOjE3Mzk1NDc1MjUsImV4cCI6MTczOTU1MTEyNX0.Vxz-SbPuift-7_DL_ZXYrsxJr_dTKOrch2-FYokgWlk8xgDq0g7sUNxT_emPp0eB3X4EeIrjTCAqbjZPSscn8Q")
.header("Cookie", "lang=en")
.asString();
// Fetch
const myHeaders = new Headers();
myHeaders.append("Authorization", "eyJhbGciOiJIUzUxMiIsInR5cCI6IkpXVCJ9.eyJpZCI6IjY3MmE4NTAzNzFiZTBlY2Y1NTRkMDUxNiIsImFjY291bnRfaWQiOiI2NzJhODUwMzcxYmUwZWNmNTU0ZDA1MGMiLCJpYXQiOjE3Mzk1NDc1MjUsImV4cCI6MTczOTU1MTEyNX0.Vxz-SbPuift-7_DL_ZXYrsxJr_dTKOrch2-FYokgWlk8xgDq0g7sUNxT_emPp0eB3X4EeIrjTCAqbjZPSscn8Q");
myHeaders.append("Cookie", "lang=en");
const requestOptions = {
method: "GET",
headers: myHeaders,
redirect: "follow"
};
fetch("https://sandbox.ecartpay.com/api/chargebacks/5f331fb9f7480d71f16b91e9", requestOptions)
.then((response) => response.text())
.then((result) => console.log(result))
.catch((error) => console.error(error));
// -------------------------------------------------------------
// jQuery
var settings = {
"url": "https://sandbox.ecartpay.com/api/chargebacks/5f331fb9f7480d71f16b91e9",
"method": "GET",
"timeout": 0,
"headers": {
"Authorization": "eyJhbGciOiJIUzUxMiIsInR5cCI6IkpXVCJ9.eyJpZCI6IjY3MmE4NTAzNzFiZTBlY2Y1NTRkMDUxNiIsImFjY291bnRfaWQiOiI2NzJhODUwMzcxYmUwZWNmNTU0ZDA1MGMiLCJpYXQiOjE3Mzk1NDc1MjUsImV4cCI6MTczOTU1MTEyNX0.Vxz-SbPuift-7_DL_ZXYrsxJr_dTKOrch2-FYokgWlk8xgDq0g7sUNxT_emPp0eB3X4EeIrjTCAqbjZPSscn8Q",
"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/chargebacks/5f331fb9f7480d71f16b91e9");
xhr.setRequestHeader("Authorization", "eyJhbGciOiJIUzUxMiIsInR5cCI6IkpXVCJ9.eyJpZCI6IjY3MmE4NTAzNzFiZTBlY2Y1NTRkMDUxNiIsImFjY291bnRfaWQiOiI2NzJhODUwMzcxYmUwZWNmNTU0ZDA1MGMiLCJpYXQiOjE3Mzk1NDc1MjUsImV4cCI6MTczOTU1MTEyNX0.Vxz-SbPuift-7_DL_ZXYrsxJr_dTKOrch2-FYokgWlk8xgDq0g7sUNxT_emPp0eB3X4EeIrjTCAqbjZPSscn8Q");
// 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/chargebacks/5f331fb9f7480d71f16b91e9");
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.eyJpZCI6IjY3MmE4NTAzNzFiZTBlY2Y1NTRkMDUxNiIsImFjY291bnRfaWQiOiI2NzJhODUwMzcxYmUwZWNmNTU0ZDA1MGMiLCJpYXQiOjE3Mzk1NDc1MjUsImV4cCI6MTczOTU1MTEyNX0.Vxz-SbPuift-7_DL_ZXYrsxJr_dTKOrch2-FYokgWlk8xgDq0g7sUNxT_emPp0eB3X4EeIrjTCAqbjZPSscn8Q");
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/chargebacks/5f331fb9f7480d71f16b91e9',
headers: {
'Authorization': 'eyJhbGciOiJIUzUxMiIsInR5cCI6IkpXVCJ9.eyJpZCI6IjY3MmE4NTAzNzFiZTBlY2Y1NTRkMDUxNiIsImFjY291bnRfaWQiOiI2NzJhODUwMzcxYmUwZWNmNTU0ZDA1MGMiLCJpYXQiOjE3Mzk1NDc1MjUsImV4cCI6MTczOTU1MTEyNX0.Vxz-SbPuift-7_DL_ZXYrsxJr_dTKOrch2-FYokgWlk8xgDq0g7sUNxT_emPp0eB3X4EeIrjTCAqbjZPSscn8Q',
'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/chargebacks/5f331fb9f7480d71f16b91e9',
'headers': {
'Authorization': 'eyJhbGciOiJIUzUxMiIsInR5cCI6IkpXVCJ9.eyJpZCI6IjY3MmE4NTAzNzFiZTBlY2Y1NTRkMDUxNiIsImFjY291bnRfaWQiOiI2NzJhODUwMzcxYmUwZWNmNTU0ZDA1MGMiLCJpYXQiOjE3Mzk1NDc1MjUsImV4cCI6MTczOTU1MTEyNX0.Vxz-SbPuift-7_DL_ZXYrsxJr_dTKOrch2-FYokgWlk8xgDq0g7sUNxT_emPp0eB3X4EeIrjTCAqbjZPSscn8Q',
'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/chargebacks/5f331fb9f7480d71f16b91e9',
'headers': {
'Authorization': 'eyJhbGciOiJIUzUxMiIsInR5cCI6IkpXVCJ9.eyJpZCI6IjY3MmE4NTAzNzFiZTBlY2Y1NTRkMDUxNiIsImFjY291bnRfaWQiOiI2NzJhODUwMzcxYmUwZWNmNTU0ZDA1MGMiLCJpYXQiOjE3Mzk1NDc1MjUsImV4cCI6MTczOTU1MTEyNX0.Vxz-SbPuift-7_DL_ZXYrsxJr_dTKOrch2-FYokgWlk8xgDq0g7sUNxT_emPp0eB3X4EeIrjTCAqbjZPSscn8Q',
'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/chargebacks/5f331fb9f7480d71f16b91e9')
.headers({
'Authorization': 'eyJhbGciOiJIUzUxMiIsInR5cCI6IkpXVCJ9.eyJpZCI6IjY3MmE4NTAzNzFiZTBlY2Y1NTRkMDUxNiIsImFjY291bnRfaWQiOiI2NzJhODUwMzcxYmUwZWNmNTU0ZDA1MGMiLCJpYXQiOjE3Mzk1NDc1MjUsImV4cCI6MTczOTU1MTEyNX0.Vxz-SbPuift-7_DL_ZXYrsxJr_dTKOrch2-FYokgWlk8xgDq0g7sUNxT_emPp0eB3X4EeIrjTCAqbjZPSscn8Q',
'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/chargebacks/5f331fb9f7480d71f16b91e9"]
cachePolicy:NSURLRequestUseProtocolCachePolicy
timeoutInterval:10.0];
NSDictionary *headers = @{
@"Authorization": @"eyJhbGciOiJIUzUxMiIsInR5cCI6IkpXVCJ9.eyJpZCI6IjY3MmE4NTAzNzFiZTBlY2Y1NTRkMDUxNiIsImFjY291bnRfaWQiOiI2NzJhODUwMzcxYmUwZWNmNTU0ZDA1MGMiLCJpYXQiOjE3Mzk1NDc1MjUsImV4cCI6MTczOTU1MTEyNX0.Vxz-SbPuift-7_DL_ZXYrsxJr_dTKOrch2-FYokgWlk8xgDq0g7sUNxT_emPp0eB3X4EeIrjTCAqbjZPSscn8Q",
@"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/chargebacks/5f331fb9f7480d71f16b91e9" in
let headers = Header.init ()
|> fun h -> Header.add h "Authorization" "eyJhbGciOiJIUzUxMiIsInR5cCI6IkpXVCJ9.eyJpZCI6IjY3MmE4NTAzNzFiZTBlY2Y1NTRkMDUxNiIsImFjY291bnRfaWQiOiI2NzJhODUwMzcxYmUwZWNmNTU0ZDA1MGMiLCJpYXQiOjE3Mzk1NDc1MjUsImV4cCI6MTczOTU1MTEyNX0.Vxz-SbPuift-7_DL_ZXYrsxJr_dTKOrch2-FYokgWlk8xgDq0g7sUNxT_emPp0eB3X4EeIrjTCAqbjZPSscn8Q"
|> 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/chargebacks/5f331fb9f7480d71f16b91e9',
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.eyJpZCI6IjY3MmE4NTAzNzFiZTBlY2Y1NTRkMDUxNiIsImFjY291bnRfaWQiOiI2NzJhODUwMzcxYmUwZWNmNTU0ZDA1MGMiLCJpYXQiOjE3Mzk1NDc1MjUsImV4cCI6MTczOTU1MTEyNX0.Vxz-SbPuift-7_DL_ZXYrsxJr_dTKOrch2-FYokgWlk8xgDq0g7sUNxT_emPp0eB3X4EeIrjTCAqbjZPSscn8Q',
'Cookie: lang=en'
),
));
$response = curl_exec($curl);
curl_close($curl);
echo $response;
// -------------------------------------------------------------
// Guzzle
<?php
$client = new Client();
$headers = [
'Authorization' => 'eyJhbGciOiJIUzUxMiIsInR5cCI6IkpXVCJ9.eyJpZCI6IjY3MmE4NTAzNzFiZTBlY2Y1NTRkMDUxNiIsImFjY291bnRfaWQiOiI2NzJhODUwMzcxYmUwZWNmNTU0ZDA1MGMiLCJpYXQiOjE3Mzk1NDc1MjUsImV4cCI6MTczOTU1MTEyNX0.Vxz-SbPuift-7_DL_ZXYrsxJr_dTKOrch2-FYokgWlk8xgDq0g7sUNxT_emPp0eB3X4EeIrjTCAqbjZPSscn8Q',
'Cookie' => 'lang=en'
];
$request = new Request('GET', 'https://sandbox.ecartpay.com/api/chargebacks/5f331fb9f7480d71f16b91e9', $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/chargebacks/5f331fb9f7480d71f16b91e9');
$request->setMethod(HTTP_Request2::METHOD_GET);
$request->setConfig(array(
'follow_redirects' => TRUE
));
$request->setHeader(array(
'Authorization' => 'eyJhbGciOiJIUzUxMiIsInR5cCI6IkpXVCJ9.eyJpZCI6IjY3MmE4NTAzNzFiZTBlY2Y1NTRkMDUxNiIsImFjY291bnRfaWQiOiI2NzJhODUwMzcxYmUwZWNmNTU0ZDA1MGMiLCJpYXQiOjE3Mzk1NDc1MjUsImV4cCI6MTczOTU1MTEyNX0.Vxz-SbPuift-7_DL_ZXYrsxJr_dTKOrch2-FYokgWlk8xgDq0g7sUNxT_emPp0eB3X4EeIrjTCAqbjZPSscn8Q',
'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/chargebacks/5f331fb9f7480d71f16b91e9');
$request->setRequestMethod('GET');
$request->setOptions(array());
$request->setHeaders(array(
'Authorization' => 'eyJhbGciOiJIUzUxMiIsInR5cCI6IkpXVCJ9.eyJpZCI6IjY3MmE4NTAzNzFiZTBlY2Y1NTRkMDUxNiIsImFjY291bnRfaWQiOiI2NzJhODUwMzcxYmUwZWNmNTU0ZDA1MGMiLCJpYXQiOjE3Mzk1NDc1MjUsImV4cCI6MTczOTU1MTEyNX0.Vxz-SbPuift-7_DL_ZXYrsxJr_dTKOrch2-FYokgWlk8xgDq0g7sUNxT_emPp0eB3X4EeIrjTCAqbjZPSscn8Q',
'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.eyJpZCI6IjY3MmE4NTAzNzFiZTBlY2Y1NTRkMDUxNiIsImFjY291bnRfaWQiOiI2NzJhODUwMzcxYmUwZWNmNTU0ZDA1MGMiLCJpYXQiOjE3Mzk1NDc1MjUsImV4cCI6MTczOTU1MTEyNX0.Vxz-SbPuift-7_DL_ZXYrsxJr_dTKOrch2-FYokgWlk8xgDq0g7sUNxT_emPp0eB3X4EeIrjTCAqbjZPSscn8Q")
$headers.Add("Cookie", "lang=en")
$response = Invoke-RestMethod 'https://sandbox.ecartpay.com/api/chargebacks/5f331fb9f7480d71f16b91e9' -Method 'GET' -Headers $headers
$response | ConvertTo-Json
# http.client
import http.client
conn = http.client.HTTPSConnection("sandbox.ecartpay.com")
payload = ''
headers = {
'Authorization': 'eyJhbGciOiJIUzUxMiIsInR5cCI6IkpXVCJ9.eyJpZCI6IjY3MmE4NTAzNzFiZTBlY2Y1NTRkMDUxNiIsImFjY291bnRfaWQiOiI2NzJhODUwMzcxYmUwZWNmNTU0ZDA1MGMiLCJpYXQiOjE3Mzk1NDc1MjUsImV4cCI6MTczOTU1MTEyNX0.Vxz-SbPuift-7_DL_ZXYrsxJr_dTKOrch2-FYokgWlk8xgDq0g7sUNxT_emPp0eB3X4EeIrjTCAqbjZPSscn8Q',
'Cookie': 'lang=en'
}
conn.request("GET", "/api/chargebacks/5f331fb9f7480d71f16b91e9", payload, headers)
res = conn.getresponse()
data = res.read()
print(data.decode("utf-8"))
// -------------------------------------------------------------
# Requests
import requests
url = "https://sandbox.ecartpay.com/api/chargebacks/5f331fb9f7480d71f16b91e9"
payload = {}
headers = {
'Authorization': 'eyJhbGciOiJIUzUxMiIsInR5cCI6IkpXVCJ9.eyJpZCI6IjY3MmE4NTAzNzFiZTBlY2Y1NTRkMDUxNiIsImFjY291bnRfaWQiOiI2NzJhODUwMzcxYmUwZWNmNTU0ZDA1MGMiLCJpYXQiOjE3Mzk1NDc1MjUsImV4cCI6MTczOTU1MTEyNX0.Vxz-SbPuift-7_DL_ZXYrsxJr_dTKOrch2-FYokgWlk8xgDq0g7sUNxT_emPp0eB3X4EeIrjTCAqbjZPSscn8Q',
'Cookie': 'lang=en'
}
response = requests.request("GET", url, headers=headers, data=payload)
print(response.text)
# httr
library(httr)
headers = c(
'Authorization' = 'eyJhbGciOiJIUzUxMiIsInR5cCI6IkpXVCJ9.eyJpZCI6IjY3MmE4NTAzNzFiZTBlY2Y1NTRkMDUxNiIsImFjY291bnRfaWQiOiI2NzJhODUwMzcxYmUwZWNmNTU0ZDA1MGMiLCJpYXQiOjE3Mzk1NDc1MjUsImV4cCI6MTczOTU1MTEyNX0.Vxz-SbPuift-7_DL_ZXYrsxJr_dTKOrch2-FYokgWlk8xgDq0g7sUNxT_emPp0eB3X4EeIrjTCAqbjZPSscn8Q',
'Cookie' = 'lang=en'
)
res <- VERB("GET", url = "https://sandbox.ecartpay.com/api/chargebacks/5f331fb9f7480d71f16b91e9", add_headers(headers))
cat(content(res, 'text'))
// -------------------------------------------------------------
# RCurl
library(RCurl)
headers = c(
"Authorization" = "eyJhbGciOiJIUzUxMiIsInR5cCI6IkpXVCJ9.eyJpZCI6IjY3MmE4NTAzNzFiZTBlY2Y1NTRkMDUxNiIsImFjY291bnRfaWQiOiI2NzJhODUwMzcxYmUwZWNmNTU0ZDA1MGMiLCJpYXQiOjE3Mzk1NDc1MjUsImV4cCI6MTczOTU1MTEyNX0.Vxz-SbPuift-7_DL_ZXYrsxJr_dTKOrch2-FYokgWlk8xgDq0g7sUNxT_emPp0eB3X4EeIrjTCAqbjZPSscn8Q",
"Cookie" = "lang=en"
)
res <- getURL("https://sandbox.ecartpay.com/api/chargebacks/5f331fb9f7480d71f16b91e9", .opts=list(httpheader = headers, followlocation = TRUE))
cat(res)
require "uri"
require "net/http"
url = URI("https://sandbox.ecartpay.com/api/chargebacks/5f331fb9f7480d71f16b91e9")
https = Net::HTTP.new(url.host, url.port)
https.use_ssl = true
request = Net::HTTP::Get.new(url)
request["Authorization"] = "eyJhbGciOiJIUzUxMiIsInR5cCI6IkpXVCJ9.eyJpZCI6IjY3MmE4NTAzNzFiZTBlY2Y1NTRkMDUxNiIsImFjY291bnRfaWQiOiI2NzJhODUwMzcxYmUwZWNmNTU0ZDA1MGMiLCJpYXQiOjE3Mzk1NDc1MjUsImV4cCI6MTczOTU1MTEyNX0.Vxz-SbPuift-7_DL_ZXYrsxJr_dTKOrch2-FYokgWlk8xgDq0g7sUNxT_emPp0eB3X4EeIrjTCAqbjZPSscn8Q"
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.eyJpZCI6IjY3MmE4NTAzNzFiZTBlY2Y1NTRkMDUxNiIsImFjY291bnRfaWQiOiI2NzJhODUwMzcxYmUwZWNmNTU0ZDA1MGMiLCJpYXQiOjE3Mzk1NDc1MjUsImV4cCI6MTczOTU1MTEyNX0.Vxz-SbPuift-7_DL_ZXYrsxJr_dTKOrch2-FYokgWlk8xgDq0g7sUNxT_emPp0eB3X4EeIrjTCAqbjZPSscn8Q".parse()?);
headers.insert("Cookie", "lang=en".parse()?);
let request = client.request(reqwest::Method::GET, "https://sandbox.ecartpay.com/api/chargebacks/5f331fb9f7480d71f16b91e9")
.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/chargebacks/5f331fb9f7480d71f16b91e9' \
Authorization:'eyJhbGciOiJIUzUxMiIsInR5cCI6IkpXVCJ9.eyJpZCI6IjY3MmE4NTAzNzFiZTBlY2Y1NTRkMDUxNiIsImFjY291bnRfaWQiOiI2NzJhODUwMzcxYmUwZWNmNTU0ZDA1MGMiLCJpYXQiOjE3Mzk1NDc1MjUsImV4cCI6MTczOTU1MTEyNX0.Vxz-SbPuift-7_DL_ZXYrsxJr_dTKOrch2-FYokgWlk8xgDq0g7sUNxT_emPp0eB3X4EeIrjTCAqbjZPSscn8Q' \
Cookie:'lang=en'
// -------------------------------------------------------------
# wget
wget --no-check-certificate --quiet \
--method GET \
--timeout=0 \
--header 'Authorization: eyJhbGciOiJIUzUxMiIsInR5cCI6IkpXVCJ9.eyJpZCI6IjY3MmE4NTAzNzFiZTBlY2Y1NTRkMDUxNiIsImFjY291bnRfaWQiOiI2NzJhODUwMzcxYmUwZWNmNTU0ZDA1MGMiLCJpYXQiOjE3Mzk1NDc1MjUsImV4cCI6MTczOTU1MTEyNX0.Vxz-SbPuift-7_DL_ZXYrsxJr_dTKOrch2-FYokgWlk8xgDq0g7sUNxT_emPp0eB3X4EeIrjTCAqbjZPSscn8Q' \
--header 'Cookie: lang=en' \
'https://sandbox.ecartpay.com/api/chargebacks/5f331fb9f7480d71f16b91e9'
var request = URLRequest(url: URL(string: "https://sandbox.ecartpay.com/api/chargebacks/5f331fb9f7480d71f16b91e9")!,timeoutInterval: Double.infinity)
request.addValue("eyJhbGciOiJIUzUxMiIsInR5cCI6IkpXVCJ9.eyJpZCI6IjY3MmE4NTAzNzFiZTBlY2Y1NTRkMDUxNiIsImFjY291bnRfaWQiOiI2NzJhODUwMzcxYmUwZWNmNTU0ZDA1MGMiLCJpYXQiOjE3Mzk1NDc1MjUsImV4cCI6MTczOTU1MTEyNX0.Vxz-SbPuift-7_DL_ZXYrsxJr_dTKOrch2-FYokgWlk8xgDq0g7sUNxT_emPp0eB3X4EeIrjTCAqbjZPSscn8Q", 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": "646275d23963944d8d8f01b0",
"amount": 500,
"status": "created",
"charge_id": "93474",
"gateway": "ecartpay",
"membership": "9031086",
"brand": "mastercard",
"currency": "MXN",
"reason": "68 - Transacci�n de orden telef�nico/correo/internet fraudulenta",
"transaction_at": "2023-04-15 05:39:00",
"expiration_at": "2023-05-02 06:00:00",
"created_at": "2023-05-15T18:11:30.839Z",
"updated_at": "2023-05-15T18:11:30.839Z",
"account_id": "5fab3b20b40b0a613e1b6f15",
"order_id": "644c4f07b8cf760e7a6ae019",
"transaction_id": "644c4f23b8cf760e7a6ae090",
"transaction": {
"id": "644c4f23b8cf760e7a6ae090",
"account_id": "5fab3b20b40b0a613e1b6f15",
"order_id": "644c4f07b8cf760e7a6ae019",
"customer_id": "5fab3b20b40b0a613e1b6f15",
"account_customer_id": "5e7a532ea09026000426b0cf",
"transaction_id": "TR42502045",
"type": "payment",
"status": "paid",
"amount": 92.46,
"fee": 7.54,
"previous": 28724.34,
"current": 28816.8,
"currency": "MXN",
"gateway": "ecartpay",
"exchange": 1,
"reference_id": "644c4f23b8cf760e7a6ae08d",
"reference": "644c4f23b8cf760e7a6ae08e",
"custom_keys": false,
"order": {
"number": "OR44468315",
"status": "paid",
"first_name": "Roberto Alejandro",
"last_name": "de la Cruz",
"email": "[email protected]",
"phone": "8123688056"
},
"charges": [
{
"status": "authorized",
"capture_id": "699900032023",
"type": "ecartpay",
"currency": "MXN",
"amount": "100.00",
"gateway": "ecartpay",
"paid_at": "28/04/2023 16:56:35",
"payment_solution": "CREDITO/BANCO EXTRANJERO/Visa",
"payment_method": {
"name": "Roberto Alejandro",
"last4": "4242",
"exp_month": "10",
"exp_year": "24"
}
}
],
"token": "5dd46c87cc83a64ec9e8a8d8dc382a633a28d538d1907a355d61bad713cb19abc64955a09c9ec00e481b6c355b41a682cf62c76ea67ba83c42d5c8e341df2a03",
"created_at": "2023-04-28T22:56:35.212Z",
"updated_at": "2023-04-28T22:56:35.581Z"
}
}
Chargebacks Status Update
Update Chargeback
Endpoint
PUT {{baseURL}}/api/chargebacks/{{id}}
Headers
Authorization: {token}
Body Request
{
"status": "in_review"
}
Example Request
curl --location --request PUT 'https://sandbox.ecartpay.com/api/chargebacks/5f331fb9f7480d71f16b91e9' \
--header 'Authorization: eyJhbGciOiJIUzUxMiIsInR5cCI6IkpXVCJ9.eyJpZCI6IjY3MmE4NTAzNzFiZTBlY2Y1NTRkMDUxNiIsImFjY291bnRfaWQiOiI2NzJhODUwMzcxYmUwZWNmNTU0ZDA1MGMiLCJpYXQiOjE3Mzk1NDc1MjUsImV4cCI6MTczOTU1MTEyNX0.Vxz-SbPuift-7_DL_ZXYrsxJr_dTKOrch2-FYokgWlk8xgDq0g7sUNxT_emPp0eB3X4EeIrjTCAqbjZPSscn8Q' \
--header 'Content-Type: application/json' \
--header 'Cookie: lang=en' \
--data '{
"status": "in_review"
}'
package main
import (
"fmt"
"strings"
"net/http"
"io"
)
func main() {
url := "https://sandbox.ecartpay.com/api/chargebacks/5f331fb9f7480d71f16b91e9"
method := "PUT"
payload := strings.NewReader(`{
"status": "in_review"
}`)
client := &http.Client {
}
req, err := http.NewRequest(method, url, payload)
if err != nil {
fmt.Println(err)
return
}
req.Header.Add("Authorization", "eyJhbGciOiJIUzUxMiIsInR5cCI6IkpXVCJ9.eyJpZCI6IjY3MmE4NTAzNzFiZTBlY2Y1NTRkMDUxNiIsImFjY291bnRfaWQiOiI2NzJhODUwMzcxYmUwZWNmNTU0ZDA1MGMiLCJpYXQiOjE3Mzk1NDc1MjUsImV4cCI6MTczOTU1MTEyNX0.Vxz-SbPuift-7_DL_ZXYrsxJr_dTKOrch2-FYokgWlk8xgDq0g7sUNxT_emPp0eB3X4EeIrjTCAqbjZPSscn8Q")
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))
}
PUT /api/chargebacks/5f331fb9f7480d71f16b91e9 HTTP/1.1
Host: sandbox.ecartpay.com
Authorization: eyJhbGciOiJIUzUxMiIsInR5cCI6IkpXVCJ9.eyJpZCI6IjY3MmE4NTAzNzFiZTBlY2Y1NTRkMDUxNiIsImFjY291bnRfaWQiOiI2NzJhODUwMzcxYmUwZWNmNTU0ZDA1MGMiLCJpYXQiOjE3Mzk1NDc1MjUsImV4cCI6MTczOTU1MTEyNX0.Vxz-SbPuift-7_DL_ZXYrsxJr_dTKOrch2-FYokgWlk8xgDq0g7sUNxT_emPp0eB3X4EeIrjTCAqbjZPSscn8Q
Content-Type: application/json
Cookie: lang=en
Content-Length: 29
{
"status": "in_review"
}
// OkHttp
OkHttpClient client = new OkHttpClient().newBuilder()
.build();
MediaType mediaType = MediaType.parse("application/json");
RequestBody body = RequestBody.create(mediaType, "{\n \"status\": \"in_review\"\n}");
Request request = new Request.Builder()
.url("https://sandbox.ecartpay.com/api/chargebacks/5f331fb9f7480d71f16b91e9")
.method("PUT", body)
.addHeader("Authorization", "eyJhbGciOiJIUzUxMiIsInR5cCI6IkpXVCJ9.eyJpZCI6IjY3MmE4NTAzNzFiZTBlY2Y1NTRkMDUxNiIsImFjY291bnRfaWQiOiI2NzJhODUwMzcxYmUwZWNmNTU0ZDA1MGMiLCJpYXQiOjE3Mzk1NDc1MjUsImV4cCI6MTczOTU1MTEyNX0.Vxz-SbPuift-7_DL_ZXYrsxJr_dTKOrch2-FYokgWlk8xgDq0g7sUNxT_emPp0eB3X4EeIrjTCAqbjZPSscn8Q")
.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.put("https://sandbox.ecartpay.com/api/chargebacks/5f331fb9f7480d71f16b91e9")
.header("Authorization", "eyJhbGciOiJIUzUxMiIsInR5cCI6IkpXVCJ9.eyJpZCI6IjY3MmE4NTAzNzFiZTBlY2Y1NTRkMDUxNiIsImFjY291bnRfaWQiOiI2NzJhODUwMzcxYmUwZWNmNTU0ZDA1MGMiLCJpYXQiOjE3Mzk1NDc1MjUsImV4cCI6MTczOTU1MTEyNX0.Vxz-SbPuift-7_DL_ZXYrsxJr_dTKOrch2-FYokgWlk8xgDq0g7sUNxT_emPp0eB3X4EeIrjTCAqbjZPSscn8Q")
.header("Content-Type", "application/json")
.header("Cookie", "lang=en")
.body("{\n \"status\": \"in_review\"\n}")
.asString();
// Fetch
const myHeaders = new Headers();
myHeaders.append("Authorization", "eyJhbGciOiJIUzUxMiIsInR5cCI6IkpXVCJ9.eyJpZCI6IjY3MmE4NTAzNzFiZTBlY2Y1NTRkMDUxNiIsImFjY291bnRfaWQiOiI2NzJhODUwMzcxYmUwZWNmNTU0ZDA1MGMiLCJpYXQiOjE3Mzk1NDc1MjUsImV4cCI6MTczOTU1MTEyNX0.Vxz-SbPuift-7_DL_ZXYrsxJr_dTKOrch2-FYokgWlk8xgDq0g7sUNxT_emPp0eB3X4EeIrjTCAqbjZPSscn8Q");
myHeaders.append("Content-Type", "application/json");
myHeaders.append("Cookie", "lang=en");
const raw = JSON.stringify({
"status": "in_review"
});
const requestOptions = {
method: "PUT",
headers: myHeaders,
body: raw,
redirect: "follow"
};
fetch("https://sandbox.ecartpay.com/api/chargebacks/5f331fb9f7480d71f16b91e9", requestOptions)
.then((response) => response.text())
.then((result) => console.log(result))
.catch((error) => console.error(error));
// -------------------------------------------------------------
// jQuery
var settings = {
"url": "https://sandbox.ecartpay.com/api/chargebacks/5f331fb9f7480d71f16b91e9",
"method": "PUT",
"timeout": 0,
"headers": {
"Authorization": "eyJhbGciOiJIUzUxMiIsInR5cCI6IkpXVCJ9.eyJpZCI6IjY3MmE4NTAzNzFiZTBlY2Y1NTRkMDUxNiIsImFjY291bnRfaWQiOiI2NzJhODUwMzcxYmUwZWNmNTU0ZDA1MGMiLCJpYXQiOjE3Mzk1NDc1MjUsImV4cCI6MTczOTU1MTEyNX0.Vxz-SbPuift-7_DL_ZXYrsxJr_dTKOrch2-FYokgWlk8xgDq0g7sUNxT_emPp0eB3X4EeIrjTCAqbjZPSscn8Q",
"Content-Type": "application/json",
"Cookie": "lang=en"
},
"data": JSON.stringify({
"status": "in_review"
}),
};
$.ajax(settings).done(function (response) {
console.log(response);
});
// -------------------------------------------------------------
// XHR
var data = JSON.stringify({
"status": "in_review"
});
var xhr = new XMLHttpRequest();
xhr.withCredentials = true;
xhr.addEventListener("readystatechange", function() {
if(this.readyState === 4) {
console.log(this.responseText);
}
});
xhr.open("PUT", "https://sandbox.ecartpay.com/api/chargebacks/5f331fb9f7480d71f16b91e9");
xhr.setRequestHeader("Authorization", "eyJhbGciOiJIUzUxMiIsInR5cCI6IkpXVCJ9.eyJpZCI6IjY3MmE4NTAzNzFiZTBlY2Y1NTRkMDUxNiIsImFjY291bnRfaWQiOiI2NzJhODUwMzcxYmUwZWNmNTU0ZDA1MGMiLCJpYXQiOjE3Mzk1NDc1MjUsImV4cCI6MTczOTU1MTEyNX0.Vxz-SbPuift-7_DL_ZXYrsxJr_dTKOrch2-FYokgWlk8xgDq0g7sUNxT_emPp0eB3X4EeIrjTCAqbjZPSscn8Q");
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, "PUT");
curl_easy_setopt(curl, CURLOPT_URL, "https://sandbox.ecartpay.com/api/chargebacks/5f331fb9f7480d71f16b91e9");
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.eyJpZCI6IjY3MmE4NTAzNzFiZTBlY2Y1NTRkMDUxNiIsImFjY291bnRfaWQiOiI2NzJhODUwMzcxYmUwZWNmNTU0ZDA1MGMiLCJpYXQiOjE3Mzk1NDc1MjUsImV4cCI6MTczOTU1MTEyNX0.Vxz-SbPuift-7_DL_ZXYrsxJr_dTKOrch2-FYokgWlk8xgDq0g7sUNxT_emPp0eB3X4EeIrjTCAqbjZPSscn8Q");
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 = "{\n \"status\": \"in_review\"\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({
"status": "in_review"
});
let config = {
method: 'put',
maxBodyLength: Infinity,
url: 'https://sandbox.ecartpay.com/api/chargebacks/5f331fb9f7480d71f16b91e9',
headers: {
'Authorization': 'eyJhbGciOiJIUzUxMiIsInR5cCI6IkpXVCJ9.eyJpZCI6IjY3MmE4NTAzNzFiZTBlY2Y1NTRkMDUxNiIsImFjY291bnRfaWQiOiI2NzJhODUwMzcxYmUwZWNmNTU0ZDA1MGMiLCJpYXQiOjE3Mzk1NDc1MjUsImV4cCI6MTczOTU1MTEyNX0.Vxz-SbPuift-7_DL_ZXYrsxJr_dTKOrch2-FYokgWlk8xgDq0g7sUNxT_emPp0eB3X4EeIrjTCAqbjZPSscn8Q',
'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': 'PUT',
'hostname': 'sandbox.ecartpay.com',
'path': '/api/chargebacks/5f331fb9f7480d71f16b91e9',
'headers': {
'Authorization': 'eyJhbGciOiJIUzUxMiIsInR5cCI6IkpXVCJ9.eyJpZCI6IjY3MmE4NTAzNzFiZTBlY2Y1NTRkMDUxNiIsImFjY291bnRfaWQiOiI2NzJhODUwMzcxYmUwZWNmNTU0ZDA1MGMiLCJpYXQiOjE3Mzk1NDc1MjUsImV4cCI6MTczOTU1MTEyNX0.Vxz-SbPuift-7_DL_ZXYrsxJr_dTKOrch2-FYokgWlk8xgDq0g7sUNxT_emPp0eB3X4EeIrjTCAqbjZPSscn8Q',
'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({
"status": "in_review"
});
req.write(postData);
req.end();
// -------------------------------------------------------------
// Request
var request = require('request');
var options = {
'method': 'PUT',
'url': 'https://sandbox.ecartpay.com/api/chargebacks/5f331fb9f7480d71f16b91e9',
'headers': {
'Authorization': 'eyJhbGciOiJIUzUxMiIsInR5cCI6IkpXVCJ9.eyJpZCI6IjY3MmE4NTAzNzFiZTBlY2Y1NTRkMDUxNiIsImFjY291bnRfaWQiOiI2NzJhODUwMzcxYmUwZWNmNTU0ZDA1MGMiLCJpYXQiOjE3Mzk1NDc1MjUsImV4cCI6MTczOTU1MTEyNX0.Vxz-SbPuift-7_DL_ZXYrsxJr_dTKOrch2-FYokgWlk8xgDq0g7sUNxT_emPp0eB3X4EeIrjTCAqbjZPSscn8Q',
'Content-Type': 'application/json',
'Cookie': 'lang=en'
},
body: JSON.stringify({
"status": "in_review"
})
};
request(options, function (error, response) {
if (error) throw new Error(error);
console.log(response.body);
});
// -------------------------------------------------------------
// Unirest
var unirest = require('unirest');
var req = unirest('PUT', 'https://sandbox.ecartpay.com/api/chargebacks/5f331fb9f7480d71f16b91e9')
.headers({
'Authorization': 'eyJhbGciOiJIUzUxMiIsInR5cCI6IkpXVCJ9.eyJpZCI6IjY3MmE4NTAzNzFiZTBlY2Y1NTRkMDUxNiIsImFjY291bnRfaWQiOiI2NzJhODUwMzcxYmUwZWNmNTU0ZDA1MGMiLCJpYXQiOjE3Mzk1NDc1MjUsImV4cCI6MTczOTU1MTEyNX0.Vxz-SbPuift-7_DL_ZXYrsxJr_dTKOrch2-FYokgWlk8xgDq0g7sUNxT_emPp0eB3X4EeIrjTCAqbjZPSscn8Q',
'Content-Type': 'application/json',
'Cookie': 'lang=en'
})
.send(JSON.stringify({
"status": "in_review"
}))
.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/chargebacks/5f331fb9f7480d71f16b91e9"]
cachePolicy:NSURLRequestUseProtocolCachePolicy
timeoutInterval:10.0];
NSDictionary *headers = @{
@"Authorization": @"eyJhbGciOiJIUzUxMiIsInR5cCI6IkpXVCJ9.eyJpZCI6IjY3MmE4NTAzNzFiZTBlY2Y1NTRkMDUxNiIsImFjY291bnRfaWQiOiI2NzJhODUwMzcxYmUwZWNmNTU0ZDA1MGMiLCJpYXQiOjE3Mzk1NDc1MjUsImV4cCI6MTczOTU1MTEyNX0.Vxz-SbPuift-7_DL_ZXYrsxJr_dTKOrch2-FYokgWlk8xgDq0g7sUNxT_emPp0eB3X4EeIrjTCAqbjZPSscn8Q",
@"Content-Type": @"application/json",
@"Cookie": @"lang=en"
};
[request setAllHTTPHeaderFields:headers];
NSData *postData = [[NSData alloc] initWithData:[@"{\n \"status\": \"in_review\"\n}" dataUsingEncoding:NSUTF8StringEncoding]];
[request setHTTPBody:postData];
[request setHTTPMethod:@"PUT"];
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 "{\n \"status\": \"in_review\"\n}";;
let reqBody =
let uri = Uri.of_string "https://sandbox.ecartpay.com/api/chargebacks/5f331fb9f7480d71f16b91e9" in
let headers = Header.init ()
|> fun h -> Header.add h "Authorization" "eyJhbGciOiJIUzUxMiIsInR5cCI6IkpXVCJ9.eyJpZCI6IjY3MmE4NTAzNzFiZTBlY2Y1NTRkMDUxNiIsImFjY291bnRfaWQiOiI2NzJhODUwMzcxYmUwZWNmNTU0ZDA1MGMiLCJpYXQiOjE3Mzk1NDc1MjUsImV4cCI6MTczOTU1MTEyNX0.Vxz-SbPuift-7_DL_ZXYrsxJr_dTKOrch2-FYokgWlk8xgDq0g7sUNxT_emPp0eB3X4EeIrjTCAqbjZPSscn8Q"
|> 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 `PUT 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/chargebacks/5f331fb9f7480d71f16b91e9',
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => '',
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 0,
CURLOPT_FOLLOWLOCATION => true,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => 'PUT',
CURLOPT_POSTFIELDS =>'{
"status": "in_review"
}',
CURLOPT_HTTPHEADER => array(
'Authorization: eyJhbGciOiJIUzUxMiIsInR5cCI6IkpXVCJ9.eyJpZCI6IjY3MmE4NTAzNzFiZTBlY2Y1NTRkMDUxNiIsImFjY291bnRfaWQiOiI2NzJhODUwMzcxYmUwZWNmNTU0ZDA1MGMiLCJpYXQiOjE3Mzk1NDc1MjUsImV4cCI6MTczOTU1MTEyNX0.Vxz-SbPuift-7_DL_ZXYrsxJr_dTKOrch2-FYokgWlk8xgDq0g7sUNxT_emPp0eB3X4EeIrjTCAqbjZPSscn8Q',
'Content-Type: application/json',
'Cookie: lang=en'
),
));
$response = curl_exec($curl);
curl_close($curl);
echo $response;
// -------------------------------------------------------------
// Guzzle
<?php
$client = new Client();
$headers = [
'Authorization' => 'eyJhbGciOiJIUzUxMiIsInR5cCI6IkpXVCJ9.eyJpZCI6IjY3MmE4NTAzNzFiZTBlY2Y1NTRkMDUxNiIsImFjY291bnRfaWQiOiI2NzJhODUwMzcxYmUwZWNmNTU0ZDA1MGMiLCJpYXQiOjE3Mzk1NDc1MjUsImV4cCI6MTczOTU1MTEyNX0.Vxz-SbPuift-7_DL_ZXYrsxJr_dTKOrch2-FYokgWlk8xgDq0g7sUNxT_emPp0eB3X4EeIrjTCAqbjZPSscn8Q',
'Content-Type' => 'application/json',
'Cookie' => 'lang=en'
];
$body = '{
"status": "in_review"
}';
$request = new Request('PUT', 'https://sandbox.ecartpay.com/api/chargebacks/5f331fb9f7480d71f16b91e9', $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/chargebacks/5f331fb9f7480d71f16b91e9');
$request->setMethod(HTTP_Request2::METHOD_PUT);
$request->setConfig(array(
'follow_redirects' => TRUE
));
$request->setHeader(array(
'Authorization' => 'eyJhbGciOiJIUzUxMiIsInR5cCI6IkpXVCJ9.eyJpZCI6IjY3MmE4NTAzNzFiZTBlY2Y1NTRkMDUxNiIsImFjY291bnRfaWQiOiI2NzJhODUwMzcxYmUwZWNmNTU0ZDA1MGMiLCJpYXQiOjE3Mzk1NDc1MjUsImV4cCI6MTczOTU1MTEyNX0.Vxz-SbPuift-7_DL_ZXYrsxJr_dTKOrch2-FYokgWlk8xgDq0g7sUNxT_emPp0eB3X4EeIrjTCAqbjZPSscn8Q',
'Content-Type' => 'application/json',
'Cookie' => 'lang=en'
));
$request->setBody('{\n "status": "in_review"\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/chargebacks/5f331fb9f7480d71f16b91e9');
$request->setRequestMethod('PUT');
$body = new http\Message\Body;
$body->append('{
"status": "in_review"
}');
$request->setBody($body);
$request->setOptions(array());
$request->setHeaders(array(
'Authorization' => 'eyJhbGciOiJIUzUxMiIsInR5cCI6IkpXVCJ9.eyJpZCI6IjY3MmE4NTAzNzFiZTBlY2Y1NTRkMDUxNiIsImFjY291bnRfaWQiOiI2NzJhODUwMzcxYmUwZWNmNTU0ZDA1MGMiLCJpYXQiOjE3Mzk1NDc1MjUsImV4cCI6MTczOTU1MTEyNX0.Vxz-SbPuift-7_DL_ZXYrsxJr_dTKOrch2-FYokgWlk8xgDq0g7sUNxT_emPp0eB3X4EeIrjTCAqbjZPSscn8Q',
'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.eyJpZCI6IjY3MmE4NTAzNzFiZTBlY2Y1NTRkMDUxNiIsImFjY291bnRfaWQiOiI2NzJhODUwMzcxYmUwZWNmNTU0ZDA1MGMiLCJpYXQiOjE3Mzk1NDc1MjUsImV4cCI6MTczOTU1MTEyNX0.Vxz-SbPuift-7_DL_ZXYrsxJr_dTKOrch2-FYokgWlk8xgDq0g7sUNxT_emPp0eB3X4EeIrjTCAqbjZPSscn8Q")
$headers.Add("Content-Type", "application/json")
$headers.Add("Cookie", "lang=en")
$body = @"
{
`"status`": `"in_review`"
}
"@
$response = Invoke-RestMethod 'https://sandbox.ecartpay.com/api/chargebacks/5f331fb9f7480d71f16b91e9' -Method 'PUT' -Headers $headers -Body $body
$response | ConvertTo-Json
# http.client
import http.client
import json
conn = http.client.HTTPSConnection("sandbox.ecartpay.com")
payload = json.dumps({
"status": "in_review"
})
headers = {
'Authorization': 'eyJhbGciOiJIUzUxMiIsInR5cCI6IkpXVCJ9.eyJpZCI6IjY3MmE4NTAzNzFiZTBlY2Y1NTRkMDUxNiIsImFjY291bnRfaWQiOiI2NzJhODUwMzcxYmUwZWNmNTU0ZDA1MGMiLCJpYXQiOjE3Mzk1NDc1MjUsImV4cCI6MTczOTU1MTEyNX0.Vxz-SbPuift-7_DL_ZXYrsxJr_dTKOrch2-FYokgWlk8xgDq0g7sUNxT_emPp0eB3X4EeIrjTCAqbjZPSscn8Q',
'Content-Type': 'application/json',
'Cookie': 'lang=en'
}
conn.request("PUT", "/api/chargebacks/5f331fb9f7480d71f16b91e9", payload, headers)
res = conn.getresponse()
data = res.read()
print(data.decode("utf-8"))
// -------------------------------------------------------------
# Requests
import requests
import json
url = "https://sandbox.ecartpay.com/api/chargebacks/5f331fb9f7480d71f16b91e9"
payload = json.dumps({
"status": "in_review"
})
headers = {
'Authorization': 'eyJhbGciOiJIUzUxMiIsInR5cCI6IkpXVCJ9.eyJpZCI6IjY3MmE4NTAzNzFiZTBlY2Y1NTRkMDUxNiIsImFjY291bnRfaWQiOiI2NzJhODUwMzcxYmUwZWNmNTU0ZDA1MGMiLCJpYXQiOjE3Mzk1NDc1MjUsImV4cCI6MTczOTU1MTEyNX0.Vxz-SbPuift-7_DL_ZXYrsxJr_dTKOrch2-FYokgWlk8xgDq0g7sUNxT_emPp0eB3X4EeIrjTCAqbjZPSscn8Q',
'Content-Type': 'application/json',
'Cookie': 'lang=en'
}
response = requests.request("PUT", url, headers=headers, data=payload)
print(response.text)
# httr
library(httr)
headers = c(
'Authorization' = 'eyJhbGciOiJIUzUxMiIsInR5cCI6IkpXVCJ9.eyJpZCI6IjY3MmE4NTAzNzFiZTBlY2Y1NTRkMDUxNiIsImFjY291bnRfaWQiOiI2NzJhODUwMzcxYmUwZWNmNTU0ZDA1MGMiLCJpYXQiOjE3Mzk1NDc1MjUsImV4cCI6MTczOTU1MTEyNX0.Vxz-SbPuift-7_DL_ZXYrsxJr_dTKOrch2-FYokgWlk8xgDq0g7sUNxT_emPp0eB3X4EeIrjTCAqbjZPSscn8Q',
'Content-Type' = 'application/json',
'Cookie' = 'lang=en'
)
body = '{
"status": "in_review"
}';
res <- VERB("PUT", url = "https://sandbox.ecartpay.com/api/chargebacks/5f331fb9f7480d71f16b91e9", body = body, add_headers(headers))
cat(content(res, 'text'))
// -------------------------------------------------------------
# RCurl
library(RCurl)
headers = c(
"Authorization" = "eyJhbGciOiJIUzUxMiIsInR5cCI6IkpXVCJ9.eyJpZCI6IjY3MmE4NTAzNzFiZTBlY2Y1NTRkMDUxNiIsImFjY291bnRfaWQiOiI2NzJhODUwMzcxYmUwZWNmNTU0ZDA1MGMiLCJpYXQiOjE3Mzk1NDc1MjUsImV4cCI6MTczOTU1MTEyNX0.Vxz-SbPuift-7_DL_ZXYrsxJr_dTKOrch2-FYokgWlk8xgDq0g7sUNxT_emPp0eB3X4EeIrjTCAqbjZPSscn8Q",
"Content-Type" = "application/json",
"Cookie" = "lang=en"
)
params = "{
\"status\": \"in_review\"
}"
res <- httpPUT("https://sandbox.ecartpay.com/api/chargebacks/5f331fb9f7480d71f16b91e9", params, httpheader = headers, followlocation = TRUE)
cat(res)
require "uri"
require "json"
require "net/http"
url = URI("https://sandbox.ecartpay.com/api/chargebacks/5f331fb9f7480d71f16b91e9")
https = Net::HTTP.new(url.host, url.port)
https.use_ssl = true
request = Net::HTTP::Put.new(url)
request["Authorization"] = "eyJhbGciOiJIUzUxMiIsInR5cCI6IkpXVCJ9.eyJpZCI6IjY3MmE4NTAzNzFiZTBlY2Y1NTRkMDUxNiIsImFjY291bnRfaWQiOiI2NzJhODUwMzcxYmUwZWNmNTU0ZDA1MGMiLCJpYXQiOjE3Mzk1NDc1MjUsImV4cCI6MTczOTU1MTEyNX0.Vxz-SbPuift-7_DL_ZXYrsxJr_dTKOrch2-FYokgWlk8xgDq0g7sUNxT_emPp0eB3X4EeIrjTCAqbjZPSscn8Q"
request["Content-Type"] = "application/json"
request["Cookie"] = "lang=en"
request.body = JSON.dump({
"status": "in_review"
})
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.eyJpZCI6IjY3MmE4NTAzNzFiZTBlY2Y1NTRkMDUxNiIsImFjY291bnRfaWQiOiI2NzJhODUwMzcxYmUwZWNmNTU0ZDA1MGMiLCJpYXQiOjE3Mzk1NDc1MjUsImV4cCI6MTczOTU1MTEyNX0.Vxz-SbPuift-7_DL_ZXYrsxJr_dTKOrch2-FYokgWlk8xgDq0g7sUNxT_emPp0eB3X4EeIrjTCAqbjZPSscn8Q".parse()?);
headers.insert("Content-Type", "application/json".parse()?);
headers.insert("Cookie", "lang=en".parse()?);
let data = r#"{
"status": "in_review"
}"#;
let json: serde_json::Value = serde_json::from_str(&data)?;
let request = client.request(reqwest::Method::PUT, "https://sandbox.ecartpay.com/api/chargebacks/5f331fb9f7480d71f16b91e9")
.headers(headers)
.json(&json);
let response = request.send().await?;
let body = response.text().await?;
println!("{}", body);
Ok(())
}
# Httpie
printf '{
"status": "in_review"
}'| http --follow --timeout 3600 PUT 'https://sandbox.ecartpay.com/api/chargebacks/5f331fb9f7480d71f16b91e9' \
Authorization:'eyJhbGciOiJIUzUxMiIsInR5cCI6IkpXVCJ9.eyJpZCI6IjY3MmE4NTAzNzFiZTBlY2Y1NTRkMDUxNiIsImFjY291bnRfaWQiOiI2NzJhODUwMzcxYmUwZWNmNTU0ZDA1MGMiLCJpYXQiOjE3Mzk1NDc1MjUsImV4cCI6MTczOTU1MTEyNX0.Vxz-SbPuift-7_DL_ZXYrsxJr_dTKOrch2-FYokgWlk8xgDq0g7sUNxT_emPp0eB3X4EeIrjTCAqbjZPSscn8Q' \
Content-Type:'application/json' \
Cookie:'lang=en'
// -------------------------------------------------------------
# wget
wget --no-check-certificate --quiet \
--method PUT \
--timeout=0 \
--header 'Authorization: eyJhbGciOiJIUzUxMiIsInR5cCI6IkpXVCJ9.eyJpZCI6IjY3MmE4NTAzNzFiZTBlY2Y1NTRkMDUxNiIsImFjY291bnRfaWQiOiI2NzJhODUwMzcxYmUwZWNmNTU0ZDA1MGMiLCJpYXQiOjE3Mzk1NDc1MjUsImV4cCI6MTczOTU1MTEyNX0.Vxz-SbPuift-7_DL_ZXYrsxJr_dTKOrch2-FYokgWlk8xgDq0g7sUNxT_emPp0eB3X4EeIrjTCAqbjZPSscn8Q' \
--header 'Content-Type: application/json' \
--header 'Cookie: lang=en' \
--body-data '{
"status": "in_review"
}' \
'https://sandbox.ecartpay.com/api/chargebacks/5f331fb9f7480d71f16b91e9'
let parameters = "{\n \"status\": \"in_review\"\n}"
let postData = parameters.data(using: .utf8)
var request = URLRequest(url: URL(string: "https://sandbox.ecartpay.com/api/chargebacks/5f331fb9f7480d71f16b91e9")!,timeoutInterval: Double.infinity)
request.addValue("eyJhbGciOiJIUzUxMiIsInR5cCI6IkpXVCJ9.eyJpZCI6IjY3MmE4NTAzNzFiZTBlY2Y1NTRkMDUxNiIsImFjY291bnRfaWQiOiI2NzJhODUwMzcxYmUwZWNmNTU0ZDA1MGMiLCJpYXQiOjE3Mzk1NDc1MjUsImV4cCI6MTczOTU1MTEyNX0.Vxz-SbPuift-7_DL_ZXYrsxJr_dTKOrch2-FYokgWlk8xgDq0g7sUNxT_emPp0eB3X4EeIrjTCAqbjZPSscn8Q", forHTTPHeaderField: "Authorization")
request.addValue("application/json", forHTTPHeaderField: "Content-Type")
request.addValue("lang=en", forHTTPHeaderField: "Cookie")
request.httpMethod = "PUT"
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()
Example Response
{
"id": "646275d23963944d8d8f01b0",
"documents": [],
"amount": 500,
"status": "in_review",
"charge_id": "93474",
"gateway": "ecartpay",
"membership": "9031086",
"brand": "mastercard",
"currency": "MXN",
"reason": "68 - Transacci�n de orden telef�nico/correo/internet fraudulenta",
"transaction_at": "2023-04-15 05:39:00",
"expiration_at": "2023-05-02 06:00:00",
"created_at": "2023-05-15T18:11:30.839Z",
"updated_at": "2023-06-08T18:30:54.061Z",
"account_id": "5fab3b20b40b0a613e1b6f15",
"order_id": "644c4f07b8cf760e7a6ae019",
"transaction_id": "644c4f23b8cf760e7a6ae090",
"files": [
{
"name": "chargebacks_ex.csv",
"path": "https://ecartpay.dev.s3.amazonaws.com/1686005867021-0-chargebacks_ex.csv",
"key": "1686005867021-0-chargebacks_ex.csv",
"mime_type": "text/csv",
"size": 1846,
"_id": "647e686b82dc29dcc9e0f159",
"updated_at": "2023-06-05T22:57:47.134Z",
"created_at": "2023-06-05T22:57:47.134Z"
},
{
"name": "chargebacks_ex.csv",
"path": "https://ecartpay.dev.s3.amazonaws.com/1686005954270-0-chargebacks_ex.csv",
"key": "1686005954270-0-chargebacks_ex.csv",
"mime_type": "text/csv",
"size": 1846,
"_id": "647e68c20c0ea80014d4dfa6",
"updated_at": "2023-06-05T22:59:14.378Z",
"created_at": "2023-06-05T22:59:14.378Z"
},
{
"name": "chargebacks_ex.csv",
"path": "https://ecartpay.dev.s3.amazonaws.com/1686166999423-0-chargebacks_ex.csv",
"key": "1686166999423-0-chargebacks_ex.csv",
"mime_type": "text/csv",
"size": 1846,
"_id": "6480ddd70bfb350014115f71",
"updated_at": "2023-06-07T19:43:19.538Z",
"created_at": "2023-06-07T19:43:19.538Z"
},
{
"name": "chargebacks_ex.csv",
"path": "https://ecartpay.dev.s3.amazonaws.com/1686169103346-0-chargebacks_ex.csv",
"key": "1686169103346-0-chargebacks_ex.csv",
"mime_type": "text/csv",
"size": 1846,
"_id": "6480e60f0bfb350014115f8d",
"updated_at": "2023-06-07T20:18:23.371Z",
"created_at": "2023-06-07T20:18:23.371Z"
},
{
"name": "chargebacks_ex.csv",
"path": "https://ecartpay.dev.s3.amazonaws.com/1686169119771-0-chargebacks_ex.csv",
"key": "1686169119771-0-chargebacks_ex.csv",
"mime_type": "text/csv",
"size": 1846,
"_id": "6480e61f0bfb350014115f91",
"updated_at": "2023-06-07T20:18:39.758Z",
"created_at": "2023-06-07T20:18:39.758Z"
}
]
}
Benefits of Ecart Pay
Ecart Pay offers several advantages in managing chargebacks:
- Streamlined Communication: Facilitates communication between merchants and issuers.
- Document Management: Centralized platform to upload and manage required evidence.
- Resolution Transparency: Clear timelines and updates on case statuses.
- Merchant Support: Dedicated assistance to navigate the chargeback process.
Use Cases
- Unauthorized Transactions: Merchants can contest fraudulent chargebacks with proof of transaction authenticity.
- Product Delivery Issues: Provide delivery confirmation for disputes related to undelivered goods.
- Consumer Misunderstandings: Resolve disputes stemming from product descriptions or service expectations.
Conclusion
Chargebacks are an essential safeguard in payment systems, ensuring fair dispute resolution. Ecart Pay simplifies this process for merchants by providing tools, guidance, and transparent communication. With its structured approach, Ecart Pay enables merchants to navigate disputes efficiently, minimizing potential losses and maintaining customer trust.
Updated about 2 months ago