const response = await fetch('https://api.layer3x.com/v1/authorize', {
method: 'POST',
headers: {
'Content-Type': 'application/json',
'X-Agent-API-Key': process.env.LAYER3X_API_KEY
},
body: JSON.stringify({
action_key: 'payments.release',
payload: {
amount: 5000,
vendor: 'Acme Corp',
currency: 'USD'
}
})
})
const { decision, reason, request_id } = await response.json()
if (decision === 'ALLOW') {
// proceed with payment execution
} else if (decision === 'ESCALATE') {
// notify human approver, pause execution
} else {
// blocked — log and stop
}