Approve Payment
curl --request POST \
--url https://api.magebank.ai/payments/setApprove \
--header 'Content-Type: application/json' \
--header 'x-api-key: <x-api-key>' \
--data '
{
"paymentId": "<string>"
}
'import requests
url = "https://api.magebank.ai/payments/setApprove"
payload = { "paymentId": "<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({paymentId: '<string>'})
};
fetch('https://api.magebank.ai/payments/setApprove', 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/setApprove",
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([
'paymentId' => '<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/setApprove"
payload := strings.NewReader("{\n \"paymentId\": \"<string>\"\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/setApprove")
.header("x-api-key", "<x-api-key>")
.header("Content-Type", "application/json")
.body("{\n \"paymentId\": \"<string>\"\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.magebank.ai/payments/setApprove")
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 \"paymentId\": \"<string>\"\n}"
response = http.request(request)
puts response.read_body{
"message": "Approval Status Done."
}
{
"error": "Payment ID is required"
}
{
"error": "Payment not found"
}
{
"error": "Internal server error"
}
Payments
Approve Payment
Approve a payment that requires authorization
POST
/
payments
/
setApprove
Approve Payment
curl --request POST \
--url https://api.magebank.ai/payments/setApprove \
--header 'Content-Type: application/json' \
--header 'x-api-key: <x-api-key>' \
--data '
{
"paymentId": "<string>"
}
'import requests
url = "https://api.magebank.ai/payments/setApprove"
payload = { "paymentId": "<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({paymentId: '<string>'})
};
fetch('https://api.magebank.ai/payments/setApprove', 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/setApprove",
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([
'paymentId' => '<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/setApprove"
payload := strings.NewReader("{\n \"paymentId\": \"<string>\"\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/setApprove")
.header("x-api-key", "<x-api-key>")
.header("Content-Type", "application/json")
.body("{\n \"paymentId\": \"<string>\"\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.magebank.ai/payments/setApprove")
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 \"paymentId\": \"<string>\"\n}"
response = http.request(request)
puts response.read_body{
"message": "Approval Status Done."
}
{
"error": "Payment ID is required"
}
{
"error": "Payment not found"
}
{
"error": "Internal server error"
}
Authorization Step: Approve payments that are waiting for authorization to proceed with blockchain fund transfer.
Request Headers
string
required
Your API key for authentication
Request Body
string
required
The short ID of the payment to approve
Response
string
Confirmation message indicating the approval status has been updated
{
"message": "Approval Status Done."
}
{
"error": "Payment ID is required"
}
{
"error": "Payment not found"
}
{
"error": "Internal server error"
}
Status Codes
| Status Code | Description |
|---|---|
| 200 | Payment approved successfully |
| 400 | Bad Request - Missing payment ID |
| 404 | Not Found - Payment not found |
| 500 | Internal Server Error |
Status Transition: Only payments with an approval status of “Waiting for Sender Approval” can be approved.
Post-Approval Process: Once approved, the payment will be processed on the blockchain and its status will change to “New”, then to “Confirmed” once processed.