Predict Transaction Risk
curl --request POST \
--url https://api.revtain.com/api/predict/risk \
--header 'Content-Type: application/json' \
--header 'X-API-KEY: <api-key>' \
--data '
{
"paymentMethodToken": "pm_1234567890",
"amount": 5000,
"currency": "USD"
}
'import requests
url = "https://api.revtain.com/api/predict/risk"
payload = {
"paymentMethodToken": "pm_1234567890",
"amount": 5000,
"currency": "USD"
}
headers = {
"X-API-KEY": "<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': '<api-key>', 'Content-Type': 'application/json'},
body: JSON.stringify({paymentMethodToken: 'pm_1234567890', amount: 5000, currency: 'USD'})
};
fetch('https://api.revtain.com/api/predict/risk', 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.revtain.com/api/predict/risk",
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([
'paymentMethodToken' => 'pm_1234567890',
'amount' => 5000,
'currency' => 'USD'
]),
CURLOPT_HTTPHEADER => [
"Content-Type: application/json",
"X-API-KEY: <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.revtain.com/api/predict/risk"
payload := strings.NewReader("{\n \"paymentMethodToken\": \"pm_1234567890\",\n \"amount\": 5000,\n \"currency\": \"USD\"\n}")
req, _ := http.NewRequest("POST", url, payload)
req.Header.Add("X-API-KEY", "<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.revtain.com/api/predict/risk")
.header("X-API-KEY", "<api-key>")
.header("Content-Type", "application/json")
.body("{\n \"paymentMethodToken\": \"pm_1234567890\",\n \"amount\": 5000,\n \"currency\": \"USD\"\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.revtain.com/api/predict/risk")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Post.new(url)
request["X-API-KEY"] = '<api-key>'
request["Content-Type"] = 'application/json'
request.body = "{\n \"paymentMethodToken\": \"pm_1234567890\",\n \"amount\": 5000,\n \"currency\": \"USD\"\n}"
response = http.request(request)
puts response.read_body{
"success": true,
"prediction": {
"riskScore": 72.5,
"confidence": 68,
"reasoning": "Card has 3 prior declines in last 30 days. Amount matches a historically recoverable pattern.",
"factors": [
"prior_decline_history",
"amount_pattern_match",
"time_of_day_risk"
],
"recommendation": "proceed_with_caution"
}
}{
"error": "Validation failed.",
"details": {
"paymentMethodToken": [
"Payment method token is required"
],
"amount": [
"Amount must be a positive number"
]
}
}{
"error": "Unauthorized. Missing or invalid API key."
}Predictive Risk Engine
Predict Transaction Risk
Predicts the risk score for a transaction before executing it. Use this to pre-screen payments and decide whether to proceed, delay, or block.
Recommendation Values
| Value | Meaning |
|---|---|
proceed | Low risk, charge normally |
proceed_with_caution | Moderate risk, monitor closely |
delay | High risk, consider delaying the charge |
block | Very high risk, do not charge |
POST
/
api
/
predict
/
risk
Predict Transaction Risk
curl --request POST \
--url https://api.revtain.com/api/predict/risk \
--header 'Content-Type: application/json' \
--header 'X-API-KEY: <api-key>' \
--data '
{
"paymentMethodToken": "pm_1234567890",
"amount": 5000,
"currency": "USD"
}
'import requests
url = "https://api.revtain.com/api/predict/risk"
payload = {
"paymentMethodToken": "pm_1234567890",
"amount": 5000,
"currency": "USD"
}
headers = {
"X-API-KEY": "<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': '<api-key>', 'Content-Type': 'application/json'},
body: JSON.stringify({paymentMethodToken: 'pm_1234567890', amount: 5000, currency: 'USD'})
};
fetch('https://api.revtain.com/api/predict/risk', 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.revtain.com/api/predict/risk",
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([
'paymentMethodToken' => 'pm_1234567890',
'amount' => 5000,
'currency' => 'USD'
]),
CURLOPT_HTTPHEADER => [
"Content-Type: application/json",
"X-API-KEY: <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.revtain.com/api/predict/risk"
payload := strings.NewReader("{\n \"paymentMethodToken\": \"pm_1234567890\",\n \"amount\": 5000,\n \"currency\": \"USD\"\n}")
req, _ := http.NewRequest("POST", url, payload)
req.Header.Add("X-API-KEY", "<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.revtain.com/api/predict/risk")
.header("X-API-KEY", "<api-key>")
.header("Content-Type", "application/json")
.body("{\n \"paymentMethodToken\": \"pm_1234567890\",\n \"amount\": 5000,\n \"currency\": \"USD\"\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.revtain.com/api/predict/risk")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Post.new(url)
request["X-API-KEY"] = '<api-key>'
request["Content-Type"] = 'application/json'
request.body = "{\n \"paymentMethodToken\": \"pm_1234567890\",\n \"amount\": 5000,\n \"currency\": \"USD\"\n}"
response = http.request(request)
puts response.read_body{
"success": true,
"prediction": {
"riskScore": 72.5,
"confidence": 68,
"reasoning": "Card has 3 prior declines in last 30 days. Amount matches a historically recoverable pattern.",
"factors": [
"prior_decline_history",
"amount_pattern_match",
"time_of_day_risk"
],
"recommendation": "proceed_with_caution"
}
}{
"error": "Validation failed.",
"details": {
"paymentMethodToken": [
"Payment method token is required"
],
"amount": [
"Amount must be a positive number"
]
}
}{
"error": "Unauthorized. Missing or invalid API key."
}Authorizations
Your Revtain API key (format: rev_xxx). Provided during onboarding.
Body
application/json
Your gateway's payment token. Format varies per gateway — see Supported Gateways for the per-gateway format table covering all 13 supported processors.
Example:
"pm_1234567890"
Amount in cents.
Example:
5000
Example:
"USD"
ISO 8601 date for scheduled transactions. Improves prediction accuracy.
Example:
"2026-04-15T10:00:00.000Z"