Settle a pay link payment
curl --request POST \
--url https://mag3nt.com/api/pay/{code}/settle \
--header 'Content-Type: application/json' \
--data '
{
"payer_card_id": "<string>",
"payer_card_token": "<string>",
"idempotency_key": "<string>"
}
'import requests
url = "https://mag3nt.com/api/pay/{code}/settle"
payload = {
"payer_card_id": "<string>",
"payer_card_token": "<string>",
"idempotency_key": "<string>"
}
headers = {"Content-Type": "application/json"}
response = requests.post(url, json=payload, headers=headers)
print(response.text)const options = {
method: 'POST',
headers: {'Content-Type': 'application/json'},
body: JSON.stringify({
payer_card_id: '<string>',
payer_card_token: '<string>',
idempotency_key: '<string>'
})
};
fetch('https://mag3nt.com/api/pay/{code}/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/pay/{code}/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([
'payer_card_id' => '<string>',
'payer_card_token' => '<string>',
'idempotency_key' => '<string>'
]),
CURLOPT_HTTPHEADER => [
"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/pay/{code}/settle"
payload := strings.NewReader("{\n \"payer_card_id\": \"<string>\",\n \"payer_card_token\": \"<string>\",\n \"idempotency_key\": \"<string>\"\n}")
req, _ := http.NewRequest("POST", url, payload)
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/pay/{code}/settle")
.header("Content-Type", "application/json")
.body("{\n \"payer_card_id\": \"<string>\",\n \"payer_card_token\": \"<string>\",\n \"idempotency_key\": \"<string>\"\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://mag3nt.com/api/pay/{code}/settle")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Post.new(url)
request["Content-Type"] = 'application/json'
request.body = "{\n \"payer_card_id\": \"<string>\",\n \"payer_card_token\": \"<string>\",\n \"idempotency_key\": \"<string>\"\n}"
response = http.request(request)
puts response.read_body{
"status": "SETTLED",
"settlement_id": "<string>",
"amount": 123,
"fee": 123,
"net_amount": 123,
"tx_hash": "<string>",
"mode": "external_protocol",
"protocol": "x402",
"receipt_id": "<string>"
}{
"error": "<string>",
"status": "REJECTED"
}{
"error": "Card not found"
}{
"error": "Card not found"
}{
"error": "Card not found"
}{
"error": "<string>",
"status": "REJECTED"
}{
"error": "<string>",
"status": "<string>",
"code": "<string>"
}Pay Links
Settle a pay link payment
Universal settlement for both humans and agents. Mode is detected from the body: tx_hash (+ optional protocol) settles an on-chain wallet or external-protocol payment (verified on-chain before crediting); protocol + payer_card_id + payer_card_token settles an internal platform card-to-card protocol payment. The destination (merchant treasury vs. on-chain holder) and pricing gate follow the same DIRECT/CUSTODIAL rules as prepare; the settled settlement_mode is delivered on the payment.settled webhook, not in this response.
POST
/
api
/
pay
/
{code}
/
settle
Settle a pay link payment
curl --request POST \
--url https://mag3nt.com/api/pay/{code}/settle \
--header 'Content-Type: application/json' \
--data '
{
"payer_card_id": "<string>",
"payer_card_token": "<string>",
"idempotency_key": "<string>"
}
'import requests
url = "https://mag3nt.com/api/pay/{code}/settle"
payload = {
"payer_card_id": "<string>",
"payer_card_token": "<string>",
"idempotency_key": "<string>"
}
headers = {"Content-Type": "application/json"}
response = requests.post(url, json=payload, headers=headers)
print(response.text)const options = {
method: 'POST',
headers: {'Content-Type': 'application/json'},
body: JSON.stringify({
payer_card_id: '<string>',
payer_card_token: '<string>',
idempotency_key: '<string>'
})
};
fetch('https://mag3nt.com/api/pay/{code}/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/pay/{code}/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([
'payer_card_id' => '<string>',
'payer_card_token' => '<string>',
'idempotency_key' => '<string>'
]),
CURLOPT_HTTPHEADER => [
"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/pay/{code}/settle"
payload := strings.NewReader("{\n \"payer_card_id\": \"<string>\",\n \"payer_card_token\": \"<string>\",\n \"idempotency_key\": \"<string>\"\n}")
req, _ := http.NewRequest("POST", url, payload)
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/pay/{code}/settle")
.header("Content-Type", "application/json")
.body("{\n \"payer_card_id\": \"<string>\",\n \"payer_card_token\": \"<string>\",\n \"idempotency_key\": \"<string>\"\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://mag3nt.com/api/pay/{code}/settle")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Post.new(url)
request["Content-Type"] = 'application/json'
request.body = "{\n \"payer_card_id\": \"<string>\",\n \"payer_card_token\": \"<string>\",\n \"idempotency_key\": \"<string>\"\n}"
response = http.request(request)
puts response.read_body{
"status": "SETTLED",
"settlement_id": "<string>",
"amount": 123,
"fee": 123,
"net_amount": 123,
"tx_hash": "<string>",
"mode": "external_protocol",
"protocol": "x402",
"receipt_id": "<string>"
}{
"error": "<string>",
"status": "REJECTED"
}{
"error": "Card not found"
}{
"error": "Card not found"
}{
"error": "Card not found"
}{
"error": "<string>",
"status": "REJECTED"
}{
"error": "<string>",
"status": "<string>",
"code": "<string>"
}Path Parameters
Body
application/json
Response
Settlement processed (or already settled on idempotent replay)