Export Payments
curl --request POST \
--url https://api.magebank.ai/payments/export \
--header 'Content-Type: application/json' \
--header 'x-api-key: <x-api-key>' \
--data '
{
"format": "<string>",
"dateRange": {
"start": "<string>",
"end": "<string>"
}
}
'import requests
url = "https://api.magebank.ai/payments/export"
payload = {
"format": "<string>",
"dateRange": {
"start": "<string>",
"end": "<string>"
}
}
headers = {
"x-api-key": "<x-api-key>",
"Content-Type": "application/json"
}
response = requests.post(url, json=payload, headers=headers)
print(response.text)const options = {
method: 'POST',
headers: {'x-api-key': '<x-api-key>', 'Content-Type': 'application/json'},
body: JSON.stringify({format: '<string>', dateRange: {start: '<string>', end: '<string>'}})
};
fetch('https://api.magebank.ai/payments/export', options)
.then(res => res.json())
.then(res => console.log(res))
.catch(err => console.error(err));<?php
$curl = curl_init();
curl_setopt_array($curl, [
CURLOPT_URL => "https://api.magebank.ai/payments/export",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "POST",
CURLOPT_POSTFIELDS => json_encode([
'format' => '<string>',
'dateRange' => [
'start' => '<string>',
'end' => '<string>'
]
]),
CURLOPT_HTTPHEADER => [
"Content-Type: application/json",
"x-api-key: <x-api-key>"
],
]);
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}package main
import (
"fmt"
"strings"
"net/http"
"io"
)
func main() {
url := "https://api.magebank.ai/payments/export"
payload := strings.NewReader("{\n \"format\": \"<string>\",\n \"dateRange\": {\n \"start\": \"<string>\",\n \"end\": \"<string>\"\n }\n}")
req, _ := http.NewRequest("POST", url, payload)
req.Header.Add("x-api-key", "<x-api-key>")
req.Header.Add("Content-Type", "application/json")
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := io.ReadAll(res.Body)
fmt.Println(string(body))
}HttpResponse<String> response = Unirest.post("https://api.magebank.ai/payments/export")
.header("x-api-key", "<x-api-key>")
.header("Content-Type", "application/json")
.body("{\n \"format\": \"<string>\",\n \"dateRange\": {\n \"start\": \"<string>\",\n \"end\": \"<string>\"\n }\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.magebank.ai/payments/export")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Post.new(url)
request["x-api-key"] = '<x-api-key>'
request["Content-Type"] = 'application/json'
request.body = "{\n \"format\": \"<string>\",\n \"dateRange\": {\n \"start\": \"<string>\",\n \"end\": \"<string>\"\n }\n}"
response = http.request(request)
puts response.read_body{
"error": "Invalid export format. Supported formats are: csv, xlsx, pdf"
}
{
"error": "Invalid date range format"
}
{
"error": "Invalid or missing API key"
}
{
"error": "Internal server error"
}
Payments
Export Payments
Export payments data in various formats (CSV, XLSX, PDF)
POST
/
payments
/
export
Export Payments
curl --request POST \
--url https://api.magebank.ai/payments/export \
--header 'Content-Type: application/json' \
--header 'x-api-key: <x-api-key>' \
--data '
{
"format": "<string>",
"dateRange": {
"start": "<string>",
"end": "<string>"
}
}
'import requests
url = "https://api.magebank.ai/payments/export"
payload = {
"format": "<string>",
"dateRange": {
"start": "<string>",
"end": "<string>"
}
}
headers = {
"x-api-key": "<x-api-key>",
"Content-Type": "application/json"
}
response = requests.post(url, json=payload, headers=headers)
print(response.text)const options = {
method: 'POST',
headers: {'x-api-key': '<x-api-key>', 'Content-Type': 'application/json'},
body: JSON.stringify({format: '<string>', dateRange: {start: '<string>', end: '<string>'}})
};
fetch('https://api.magebank.ai/payments/export', options)
.then(res => res.json())
.then(res => console.log(res))
.catch(err => console.error(err));<?php
$curl = curl_init();
curl_setopt_array($curl, [
CURLOPT_URL => "https://api.magebank.ai/payments/export",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "POST",
CURLOPT_POSTFIELDS => json_encode([
'format' => '<string>',
'dateRange' => [
'start' => '<string>',
'end' => '<string>'
]
]),
CURLOPT_HTTPHEADER => [
"Content-Type: application/json",
"x-api-key: <x-api-key>"
],
]);
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}package main
import (
"fmt"
"strings"
"net/http"
"io"
)
func main() {
url := "https://api.magebank.ai/payments/export"
payload := strings.NewReader("{\n \"format\": \"<string>\",\n \"dateRange\": {\n \"start\": \"<string>\",\n \"end\": \"<string>\"\n }\n}")
req, _ := http.NewRequest("POST", url, payload)
req.Header.Add("x-api-key", "<x-api-key>")
req.Header.Add("Content-Type", "application/json")
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := io.ReadAll(res.Body)
fmt.Println(string(body))
}HttpResponse<String> response = Unirest.post("https://api.magebank.ai/payments/export")
.header("x-api-key", "<x-api-key>")
.header("Content-Type", "application/json")
.body("{\n \"format\": \"<string>\",\n \"dateRange\": {\n \"start\": \"<string>\",\n \"end\": \"<string>\"\n }\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.magebank.ai/payments/export")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Post.new(url)
request["x-api-key"] = '<x-api-key>'
request["Content-Type"] = 'application/json'
request.body = "{\n \"format\": \"<string>\",\n \"dateRange\": {\n \"start\": \"<string>\",\n \"end\": \"<string>\"\n }\n}"
response = http.request(request)
puts response.read_body{
"error": "Invalid export format. Supported formats are: csv, xlsx, pdf"
}
{
"error": "Invalid date range format"
}
{
"error": "Invalid or missing API key"
}
{
"error": "Internal server error"
}
Data Export: Generate payment reports in your preferred format for accounting, record-keeping, and analysis.
Request Headers
string
required
Your API key for authentication
Request Body
string
required
Export format
Show Allowed values
Show Allowed values
“csv”, “xlsx”, “pdf”
object
Response
The response is a file download in the requested format containing payment data.{
"error": "Invalid export format. Supported formats are: csv, xlsx, pdf"
}
{
"error": "Invalid date range format"
}
{
"error": "Invalid or missing API key"
}
{
"error": "Internal server error"
}
Status Codes
| Status Code | Description |
|---|---|
| 200 | Export completed successfully, file is returned |
| 400 | Bad Request - Invalid parameters |
| 401 | Unauthorized - Authentication failed |
| 500 | Internal Server Error |
Format Benefits:
- CSV: Simple format compatible with most spreadsheet applications
- XLSX: Excel format with rich formatting and multiple sheets
- PDF: Formatted document suitable for sharing and printing
Size Limit: The maximum export size is 10,000 payments. For larger datasets, use multiple date range requests.