Decline Payment
curl --request POST \
--url https://api.magebank.ai/payments/setDecline \
--header 'Content-Type: application/json' \
--header 'x-api-key: <x-api-key>' \
--data '
{
"paymentId": "<string>"
}
'import requests
url = "https://api.magebank.ai/payments/setDecline"
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/setDecline', 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/setDecline",
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/setDecline"
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/setDecline")
.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/setDecline")
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": "Payment declined successfully",
"status": "Decline",
"txHash": null
}
{
"error": "Payment ID is required"
}
{
"error": "Payment not found"
}
```json 500
{
"error": "Internal Server Error"
}
Payments
Decline Payment
Decline a payment to prevent processing
POST
/
payments
/
setDecline
Decline Payment
curl --request POST \
--url https://api.magebank.ai/payments/setDecline \
--header 'Content-Type: application/json' \
--header 'x-api-key: <x-api-key>' \
--data '
{
"paymentId": "<string>"
}
'import requests
url = "https://api.magebank.ai/payments/setDecline"
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/setDecline', 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/setDecline",
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/setDecline"
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/setDecline")
.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/setDecline")
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": "Payment declined successfully",
"status": "Decline",
"txHash": null
}
{
"error": "Payment ID is required"
}
{
"error": "Payment not found"
}
```json 500
{
"error": "Internal Server Error"
}
Rejection Action: Cancel pending payments by declining them, which prevents any funds from being transferred.
Request Headers
string
required
Your API key for authentication
Request Body
string
required
The short ID of the payment to decline
Response
string
Confirmation message indicating the payment was declined
string
The new approval status (“Decline”)
string
Transaction hash (will be null for declined payments)
{
"message": "Payment declined successfully",
"status": "Decline",
"txHash": null
}
{
"error": "Payment ID is required"
}
{
"error": "Payment not found"
}
```json 500
{
"error": "Internal Server Error"
}
Status Codes
| Status Code | Description |
|---|---|
| 200 | Payment declined successfully |
| 400 | Bad Request - Missing payment ID |
| 404 | Not Found - Payment not found |
| 500 | Internal Server Error |
Final Action: Declined payments cannot be later approved. A new payment must be created if necessary.
Status Change: The payment’s status will be updated to “Confirmed” with an approval status of “Decline”.