curl --request POST \
--url https://mag3nt.com/api/ap2/settle \
--header 'Authorization: <api-key>' \
--header 'Content-Type: application/json' \
--data '
{
"pay_link_code": "pl_a1b2c3d4",
"closed_mandate": "<string>",
"card_token": "<string>",
"open_mandate": "<string>"
}
'import requests
url = "https://mag3nt.com/api/ap2/settle"
payload = {
"pay_link_code": "pl_a1b2c3d4",
"closed_mandate": "<string>",
"card_token": "<string>",
"open_mandate": "<string>"
}
headers = {
"Authorization": "<api-key>",
"Content-Type": "application/json"
}
response = requests.post(url, json=payload, headers=headers)
print(response.text)const options = {
method: 'POST',
headers: {Authorization: '<api-key>', 'Content-Type': 'application/json'},
body: JSON.stringify({
pay_link_code: 'pl_a1b2c3d4',
closed_mandate: '<string>',
card_token: '<string>',
open_mandate: '<string>'
})
};
fetch('https://mag3nt.com/api/ap2/settle', 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://mag3nt.com/api/ap2/settle",
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([
'pay_link_code' => 'pl_a1b2c3d4',
'closed_mandate' => '<string>',
'card_token' => '<string>',
'open_mandate' => '<string>'
]),
CURLOPT_HTTPHEADER => [
"Authorization: <api-key>",
"Content-Type: application/json"
],
]);
$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://mag3nt.com/api/ap2/settle"
payload := strings.NewReader("{\n \"pay_link_code\": \"pl_a1b2c3d4\",\n \"closed_mandate\": \"<string>\",\n \"card_token\": \"<string>\",\n \"open_mandate\": \"<string>\"\n}")
req, _ := http.NewRequest("POST", url, payload)
req.Header.Add("Authorization", "<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://mag3nt.com/api/ap2/settle")
.header("Authorization", "<api-key>")
.header("Content-Type", "application/json")
.body("{\n \"pay_link_code\": \"pl_a1b2c3d4\",\n \"closed_mandate\": \"<string>\",\n \"card_token\": \"<string>\",\n \"open_mandate\": \"<string>\"\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://mag3nt.com/api/ap2/settle")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Post.new(url)
request["Authorization"] = '<api-key>'
request["Content-Type"] = 'application/json'
request.body = "{\n \"pay_link_code\": \"pl_a1b2c3d4\",\n \"closed_mandate\": \"<string>\",\n \"card_token\": \"<string>\",\n \"open_mandate\": \"<string>\"\n}"
response = http.request(request)
puts response.read_body{
"status": "ALREADY_SETTLED"
}{
"status": "SETTLED",
"protocol": "ap2",
"settlement_id": "<string>",
"mandate_id": "<string>",
"pay_link_code": "<string>",
"amount": 123,
"fee": 123,
"net_amount": 123,
"tx_hash": "<string>",
"payee": "<string>"
}{
"error": "Card not found"
}{
"error": "Card not found"
}{
"error": "Card not found"
}{
"error": "Card not found"
}Settle a pay link with a closed AP2 Payment Mandate
Settles a mag3nt pay link by consuming a closed AP2 Payment Mandate (mandate.payment.1). The mandate is verified for signature, expiry, and payee scoping against the link; if an open mandate is supplied, the open→closed chain is re-verified. The payer card named by the mandate is authenticated via its card token, then the payer card is debited and the link credited atomically. Idempotent on the mandate jti (replay-safe).
curl --request POST \
--url https://mag3nt.com/api/ap2/settle \
--header 'Authorization: <api-key>' \
--header 'Content-Type: application/json' \
--data '
{
"pay_link_code": "pl_a1b2c3d4",
"closed_mandate": "<string>",
"card_token": "<string>",
"open_mandate": "<string>"
}
'import requests
url = "https://mag3nt.com/api/ap2/settle"
payload = {
"pay_link_code": "pl_a1b2c3d4",
"closed_mandate": "<string>",
"card_token": "<string>",
"open_mandate": "<string>"
}
headers = {
"Authorization": "<api-key>",
"Content-Type": "application/json"
}
response = requests.post(url, json=payload, headers=headers)
print(response.text)const options = {
method: 'POST',
headers: {Authorization: '<api-key>', 'Content-Type': 'application/json'},
body: JSON.stringify({
pay_link_code: 'pl_a1b2c3d4',
closed_mandate: '<string>',
card_token: '<string>',
open_mandate: '<string>'
})
};
fetch('https://mag3nt.com/api/ap2/settle', 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://mag3nt.com/api/ap2/settle",
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([
'pay_link_code' => 'pl_a1b2c3d4',
'closed_mandate' => '<string>',
'card_token' => '<string>',
'open_mandate' => '<string>'
]),
CURLOPT_HTTPHEADER => [
"Authorization: <api-key>",
"Content-Type: application/json"
],
]);
$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://mag3nt.com/api/ap2/settle"
payload := strings.NewReader("{\n \"pay_link_code\": \"pl_a1b2c3d4\",\n \"closed_mandate\": \"<string>\",\n \"card_token\": \"<string>\",\n \"open_mandate\": \"<string>\"\n}")
req, _ := http.NewRequest("POST", url, payload)
req.Header.Add("Authorization", "<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://mag3nt.com/api/ap2/settle")
.header("Authorization", "<api-key>")
.header("Content-Type", "application/json")
.body("{\n \"pay_link_code\": \"pl_a1b2c3d4\",\n \"closed_mandate\": \"<string>\",\n \"card_token\": \"<string>\",\n \"open_mandate\": \"<string>\"\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://mag3nt.com/api/ap2/settle")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Post.new(url)
request["Authorization"] = '<api-key>'
request["Content-Type"] = 'application/json'
request.body = "{\n \"pay_link_code\": \"pl_a1b2c3d4\",\n \"closed_mandate\": \"<string>\",\n \"card_token\": \"<string>\",\n \"open_mandate\": \"<string>\"\n}"
response = http.request(request)
puts response.read_body{
"status": "ALREADY_SETTLED"
}{
"status": "SETTLED",
"protocol": "ap2",
"settlement_id": "<string>",
"mandate_id": "<string>",
"pay_link_code": "<string>",
"amount": 123,
"fee": 123,
"net_amount": 123,
"tx_hash": "<string>",
"payee": "<string>"
}{
"error": "Card not found"
}{
"error": "Card not found"
}{
"error": "Card not found"
}{
"error": "Card not found"
}Authorizations
API key prefixed with 'Bearer sx_live_...'
Body
Code of the pay link being settled.
"pl_a1b2c3d4"
Closed AP2 Payment Mandate (mandate.payment.1) as an SD-JWT.
Token of the payer card named by the mandate (authorizes the debit).
Optional open AP2 mandate; when present the open→closed chain is re-verified.
Response
Mandate already settled (idempotent replay)
"ALREADY_SETTLED"