Upload Invoice
const form = new FormData();
form.append('file', '<string>');
const options = {method: 'POST', headers: {'x-api-key': '<api-key>'}};
options.body = form;
fetch('https://sandboxapi.me-cash.com/v1/file/invoice', options)
.then(res => res.json())
.then(res => console.log(res))
.catch(err => console.error(err));curl --request POST \
--url https://sandboxapi.me-cash.com/v1/file/invoice \
--header 'Content-Type: multipart/form-data' \
--header 'x-api-key: <api-key>' \
--form file='@example-file'import requests
url = "https://sandboxapi.me-cash.com/v1/file/invoice"
files = { "file": ("example-file", open("example-file", "rb")) }
headers = {"x-api-key": "<api-key>"}
response = requests.post(url, files=files, headers=headers)
print(response.text)import fs from 'fs';
const formData = new FormData();
formData.append('file', await new Response(fs.createReadStream('example-file')).blob());
const url = 'https://sandboxapi.me-cash.com/v1/file/invoice';
const options = {method: 'POST', headers: {'x-api-key': '<api-key>'}, body: formData};
fetch(url, options)
.then(res => res.json())
.then(json => console.log(json))
.catch(err => console.error(err));<?php
$curl = curl_init();
curl_setopt_array($curl, [
CURLOPT_URL => "https://sandboxapi.me-cash.com/v1/file/invoice",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "POST",
CURLOPT_POSTFIELDS => "-----011000010111000001101001\r\nContent-Disposition: form-data; name=\"file\"; filename=\"example-file\"\r\nContent-Type: application/octet-stream\r\n\r\n<string>\r\n-----011000010111000001101001--",
CURLOPT_HTTPHEADER => [
"x-api-key: <api-key>"
],
]);
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}HttpResponse<String> response = Unirest.post("https://sandboxapi.me-cash.com/v1/file/invoice")
.header("x-api-key", "<api-key>")
.body("-----011000010111000001101001\r\nContent-Disposition: form-data; name=\"file\"; filename=\"example-file\"\r\nContent-Type: application/octet-stream\r\n\r\n<string>\r\n-----011000010111000001101001--")
.asString();require 'uri'
require 'net/http'
url = URI("https://sandboxapi.me-cash.com/v1/file/invoice")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Post.new(url)
request["x-api-key"] = '<api-key>'
request.body = "-----011000010111000001101001\r\nContent-Disposition: form-data; name=\"file\"; filename=\"example-file\"\r\nContent-Type: application/octet-stream\r\n\r\n<string>\r\n-----011000010111000001101001--"
response = http.request(request)
puts response.read_bodyimport Foundation
let parameters = [
[
"name": "file",
"value": "<string>",
"fileName": "example-file"
]
]
let boundary = "---011000010111000001101001"
var body = ""
for param in parameters {
let paramName = param["name"]!
body += "--\(boundary)\r\n"
body += "Content-Disposition:form-data; name=\"\(paramName)\""
if let filename = param["fileName"] {
let contentType = param["contentType"]!
let fileContent = try String(contentsOfFile: filename, encoding: .utf8)
body += "; filename=\"\(filename)\"\r\n"
body += "Content-Type: \(contentType)\r\n\r\n"
body += fileContent
} else if let paramValue = param["value"] {
body += "\r\n\r\n\(paramValue)"
}
}
let postData = Data(body.utf8)
let url = URL(string: "https://sandboxapi.me-cash.com/v1/file/invoice")!
var request = URLRequest(url: url)
request.httpMethod = "POST"
request.timeoutInterval = 10
request.allHTTPHeaderFields = ["x-api-key": "<api-key>"]
request.httpBody = postData
let (data, _) = try await URLSession.shared.data(for: request)
print(String(decoding: data, as: UTF8.self))val client = OkHttpClient()
val mediaType = MediaType.parse("multipart/form-data; boundary=---011000010111000001101001")
val body = RequestBody.create(mediaType, "-----011000010111000001101001\r\nContent-Disposition: form-data; name=\"file\"; filename=\"example-file\"\r\nContent-Type: application/octet-stream\r\n\r\n<string>\r\n-----011000010111000001101001--")
val request = Request.Builder()
.url("https://sandboxapi.me-cash.com/v1/file/invoice")
.post(body)
.addHeader("x-api-key", "<api-key>")
.build()
val response = client.newCall(request).execute()falsepackage main
import (
"fmt"
"strings"
"net/http"
"io"
)
func main() {
url := "https://sandboxapi.me-cash.com/v1/file/invoice"
payload := strings.NewReader("-----011000010111000001101001\r\nContent-Disposition: form-data; name=\"file\"; filename=\"example-file\"\r\nContent-Type: application/octet-stream\r\n\r\n<string>\r\n-----011000010111000001101001--")
req, _ := http.NewRequest("POST", url, payload)
req.Header.Add("x-api-key", "<api-key>")
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := io.ReadAll(res.Body)
fmt.Println(string(body))
}{
"status": "success",
"message": "Operation completed successfully.",
"data": {
"id": "059c23af-eb87-4dc1-8518-8e335c98af30",
"name": "Bar Deco.jpeg"
}
}{
"message": "Invalid API key",
"status": "failed"
}{
"message": "Access denied: IP address not whitelisted",
"status": "failed"
}{
"message": "Server failed to process request.",
"status": "failed"
}Payout
Upload Invoice
Uploads an invoice file for use with payout operations. The returned ID is used as the invoice identifier in subsequent payout requests.
POST
/
v1
/
file
/
invoice
Upload Invoice
const form = new FormData();
form.append('file', '<string>');
const options = {method: 'POST', headers: {'x-api-key': '<api-key>'}};
options.body = form;
fetch('https://sandboxapi.me-cash.com/v1/file/invoice', options)
.then(res => res.json())
.then(res => console.log(res))
.catch(err => console.error(err));curl --request POST \
--url https://sandboxapi.me-cash.com/v1/file/invoice \
--header 'Content-Type: multipart/form-data' \
--header 'x-api-key: <api-key>' \
--form file='@example-file'import requests
url = "https://sandboxapi.me-cash.com/v1/file/invoice"
files = { "file": ("example-file", open("example-file", "rb")) }
headers = {"x-api-key": "<api-key>"}
response = requests.post(url, files=files, headers=headers)
print(response.text)import fs from 'fs';
const formData = new FormData();
formData.append('file', await new Response(fs.createReadStream('example-file')).blob());
const url = 'https://sandboxapi.me-cash.com/v1/file/invoice';
const options = {method: 'POST', headers: {'x-api-key': '<api-key>'}, body: formData};
fetch(url, options)
.then(res => res.json())
.then(json => console.log(json))
.catch(err => console.error(err));<?php
$curl = curl_init();
curl_setopt_array($curl, [
CURLOPT_URL => "https://sandboxapi.me-cash.com/v1/file/invoice",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "POST",
CURLOPT_POSTFIELDS => "-----011000010111000001101001\r\nContent-Disposition: form-data; name=\"file\"; filename=\"example-file\"\r\nContent-Type: application/octet-stream\r\n\r\n<string>\r\n-----011000010111000001101001--",
CURLOPT_HTTPHEADER => [
"x-api-key: <api-key>"
],
]);
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}HttpResponse<String> response = Unirest.post("https://sandboxapi.me-cash.com/v1/file/invoice")
.header("x-api-key", "<api-key>")
.body("-----011000010111000001101001\r\nContent-Disposition: form-data; name=\"file\"; filename=\"example-file\"\r\nContent-Type: application/octet-stream\r\n\r\n<string>\r\n-----011000010111000001101001--")
.asString();require 'uri'
require 'net/http'
url = URI("https://sandboxapi.me-cash.com/v1/file/invoice")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Post.new(url)
request["x-api-key"] = '<api-key>'
request.body = "-----011000010111000001101001\r\nContent-Disposition: form-data; name=\"file\"; filename=\"example-file\"\r\nContent-Type: application/octet-stream\r\n\r\n<string>\r\n-----011000010111000001101001--"
response = http.request(request)
puts response.read_bodyimport Foundation
let parameters = [
[
"name": "file",
"value": "<string>",
"fileName": "example-file"
]
]
let boundary = "---011000010111000001101001"
var body = ""
for param in parameters {
let paramName = param["name"]!
body += "--\(boundary)\r\n"
body += "Content-Disposition:form-data; name=\"\(paramName)\""
if let filename = param["fileName"] {
let contentType = param["contentType"]!
let fileContent = try String(contentsOfFile: filename, encoding: .utf8)
body += "; filename=\"\(filename)\"\r\n"
body += "Content-Type: \(contentType)\r\n\r\n"
body += fileContent
} else if let paramValue = param["value"] {
body += "\r\n\r\n\(paramValue)"
}
}
let postData = Data(body.utf8)
let url = URL(string: "https://sandboxapi.me-cash.com/v1/file/invoice")!
var request = URLRequest(url: url)
request.httpMethod = "POST"
request.timeoutInterval = 10
request.allHTTPHeaderFields = ["x-api-key": "<api-key>"]
request.httpBody = postData
let (data, _) = try await URLSession.shared.data(for: request)
print(String(decoding: data, as: UTF8.self))val client = OkHttpClient()
val mediaType = MediaType.parse("multipart/form-data; boundary=---011000010111000001101001")
val body = RequestBody.create(mediaType, "-----011000010111000001101001\r\nContent-Disposition: form-data; name=\"file\"; filename=\"example-file\"\r\nContent-Type: application/octet-stream\r\n\r\n<string>\r\n-----011000010111000001101001--")
val request = Request.Builder()
.url("https://sandboxapi.me-cash.com/v1/file/invoice")
.post(body)
.addHeader("x-api-key", "<api-key>")
.build()
val response = client.newCall(request).execute()falsepackage main
import (
"fmt"
"strings"
"net/http"
"io"
)
func main() {
url := "https://sandboxapi.me-cash.com/v1/file/invoice"
payload := strings.NewReader("-----011000010111000001101001\r\nContent-Disposition: form-data; name=\"file\"; filename=\"example-file\"\r\nContent-Type: application/octet-stream\r\n\r\n<string>\r\n-----011000010111000001101001--")
req, _ := http.NewRequest("POST", url, payload)
req.Header.Add("x-api-key", "<api-key>")
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := io.ReadAll(res.Body)
fmt.Println(string(body))
}{
"status": "success",
"message": "Operation completed successfully.",
"data": {
"id": "059c23af-eb87-4dc1-8518-8e335c98af30",
"name": "Bar Deco.jpeg"
}
}{
"message": "Invalid API key",
"status": "failed"
}{
"message": "Access denied: IP address not whitelisted",
"status": "failed"
}{
"message": "Server failed to process request.",
"status": "failed"
}File Upload
The File Upload API allows you to upload documents such as invoices or receipts that may be required for certain types of payouts or compliance purposes.Use Case
When creating a payout, some corridors or transaction types might require supporting documentation (e.g., a business invoice). You can use this endpoint to upload the invoice first, and then reference the returnedid as the optional invoice field in your payout request.
Request Example
curl --location 'https://{{baseURL}}/v1/file/invoice' \
--header 'x-api-key: API_KEY_HERE' \
--form 'file=@"/path/to/your/invoice.jpeg"'
The endpoint expects a
multipart/form-data request with the file attached to the file field.Response
A successful upload returns anid which is used as the optional invoice field in subsequent payout requests.
{
"message": "File uploaded successfully",
"status": "success",
"data": {
"id": "059c23af-eb87-4dc1-8518-8e335c98af30",
"name": "Bar Deco.jpeg"
}
}
Authorizations
Body
multipart/form-data
The invoice file to be uploaded.
Was this page helpful?
⌘I

