Charges (Payouts)
Payouts in Ecart Pay refer to the functionality of transferring money to other users within the Ecart Pay network.
WARNINGTo follow the steps below, it is essential to have the corresponding Token. For more information, please refer to the following: Authorization
This feature is particularly advantageous for businesses, marketplaces, and individuals who want a fast, secure, and cost-efficient way to distribute funds.
Ecart Pay provides the ability to send money to other users completely FREE when using your available balance. This makes payouts an attractive option for various scenarios, including payments to suppliers, refunds, and personal transfers.
Advantages
- Speed and Convenience: Payouts are processed quickly, with confirmed payouts credited instantly.
- Cost-Effectiveness: No fees for payouts made from available balance.
- Ease of Use: The intuitive Ecart Pay interface and API make creating payouts simple and efficient.
- Customizable Information: Add detailed notes or itemized data to inform the recipient about the nature of the payment.
Creating a Payout
To create a payout, send a request using the following:
Endpoint
POST {{baseURL}}/api/payouts
Headers
Authorization: {token}
Request Payload
Parameter | Value |
---|---|
email | The email of the recipient. |
reference_id | A unique identifier for the payout. |
amount | The amount to transfer. |
currency | The currency of the payout (e.g., MXN, USD). |
require_confirmation | Whether the payout requires additional confirmation (true or false). |
Example Request (Payout Without Confirmation)
curl --location --globoff 'https://sandbox.ecartpay.com/api/payouts' \
--header 'Authorization: eyJhbGciOiJIUzUxMiIsInR5cCI6IkpXVCJ9.eyJpZCI6IjY3MmE4NTAzNzFiZTBlY2Y1NTRkMDUxNiIsImFjY291bnRfaWQiOiI2NzJhODUwMzcxYmUwZWNmNTU0ZDA1MGMiLCJpYXQiOjE3Mzg2OTA5NDQsImV4cCI6MTczODY5NDU0NH0.eJ7LOLmSwZBVcdol6_7trjeNQBQKjF0IGnJnWrqwpi80Fm5OlezbV2V0rhKmrFA5kW8o7REniUSWEVCIQcrb4A' \
--data-raw '{
"email": "[email protected]",
"reference_id": "1236547",
"amount": 10,
"currency": "MXN"
}'
package main
import (
"fmt"
"strings"
"net/http"
"io"
)
func main() {
url := "https://sandbox.ecartpay.com/api/payouts"
method := "POST"
payload := strings.NewReader(`{
"email": "[email protected]",
"reference_id": "1236547",
"amount": 10,
"currency": "MXN"
}`)
client := &http.Client {
}
req, err := http.NewRequest(method, url, payload)
if err != nil {
fmt.Println(err)
return
}
req.Header.Add("Authorization", "eyJhbGciOiJIUzUxMiIsInR5cCI6IkpXVCJ9.eyJpZCI6IjY3MmE4NTAzNzFiZTBlY2Y1NTRkMDUxNiIsImFjY291bnRfaWQiOiI2NzJhODUwMzcxYmUwZWNmNTU0ZDA1MGMiLCJpYXQiOjE3Mzg2OTA5NDQsImV4cCI6MTczODY5NDU0NH0.eJ7LOLmSwZBVcdol6_7trjeNQBQKjF0IGnJnWrqwpi80Fm5OlezbV2V0rhKmrFA5kW8o7REniUSWEVCIQcrb4A")
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/payouts HTTP/1.1
Host: sandbox.ecartpay.com
Authorization: eyJhbGciOiJIUzUxMiIsInR5cCI6IkpXVCJ9.eyJpZCI6IjY3MmE4NTAzNzFiZTBlY2Y1NTRkMDUxNiIsImFjY291bnRfaWQiOiI2NzJhODUwMzcxYmUwZWNmNTU0ZDA1MGMiLCJpYXQiOjE3Mzg2OTA5NDQsImV4cCI6MTczODY5NDU0NH0.eJ7LOLmSwZBVcdol6_7trjeNQBQKjF0IGnJnWrqwpi80Fm5OlezbV2V0rhKmrFA5kW8o7REniUSWEVCIQcrb4A
Content-Length: 95
{
"email": "[email protected]",
"reference_id": "1236547",
"amount": 10,
"currency": "MXN"
}
// OkHttp
OkHttpClient client = new OkHttpClient().newBuilder()
.build();
MediaType mediaType = MediaType.parse("text/plain");
RequestBody body = RequestBody.create(mediaType, "{\n\t\"email\": \"[email protected]\",\n\t\"reference_id\": \"1236547\",\n\t\"amount\": 10,\n\t\"currency\": \"MXN\"\n}");
Request request = new Request.Builder()
.url("https://sandbox.ecartpay.com/api/payouts")
.method("POST", body)
.addHeader("Authorization", "eyJhbGciOiJIUzUxMiIsInR5cCI6IkpXVCJ9.eyJpZCI6IjY3MmE4NTAzNzFiZTBlY2Y1NTRkMDUxNiIsImFjY291bnRfaWQiOiI2NzJhODUwMzcxYmUwZWNmNTU0ZDA1MGMiLCJpYXQiOjE3Mzg2OTA5NDQsImV4cCI6MTczODY5NDU0NH0.eJ7LOLmSwZBVcdol6_7trjeNQBQKjF0IGnJnWrqwpi80Fm5OlezbV2V0rhKmrFA5kW8o7REniUSWEVCIQcrb4A")
.build();
Response response = client.newCall(request).execute();
// -------------------------------------------------------------
// Unirest
Unirest.setTimeouts(0, 0);
HttpResponse<String> response = Unirest.post("https://sandbox.ecartpay.com/api/payouts")
.header("Authorization", "eyJhbGciOiJIUzUxMiIsInR5cCI6IkpXVCJ9.eyJpZCI6IjY3MmE4NTAzNzFiZTBlY2Y1NTRkMDUxNiIsImFjY291bnRfaWQiOiI2NzJhODUwMzcxYmUwZWNmNTU0ZDA1MGMiLCJpYXQiOjE3Mzg2OTA5NDQsImV4cCI6MTczODY5NDU0NH0.eJ7LOLmSwZBVcdol6_7trjeNQBQKjF0IGnJnWrqwpi80Fm5OlezbV2V0rhKmrFA5kW8o7REniUSWEVCIQcrb4A")
.body("{\n\t\"email\": \"[email protected]\",\n\t\"reference_id\": \"1236547\",\n\t\"amount\": 10,\n\t\"currency\": \"MXN\"\n}")
.asString();
// Fetch
const myHeaders = new Headers();
myHeaders.append("Authorization", "eyJhbGciOiJIUzUxMiIsInR5cCI6IkpXVCJ9.eyJpZCI6IjY3MmE4NTAzNzFiZTBlY2Y1NTRkMDUxNiIsImFjY291bnRfaWQiOiI2NzJhODUwMzcxYmUwZWNmNTU0ZDA1MGMiLCJpYXQiOjE3Mzg2OTA5NDQsImV4cCI6MTczODY5NDU0NH0.eJ7LOLmSwZBVcdol6_7trjeNQBQKjF0IGnJnWrqwpi80Fm5OlezbV2V0rhKmrFA5kW8o7REniUSWEVCIQcrb4A");
const raw = "{\n \"email\": \"[email protected]\",\n \"reference_id\": \"1236547\",\n \"amount\": 10,\n \"currency\": \"MXN\"\n}";
const requestOptions = {
method: "POST",
headers: myHeaders,
body: raw,
redirect: "follow"
};
fetch("https://sandbox.ecartpay.com/api/payouts", requestOptions)
.then((response) => response.text())
.then((result) => console.log(result))
.catch((error) => console.error(error));
// -------------------------------------------------------------
// jQuery
var settings = {
"url": "https://sandbox.ecartpay.com/api/payouts",
"method": "POST",
"timeout": 0,
"headers": {
"Authorization": "eyJhbGciOiJIUzUxMiIsInR5cCI6IkpXVCJ9.eyJpZCI6IjY3MmE4NTAzNzFiZTBlY2Y1NTRkMDUxNiIsImFjY291bnRfaWQiOiI2NzJhODUwMzcxYmUwZWNmNTU0ZDA1MGMiLCJpYXQiOjE3Mzg2OTA5NDQsImV4cCI6MTczODY5NDU0NH0.eJ7LOLmSwZBVcdol6_7trjeNQBQKjF0IGnJnWrqwpi80Fm5OlezbV2V0rhKmrFA5kW8o7REniUSWEVCIQcrb4A"
},
"data": "{\n\t\"email\": \"[email protected]\",\n\t\"reference_id\": \"1236547\",\n\t\"amount\": 10,\n\t\"currency\": \"MXN\"\n}",
};
$.ajax(settings).done(function (response) {
console.log(response);
});
// -------------------------------------------------------------
// XHR
// WARNING: For POST requests, body is set to null by browsers.
var data = "{\n \"email\": \"[email protected]\",\n \"reference_id\": \"1236547\",\n \"amount\": 10,\n \"currency\": \"MXN\"\n}";
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/payouts");
xhr.setRequestHeader("Authorization", "eyJhbGciOiJIUzUxMiIsInR5cCI6IkpXVCJ9.eyJpZCI6IjY3MmE4NTAzNzFiZTBlY2Y1NTRkMDUxNiIsImFjY291bnRfaWQiOiI2NzJhODUwMzcxYmUwZWNmNTU0ZDA1MGMiLCJpYXQiOjE3Mzg2OTA5NDQsImV4cCI6MTczODY5NDU0NH0.eJ7LOLmSwZBVcdol6_7trjeNQBQKjF0IGnJnWrqwpi80Fm5OlezbV2V0rhKmrFA5kW8o7REniUSWEVCIQcrb4A");
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/payouts");
curl_easy_setopt(curl, CURLOPT_FOLLOWLOCATION, 1L);
curl_easy_setopt(curl, CURLOPT_DEFAULT_PROTOCOL, "https");
struct curl_slist *headers = NULL;
headers = curl_slist_append(headers, "Authorization: eyJhbGciOiJIUzUxMiIsInR5cCI6IkpXVCJ9.eyJpZCI6IjY3MmE4NTAzNzFiZTBlY2Y1NTRkMDUxNiIsImFjY291bnRfaWQiOiI2NzJhODUwMzcxYmUwZWNmNTU0ZDA1MGMiLCJpYXQiOjE3Mzg2OTA5NDQsImV4cCI6MTczODY5NDU0NH0.eJ7LOLmSwZBVcdol6_7trjeNQBQKjF0IGnJnWrqwpi80Fm5OlezbV2V0rhKmrFA5kW8o7REniUSWEVCIQcrb4A");
curl_easy_setopt(curl, CURLOPT_HTTPHEADER, headers);
const char *data = "{\n \"email\": \"[email protected]\",\n \"reference_id\": \"1236547\",\n \"amount\": 10,\n \"currency\": \"MXN\"\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 = '{\n\t"email": "[email protected]",\n\t"reference_id": "1236547",\n\t"amount": 10,\n\t"currency": "MXN"\n}';
let config = {
method: 'post',
maxBodyLength: Infinity,
url: 'https://sandbox.ecartpay.com/api/payouts',
headers: {
'Authorization': 'eyJhbGciOiJIUzUxMiIsInR5cCI6IkpXVCJ9.eyJpZCI6IjY3MmE4NTAzNzFiZTBlY2Y1NTRkMDUxNiIsImFjY291bnRfaWQiOiI2NzJhODUwMzcxYmUwZWNmNTU0ZDA1MGMiLCJpYXQiOjE3Mzg2OTA5NDQsImV4cCI6MTczODY5NDU0NH0.eJ7LOLmSwZBVcdol6_7trjeNQBQKjF0IGnJnWrqwpi80Fm5OlezbV2V0rhKmrFA5kW8o7REniUSWEVCIQcrb4A'
},
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/payouts',
'headers': {
'Authorization': 'eyJhbGciOiJIUzUxMiIsInR5cCI6IkpXVCJ9.eyJpZCI6IjY3MmE4NTAzNzFiZTBlY2Y1NTRkMDUxNiIsImFjY291bnRfaWQiOiI2NzJhODUwMzcxYmUwZWNmNTU0ZDA1MGMiLCJpYXQiOjE3Mzg2OTA5NDQsImV4cCI6MTczODY5NDU0NH0.eJ7LOLmSwZBVcdol6_7trjeNQBQKjF0IGnJnWrqwpi80Fm5OlezbV2V0rhKmrFA5kW8o7REniUSWEVCIQcrb4A'
},
'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 = "{\n\t\"email\": \"[email protected]\",\n\t\"reference_id\": \"1236547\",\n\t\"amount\": 10,\n\t\"currency\": \"MXN\"\n}";
req.write(postData);
req.end();
// -------------------------------------------------------------
// Request
var request = require('request');
var options = {
'method': 'POST',
'url': 'https://sandbox.ecartpay.com/api/payouts',
'headers': {
'Authorization': 'eyJhbGciOiJIUzUxMiIsInR5cCI6IkpXVCJ9.eyJpZCI6IjY3MmE4NTAzNzFiZTBlY2Y1NTRkMDUxNiIsImFjY291bnRfaWQiOiI2NzJhODUwMzcxYmUwZWNmNTU0ZDA1MGMiLCJpYXQiOjE3Mzg2OTA5NDQsImV4cCI6MTczODY5NDU0NH0.eJ7LOLmSwZBVcdol6_7trjeNQBQKjF0IGnJnWrqwpi80Fm5OlezbV2V0rhKmrFA5kW8o7REniUSWEVCIQcrb4A'
},
body: '{\n "email": "[email protected]",\n "reference_id": "1236547",\n "amount": 10,\n "currency": "MXN"\n}'
};
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/payouts')
.headers({
'Authorization': 'eyJhbGciOiJIUzUxMiIsInR5cCI6IkpXVCJ9.eyJpZCI6IjY3MmE4NTAzNzFiZTBlY2Y1NTRkMDUxNiIsImFjY291bnRfaWQiOiI2NzJhODUwMzcxYmUwZWNmNTU0ZDA1MGMiLCJpYXQiOjE3Mzg2OTA5NDQsImV4cCI6MTczODY5NDU0NH0.eJ7LOLmSwZBVcdol6_7trjeNQBQKjF0IGnJnWrqwpi80Fm5OlezbV2V0rhKmrFA5kW8o7REniUSWEVCIQcrb4A'
})
.send("{\n\t\"email\": \"[email protected]\",\n\t\"reference_id\": \"1236547\",\n\t\"amount\": 10,\n\t\"currency\": \"MXN\"\n}")
.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/payouts"]
cachePolicy:NSURLRequestUseProtocolCachePolicy
timeoutInterval:10.0];
NSDictionary *headers = @{
@"Authorization": @"eyJhbGciOiJIUzUxMiIsInR5cCI6IkpXVCJ9.eyJpZCI6IjY3MmE4NTAzNzFiZTBlY2Y1NTRkMDUxNiIsImFjY291bnRfaWQiOiI2NzJhODUwMzcxYmUwZWNmNTU0ZDA1MGMiLCJpYXQiOjE3Mzg2OTA5NDQsImV4cCI6MTczODY5NDU0NH0.eJ7LOLmSwZBVcdol6_7trjeNQBQKjF0IGnJnWrqwpi80Fm5OlezbV2V0rhKmrFA5kW8o7REniUSWEVCIQcrb4A"
};
[request setAllHTTPHeaderFields:headers];
NSData *postData = [[NSData alloc] initWithData:[@"{\n \"email\": \"[email protected]\",\n \"reference_id\": \"1236547\",\n \"amount\": 10,\n \"currency\": \"MXN\"\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\t\"email\": \"[email protected]\",\n\t\"reference_id\": \"1236547\",\n\t\"amount\": 10,\n\t\"currency\": \"MXN\"\n}";;
let reqBody =
let uri = Uri.of_string "https://sandbox.ecartpay.com/api/payouts" in
let headers = Header.init ()
|> fun h -> Header.add h "Authorization" "eyJhbGciOiJIUzUxMiIsInR5cCI6IkpXVCJ9.eyJpZCI6IjY3MmE4NTAzNzFiZTBlY2Y1NTRkMDUxNiIsImFjY291bnRfaWQiOiI2NzJhODUwMzcxYmUwZWNmNTU0ZDA1MGMiLCJpYXQiOjE3Mzg2OTA5NDQsImV4cCI6MTczODY5NDU0NH0.eJ7LOLmSwZBVcdol6_7trjeNQBQKjF0IGnJnWrqwpi80Fm5OlezbV2V0rhKmrFA5kW8o7REniUSWEVCIQcrb4A"
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/payouts',
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 =>'{
"email": "[email protected]",
"reference_id": "1236547",
"amount": 10,
"currency": "MXN"
}',
CURLOPT_HTTPHEADER => array(
'Authorization: eyJhbGciOiJIUzUxMiIsInR5cCI6IkpXVCJ9.eyJpZCI6IjY3MmE4NTAzNzFiZTBlY2Y1NTRkMDUxNiIsImFjY291bnRfaWQiOiI2NzJhODUwMzcxYmUwZWNmNTU0ZDA1MGMiLCJpYXQiOjE3Mzg2OTA5NDQsImV4cCI6MTczODY5NDU0NH0.eJ7LOLmSwZBVcdol6_7trjeNQBQKjF0IGnJnWrqwpi80Fm5OlezbV2V0rhKmrFA5kW8o7REniUSWEVCIQcrb4A'
),
));
$response = curl_exec($curl);
curl_close($curl);
echo $response;
// -------------------------------------------------------------
// Guzzle
<?php
$client = new Client();
$headers = [
'Authorization' => 'eyJhbGciOiJIUzUxMiIsInR5cCI6IkpXVCJ9.eyJpZCI6IjY3MmE4NTAzNzFiZTBlY2Y1NTRkMDUxNiIsImFjY291bnRfaWQiOiI2NzJhODUwMzcxYmUwZWNmNTU0ZDA1MGMiLCJpYXQiOjE3Mzg2OTA5NDQsImV4cCI6MTczODY5NDU0NH0.eJ7LOLmSwZBVcdol6_7trjeNQBQKjF0IGnJnWrqwpi80Fm5OlezbV2V0rhKmrFA5kW8o7REniUSWEVCIQcrb4A'
];
$body = '{
"email": "[email protected]",
"reference_id": "1236547",
"amount": 10,
"currency": "MXN"
}';
$request = new Request('POST', 'https://sandbox.ecartpay.com/api/payouts', $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/payouts');
$request->setMethod(HTTP_Request2::METHOD_POST);
$request->setConfig(array(
'follow_redirects' => TRUE
));
$request->setHeader(array(
'Authorization' => 'eyJhbGciOiJIUzUxMiIsInR5cCI6IkpXVCJ9.eyJpZCI6IjY3MmE4NTAzNzFiZTBlY2Y1NTRkMDUxNiIsImFjY291bnRfaWQiOiI2NzJhODUwMzcxYmUwZWNmNTU0ZDA1MGMiLCJpYXQiOjE3Mzg2OTA5NDQsImV4cCI6MTczODY5NDU0NH0.eJ7LOLmSwZBVcdol6_7trjeNQBQKjF0IGnJnWrqwpi80Fm5OlezbV2V0rhKmrFA5kW8o7REniUSWEVCIQcrb4A'
));
$request->setBody('{\n "email": "[email protected]",\n "reference_id": "1236547",\n "amount": 10,\n "currency": "MXN"\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/payouts');
$request->setRequestMethod('POST');
$body = new http\Message\Body;
$body->append('{
"email": "[email protected]",
"reference_id": "1236547",
"amount": 10,
"currency": "MXN"
}');
$request->setBody($body);
$request->setOptions(array());
$request->setHeaders(array(
'Authorization' => 'eyJhbGciOiJIUzUxMiIsInR5cCI6IkpXVCJ9.eyJpZCI6IjY3MmE4NTAzNzFiZTBlY2Y1NTRkMDUxNiIsImFjY291bnRfaWQiOiI2NzJhODUwMzcxYmUwZWNmNTU0ZDA1MGMiLCJpYXQiOjE3Mzg2OTA5NDQsImV4cCI6MTczODY5NDU0NH0.eJ7LOLmSwZBVcdol6_7trjeNQBQKjF0IGnJnWrqwpi80Fm5OlezbV2V0rhKmrFA5kW8o7REniUSWEVCIQcrb4A'
));
$client->enqueue($request)->send();
$response = $client->getResponse();
echo $response->getBody();
$headers = New-Object "System.Collections.Generic.Dictionary[[String],[String]]"
$headers.Add("Authorization", "eyJhbGciOiJIUzUxMiIsInR5cCI6IkpXVCJ9.eyJpZCI6IjY3MmE4NTAzNzFiZTBlY2Y1NTRkMDUxNiIsImFjY291bnRfaWQiOiI2NzJhODUwMzcxYmUwZWNmNTU0ZDA1MGMiLCJpYXQiOjE3Mzg2OTA5NDQsImV4cCI6MTczODY5NDU0NH0.eJ7LOLmSwZBVcdol6_7trjeNQBQKjF0IGnJnWrqwpi80Fm5OlezbV2V0rhKmrFA5kW8o7REniUSWEVCIQcrb4A")
$body = @"
{
`"email`": `"[email protected]`",
`"reference_id`": `"1236547`",
`"amount`": 10,
`"currency`": `"MXN`"
}
"@
$response = Invoke-RestMethod 'https://sandbox.ecartpay.com/api/payouts' -Method 'POST' -Headers $headers -Body $body
$response | ConvertTo-Json
# http.client
import http.client
conn = http.client.HTTPSConnection("sandbox.ecartpay.com")
payload = "{\n\t\"email\": \"[email protected]\",\n\t\"reference_id\": \"1236547\",\n\t\"amount\": 10,\n\t\"currency\": \"MXN\"\n}"
headers = {
'Authorization': 'eyJhbGciOiJIUzUxMiIsInR5cCI6IkpXVCJ9.eyJpZCI6IjY3MmE4NTAzNzFiZTBlY2Y1NTRkMDUxNiIsImFjY291bnRfaWQiOiI2NzJhODUwMzcxYmUwZWNmNTU0ZDA1MGMiLCJpYXQiOjE3Mzg2OTA5NDQsImV4cCI6MTczODY5NDU0NH0.eJ7LOLmSwZBVcdol6_7trjeNQBQKjF0IGnJnWrqwpi80Fm5OlezbV2V0rhKmrFA5kW8o7REniUSWEVCIQcrb4A'
}
conn.request("POST", "/api/payouts", payload, headers)
res = conn.getresponse()
data = res.read()
print(data.decode("utf-8"))
// -------------------------------------------------------------
# Requests
import requests
url = "https://sandbox.ecartpay.com/api/payouts"
payload = "{\n\t\"email\": \"[email protected]\",\n\t\"reference_id\": \"1236547\",\n\t\"amount\": 10,\n\t\"currency\": \"MXN\"\n}"
headers = {
'Authorization': 'eyJhbGciOiJIUzUxMiIsInR5cCI6IkpXVCJ9.eyJpZCI6IjY3MmE4NTAzNzFiZTBlY2Y1NTRkMDUxNiIsImFjY291bnRfaWQiOiI2NzJhODUwMzcxYmUwZWNmNTU0ZDA1MGMiLCJpYXQiOjE3Mzg2OTA5NDQsImV4cCI6MTczODY5NDU0NH0.eJ7LOLmSwZBVcdol6_7trjeNQBQKjF0IGnJnWrqwpi80Fm5OlezbV2V0rhKmrFA5kW8o7REniUSWEVCIQcrb4A'
}
response = requests.request("POST", url, headers=headers, data=payload)
print(response.text)
# httr
library(httr)
headers = c(
'Authorization' = 'eyJhbGciOiJIUzUxMiIsInR5cCI6IkpXVCJ9.eyJpZCI6IjY3MmE4NTAzNzFiZTBlY2Y1NTRkMDUxNiIsImFjY291bnRfaWQiOiI2NzJhODUwMzcxYmUwZWNmNTU0ZDA1MGMiLCJpYXQiOjE3Mzg2OTA5NDQsImV4cCI6MTczODY5NDU0NH0.eJ7LOLmSwZBVcdol6_7trjeNQBQKjF0IGnJnWrqwpi80Fm5OlezbV2V0rhKmrFA5kW8o7REniUSWEVCIQcrb4A'
)
body = "{\n\t\"email\": \"[email protected]\",\n\t\"reference_id\": \"1236547\",\n\t\"amount\": 10,\n\t\"currency\": \"MXN\"\n}"
res <- VERB("POST", url = "https://sandbox.ecartpay.com/api/payouts", body = body, add_headers(headers))
cat(content(res, 'text'))
// -------------------------------------------------------------
# RCurl
library(RCurl)
headers = c(
"Authorization" = "eyJhbGciOiJIUzUxMiIsInR5cCI6IkpXVCJ9.eyJpZCI6IjY3MmE4NTAzNzFiZTBlY2Y1NTRkMDUxNiIsImFjY291bnRfaWQiOiI2NzJhODUwMzcxYmUwZWNmNTU0ZDA1MGMiLCJpYXQiOjE3Mzg2OTA5NDQsImV4cCI6MTczODY5NDU0NH0.eJ7LOLmSwZBVcdol6_7trjeNQBQKjF0IGnJnWrqwpi80Fm5OlezbV2V0rhKmrFA5kW8o7REniUSWEVCIQcrb4A"
)
params = "{\n\t\"email\": \"[email protected]\",\n\t\"reference_id\": \"1236547\",\n\t\"amount\": 10,\n\t\"currency\": \"MXN\"\n}"
res <- postForm("{{url}}/api/payouts", .opts=list(postfields = params, httpheader = headers, followlocation = TRUE), style = "httppost")
cat(res)
require "uri"
require "net/http"
url = URI("https://sandbox.ecartpay.com/api/payouts")
http = Net::HTTP.new(url.host, url.port);
request = Net::HTTP::Post.new(url)
request["Authorization"] = "eyJhbGciOiJIUzUxMiIsInR5cCI6IkpXVCJ9.eyJpZCI6IjY3MmE4NTAzNzFiZTBlY2Y1NTRkMDUxNiIsImFjY291bnRfaWQiOiI2NzJhODUwMzcxYmUwZWNmNTU0ZDA1MGMiLCJpYXQiOjE3Mzg2OTA5NDQsImV4cCI6MTczODY5NDU0NH0.eJ7LOLmSwZBVcdol6_7trjeNQBQKjF0IGnJnWrqwpi80Fm5OlezbV2V0rhKmrFA5kW8o7REniUSWEVCIQcrb4A"
request.body = "{\n\t\"email\": \"[email protected]\",\n\t\"reference_id\": \"1236547\",\n\t\"amount\": 10,\n\t\"currency\": \"MXN\"\n}"
response = http.request(request)
puts response.read_body
#[tokio::main]
async fn main() -> Result<(), Box<dyn std::error::Error>> {
let client = reqwest::Client::builder()
.build()?;
let mut headers = reqwest::header::HeaderMap::new();
headers.insert("Authorization", "eyJhbGciOiJIUzUxMiIsInR5cCI6IkpXVCJ9.eyJpZCI6IjY3MmE4NTAzNzFiZTBlY2Y1NTRkMDUxNiIsImFjY291bnRfaWQiOiI2NzJhODUwMzcxYmUwZWNmNTU0ZDA1MGMiLCJpYXQiOjE3Mzg2OTA5NDQsImV4cCI6MTczODY5NDU0NH0.eJ7LOLmSwZBVcdol6_7trjeNQBQKjF0IGnJnWrqwpi80Fm5OlezbV2V0rhKmrFA5kW8o7REniUSWEVCIQcrb4A".parse()?);
let data = "{\n\t\"email\": \"[email protected]\",\n\t\"reference_id\": \"1236547\",\n\t\"amount\": 10,\n\t\"currency\": \"MXN\"\n}";
let request = client.request(reqwest::Method::POST, "https://sandbox.ecartpay.com/api/payouts")
.headers(headers)
.body(data);
let response = request.send().await?;
let body = response.text().await?;
println!("{}", body);
Ok(())
}
# Httpie
printf '{
"email": "[email protected]",
"reference_id": "1236547",
"amount": 10,
"currency": "MXN"
}'| http --follow --timeout 3600 POST 'https://sandbox.ecartpay.com/api/payouts' \
Authorization:'eyJhbGciOiJIUzUxMiIsInR5cCI6IkpXVCJ9.eyJpZCI6IjY3MmE4NTAzNzFiZTBlY2Y1NTRkMDUxNiIsImFjY291bnRfaWQiOiI2NzJhODUwMzcxYmUwZWNmNTU0ZDA1MGMiLCJpYXQiOjE3Mzg2OTA5NDQsImV4cCI6MTczODY5NDU0NH0.eJ7LOLmSwZBVcdol6_7trjeNQBQKjF0IGnJnWrqwpi80Fm5OlezbV2V0rhKmrFA5kW8o7REniUSWEVCIQcrb4A'
// -------------------------------------------------------------
# wget
wget --no-check-certificate --quiet \
--method POST \
--timeout=0 \
--header 'Authorization: eyJhbGciOiJIUzUxMiIsInR5cCI6IkpXVCJ9.eyJpZCI6IjY3MmE4NTAzNzFiZTBlY2Y1NTRkMDUxNiIsImFjY291bnRfaWQiOiI2NzJhODUwMzcxYmUwZWNmNTU0ZDA1MGMiLCJpYXQiOjE3Mzg2OTA5NDQsImV4cCI6MTczODY5NDU0NH0.eJ7LOLmSwZBVcdol6_7trjeNQBQKjF0IGnJnWrqwpi80Fm5OlezbV2V0rhKmrFA5kW8o7REniUSWEVCIQcrb4A' \
--body-data '{
"email": "[email protected]",
"reference_id": "1236547",
"amount": 10,
"currency": "MXN"
}' \
'https://sandbox.ecartpay.com/api/payouts'
let parameters = "{\n\t\"email\": \"[email protected]\",\n\t\"reference_id\": \"1236547\",\n\t\"amount\": 10,\n\t\"currency\": \"MXN\"\n}"
let postData = parameters.data(using: .utf8)
var request = URLRequest(url: URL(string: "https://sandbox.ecartpay.com/api/payouts")!,timeoutInterval: Double.infinity)
request.addValue("eyJhbGciOiJIUzUxMiIsInR5cCI6IkpXVCJ9.eyJpZCI6IjY3MmE4NTAzNzFiZTBlY2Y1NTRkMDUxNiIsImFjY291bnRfaWQiOiI2NzJhODUwMzcxYmUwZWNmNTU0ZDA1MGMiLCJpYXQiOjE3Mzg2OTA5NDQsImV4cCI6MTczODY5NDU0NH0.eJ7LOLmSwZBVcdol6_7trjeNQBQKjF0IGnJnWrqwpi80Fm5OlezbV2V0rhKmrFA5kW8o7REniUSWEVCIQcrb4A", forHTTPHeaderField: "Authorization")
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
{
"id": "61a53cd3f6ea776ee3b37498",
"authorization_id": "6189d4c4e1fd65512e9c5264",
"account_id": "5dfab0626e963414d2475236",
"reference_id": "1236547",
"reference": "61a53cd3f6ea776ee3b37495",
"status": "paid",
"currency": "MXN",
"amount": 10,
"fee": 0,
"exchange": 1,
"available_at": "2021-11-29T20:49:23.889Z",
"require_confirmation": false,
"created_at": "2021-11-29T20:49:23.891Z",
"updated_at": "2021-11-29T20:49:23.891Z"
}
{
"id": "61a53da1f6ea776ee3b37718",
"authorization_id": "6189d4c4e1fd65512e9c5264",
"account_id": "5dfab0626e963414d2475236",
"reference_id": "12365231",
"reference": "61a53da1f6ea776ee3b37715",
"status": "pending",
"currency": "MXN",
"amount": 10,
"fee": 0,
"exchange": 1,
"available_at": "2021-11-29T20:52:49.920Z",
"require_confirmation": true,
"created_at": "2021-11-29T20:52:49.922Z",
"updated_at": "2021-11-29T20:52:49.922Z"
}
{
"authorization_id": "6180483beab9d945a86da3c1",
"account_id": "65af093d10a09912d8aa8bbd",
"customer_id": "657b928db4c08f6f66847b09",
"payment_method_id": "65ae8d76219f93a7c14ceb82",
"reference_id": "65afee86ec939a1cae6223de",
"reference": "65afee86ec939a1cae6223de",
"status": "paid",
"currency": "MXN",
"amount": 10,
"fee": 0,
"exchange": 1,
"available_at": "2024-01-23T16:51:19.318Z",
"require_confirmation": false,
"id": "65afee87ec939a1cae6223e4",
"created_at": "2024-01-23T16:51:19.326Z",
"updated_at": "2024-01-23T16:51:19.326Z",
"transactions": [
{
"id": "65afee87ec939a1cae6223e9",
"account_id": "TR00001140A",
"transaction_id": "TR00001140A",
"type": "charge",
"status": "paid",
"amount": 10,
"fee": 0,
"currency": "MXN",
"gateway": "pay"
},
{
"id": "65afee88ec939a1cae6223f2",
"account_id": "TR00001141A",
"transaction_id": "TR00001141A",
"type": "payment",
"status": "paid",
"amount": 10,
"fee": 0,
"currency": "MXN",
"gateway": "pay"
}
]
}
IMPORTANTIn case you want to add a confirmation (availability of the payout) you should change
require_confirmation
totrue
and (if necessary) change the availability date (available_at
). For more details, see: Confirmations.
Key Features
- Two Types of Payouts:
- Confirmed Payouts: These are credited instantly to the recipient's account, ensuring that the money is immediately available for use.
- Pending Payouts: These require further confirmation before the funds are released, such as verifying that an order has been delivered or specific conditions have been met.
- Free Transfers: When using your available Ecart Pay balance, sending money to other users within the network incurs no additional fees.
- Wide Accessibility: You can send payouts to any registered Ecart Pay account in the countries where Ecart Pay operates, making it an excellent tool for international transactions.
- Enhanced Transparency: Payouts allow users to include detailed information, such as specific items being paid for, which is useful for marketplaces and drop shipping operations.
Use Cases for Payouts
- Marketplaces: Seamlessly transfer earnings to sellers after a sale.
- Employee Payroll: Distribute salaries to employees in real time.
- Refunds: Quickly issue refunds to customers without delays.
- Personal Transfers: Send money to friends or family members within the Ecart Pay network.
Payouts in Ecart Pay are designed to streamline financial transactions, offering a user-friendly, secure, and efficient way to handle payments within the network.
Updated about 2 months ago