Register Payment
curl --request POST \
--url https://api.magebank.ai/payments/register \
--header 'Content-Type: application/json' \
--header 'x-api-key: <x-api-key>' \
--data '
{
"senderagentid": "<string>",
"receiveragentid": "<string>",
"paymentdetails": {
"amount": 123,
"currency": "<string>",
"method": "<string>"
},
"name": "<string>",
"contactdetails": {
"email": "<string>",
"phoneNumber": "<string>"
},
"tags": [
{}
]
}
'import requests
url = "https://api.magebank.ai/payments/register"
payload = {
"senderagentid": "<string>",
"receiveragentid": "<string>",
"paymentdetails": {
"amount": 123,
"currency": "<string>",
"method": "<string>"
},
"name": "<string>",
"contactdetails": {
"email": "<string>",
"phoneNumber": "<string>"
},
"tags": [{}]
}
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({
senderagentid: '<string>',
receiveragentid: '<string>',
paymentdetails: {amount: 123, currency: '<string>', method: '<string>'},
name: '<string>',
contactdetails: {email: '<string>', phoneNumber: '<string>'},
tags: [{}]
})
};
fetch('https://api.magebank.ai/payments/register', 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/register",
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([
'senderagentid' => '<string>',
'receiveragentid' => '<string>',
'paymentdetails' => [
'amount' => 123,
'currency' => '<string>',
'method' => '<string>'
],
'name' => '<string>',
'contactdetails' => [
'email' => '<string>',
'phoneNumber' => '<string>'
],
'tags' => [
[
]
]
]),
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/register"
payload := strings.NewReader("{\n \"senderagentid\": \"<string>\",\n \"receiveragentid\": \"<string>\",\n \"paymentdetails\": {\n \"amount\": 123,\n \"currency\": \"<string>\",\n \"method\": \"<string>\"\n },\n \"name\": \"<string>\",\n \"contactdetails\": {\n \"email\": \"<string>\",\n \"phoneNumber\": \"<string>\"\n },\n \"tags\": [\n {}\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/register")
.header("x-api-key", "<x-api-key>")
.header("Content-Type", "application/json")
.body("{\n \"senderagentid\": \"<string>\",\n \"receiveragentid\": \"<string>\",\n \"paymentdetails\": {\n \"amount\": 123,\n \"currency\": \"<string>\",\n \"method\": \"<string>\"\n },\n \"name\": \"<string>\",\n \"contactdetails\": {\n \"email\": \"<string>\",\n \"phoneNumber\": \"<string>\"\n },\n \"tags\": [\n {}\n ]\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.magebank.ai/payments/register")
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 \"senderagentid\": \"<string>\",\n \"receiveragentid\": \"<string>\",\n \"paymentdetails\": {\n \"amount\": 123,\n \"currency\": \"<string>\",\n \"method\": \"<string>\"\n },\n \"name\": \"<string>\",\n \"contactdetails\": {\n \"email\": \"<string>\",\n \"phoneNumber\": \"<string>\"\n },\n \"tags\": [\n {}\n ]\n}"
response = http.request(request)
puts response.read_body{
"id": "payee_wDG5cavUCoK53uvFzTvkey",
"name": "Vendor XYZ Payment",
"type": "EXTERNAL",
"status": "New",
"approvalstatus": "Waiting",
"approvalRequired": true,
"createdat": "2025-04-17T10:28:18.512792",
"txHash": null
}
{
"id": "payee_xFG8eqvUXeK23zmFwTasLc",
"name": "Small transaction",
"type": "INTERNAL",
"status": "Confirmed",
"approvalstatus": "Approved",
"approvalRequired": false,
"createdat": "2025-04-17T10:30:22Z",
"txHash": "0xabc123..."
}
{
"error": "Insufficient balance in sender agent's wallet"
// OR
"error": "Required fields missing: senderagentid, receiveragentid, paymentdetails, name, type"
// OR
"error": "Invalid payment details. Amount must be positive."
}
{
"error": "Invalid or missing API key"
}
{
"error": "Internal Server Error"
}
{
"error": "Sender agent not found"
}
Payments
Register Payment
Create a new payment transaction between agents
POST
/
payments
/
register
Register Payment
curl --request POST \
--url https://api.magebank.ai/payments/register \
--header 'Content-Type: application/json' \
--header 'x-api-key: <x-api-key>' \
--data '
{
"senderagentid": "<string>",
"receiveragentid": "<string>",
"paymentdetails": {
"amount": 123,
"currency": "<string>",
"method": "<string>"
},
"name": "<string>",
"contactdetails": {
"email": "<string>",
"phoneNumber": "<string>"
},
"tags": [
{}
]
}
'import requests
url = "https://api.magebank.ai/payments/register"
payload = {
"senderagentid": "<string>",
"receiveragentid": "<string>",
"paymentdetails": {
"amount": 123,
"currency": "<string>",
"method": "<string>"
},
"name": "<string>",
"contactdetails": {
"email": "<string>",
"phoneNumber": "<string>"
},
"tags": [{}]
}
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({
senderagentid: '<string>',
receiveragentid: '<string>',
paymentdetails: {amount: 123, currency: '<string>', method: '<string>'},
name: '<string>',
contactdetails: {email: '<string>', phoneNumber: '<string>'},
tags: [{}]
})
};
fetch('https://api.magebank.ai/payments/register', 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/register",
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([
'senderagentid' => '<string>',
'receiveragentid' => '<string>',
'paymentdetails' => [
'amount' => 123,
'currency' => '<string>',
'method' => '<string>'
],
'name' => '<string>',
'contactdetails' => [
'email' => '<string>',
'phoneNumber' => '<string>'
],
'tags' => [
[
]
]
]),
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/register"
payload := strings.NewReader("{\n \"senderagentid\": \"<string>\",\n \"receiveragentid\": \"<string>\",\n \"paymentdetails\": {\n \"amount\": 123,\n \"currency\": \"<string>\",\n \"method\": \"<string>\"\n },\n \"name\": \"<string>\",\n \"contactdetails\": {\n \"email\": \"<string>\",\n \"phoneNumber\": \"<string>\"\n },\n \"tags\": [\n {}\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/register")
.header("x-api-key", "<x-api-key>")
.header("Content-Type", "application/json")
.body("{\n \"senderagentid\": \"<string>\",\n \"receiveragentid\": \"<string>\",\n \"paymentdetails\": {\n \"amount\": 123,\n \"currency\": \"<string>\",\n \"method\": \"<string>\"\n },\n \"name\": \"<string>\",\n \"contactdetails\": {\n \"email\": \"<string>\",\n \"phoneNumber\": \"<string>\"\n },\n \"tags\": [\n {}\n ]\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.magebank.ai/payments/register")
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 \"senderagentid\": \"<string>\",\n \"receiveragentid\": \"<string>\",\n \"paymentdetails\": {\n \"amount\": 123,\n \"currency\": \"<string>\",\n \"method\": \"<string>\"\n },\n \"name\": \"<string>\",\n \"contactdetails\": {\n \"email\": \"<string>\",\n \"phoneNumber\": \"<string>\"\n },\n \"tags\": [\n {}\n ]\n}"
response = http.request(request)
puts response.read_body{
"id": "payee_wDG5cavUCoK53uvFzTvkey",
"name": "Vendor XYZ Payment",
"type": "EXTERNAL",
"status": "New",
"approvalstatus": "Waiting",
"approvalRequired": true,
"createdat": "2025-04-17T10:28:18.512792",
"txHash": null
}
{
"id": "payee_xFG8eqvUXeK23zmFwTasLc",
"name": "Small transaction",
"type": "INTERNAL",
"status": "Confirmed",
"approvalstatus": "Approved",
"approvalRequired": false,
"createdat": "2025-04-17T10:30:22Z",
"txHash": "0xabc123..."
}
{
"error": "Insufficient balance in sender agent's wallet"
// OR
"error": "Required fields missing: senderagentid, receiveragentid, paymentdetails, name, type"
// OR
"error": "Invalid payment details. Amount must be positive."
}
{
"error": "Invalid or missing API key"
}
{
"error": "Internal Server Error"
}
{
"error": "Sender agent not found"
}
Agent Transactions: Create payments between agents with automatic application of approval rules based on the senderâs configuration.
Request Headers
string
required
Your API key for authentication
Request Body
string
required
ID of the agent sending the payment
string
required
ID of the agent receiving the payment
object
required
string
required
Name or description of the payment
object
array
Tags or categories for the payment
Response
string
Unique payment identifier in short ID format
string
Name or description of the payment
string
Type of payment (EXTERNAL or INTERNAL)
string
Current status of the payment (New, Pending, or Confirmed)
string
Timestamp when the payment was created
boolean
Whether this payment requires approval
string
Current approval status (Waiting, Pending, Approved, or Decline)
string
Transaction hash on the blockchain (if processed immediately)
{
"id": "payee_wDG5cavUCoK53uvFzTvkey",
"name": "Vendor XYZ Payment",
"type": "EXTERNAL",
"status": "New",
"approvalstatus": "Waiting",
"approvalRequired": true,
"createdat": "2025-04-17T10:28:18.512792",
"txHash": null
}
{
"id": "payee_xFG8eqvUXeK23zmFwTasLc",
"name": "Small transaction",
"type": "INTERNAL",
"status": "Confirmed",
"approvalstatus": "Approved",
"approvalRequired": false,
"createdat": "2025-04-17T10:30:22Z",
"txHash": "0xabc123..."
}
{
"error": "Insufficient balance in sender agent's wallet"
// OR
"error": "Required fields missing: senderagentid, receiveragentid, paymentdetails, name, type"
// OR
"error": "Invalid payment details. Amount must be positive."
}
{
"error": "Invalid or missing API key"
}
{
"error": "Internal Server Error"
}
{
"error": "Sender agent not found"
}
Status Codes
| Status Code | Description |
|---|---|
| 200 | Payment registered successfully |
| 400 | Bad Request - Invalid parameters or insufficient balance |
| 401 | Unauthorized - Invalid or missing API key |
| 404 | Not Found - Agent not found |
| 500 | Internal Server Error |
Payment Limits: The payment will fail if it exceeds the sender agentâs transaction or daily limits.
Payment Types: Use âEXTERNALâ for payments to recipients outside your agent network and âINTERNALâ for payments between your own agents.
Approval Flow: Payments requiring approval will need to be approved using the Approve Payment endpoint before they are processed.