Order Verification API
AI-powered fraud detection for e-commerce orders.
Overview
The Order Verification API analyzes order data to detect potential fraud. It examines customer information, addresses, payment details, order patterns, and technical signals to provide a risk assessment with actionable recommendations.
Verify Order
Analyze an order for fraud risk.
Endpoint: POST /api/{organization}/order-verification
Request Body
Order Information
| Field |
Type |
Required |
Description |
orderId |
string |
No |
Your order identifier for reference |
orderAmount |
number |
Yes |
Order total (positive number) |
currency |
string |
Yes |
3-letter currency code (e.g., "USD") |
orderTimestamp |
string |
No |
ISO 8601 datetime of order |
items |
array |
No |
Order items (see below) |
Customer Information
| Field |
Type |
Required |
Description |
customerName |
string |
Yes |
Customer full name (max 255 chars) |
customerEmail |
string |
Yes |
Customer email address |
customerPhone |
string |
No |
Customer phone (max 50 chars) |
isFirstTimeCustomer |
boolean |
Yes |
First-time customer flag |
accountAgeInDays |
number |
No |
Account age in days |
Customer History (Optional)
| Field |
Type |
Required |
Description |
totalOrders |
number |
No |
Total completed orders |
cancelledOrders |
number |
No |
Number of cancelled orders |
returnedOrders |
number |
No |
Number of returned orders |
fulfilledOrders |
number |
No |
Number of fulfilled orders |
averageOrderValue |
number |
No |
Customer's average order value |
Company Information (Optional)
| Field |
Type |
Required |
Description |
companyName |
string |
No |
Company name for B2B orders |
companyAddress |
string |
No |
Company address |
Addresses
| Field |
Type |
Required |
Description |
shippingAddress |
object |
Yes |
Shipping address |
billingAddress |
object |
Yes |
Billing address |
Address Object:
| Field |
Type |
Required |
Description |
street |
string |
Yes |
Street address (max 500 chars) |
city |
string |
Yes |
City (max 100 chars) |
state |
string |
Yes |
State/Province (max 100 chars) |
postalCode |
string |
Yes |
Postal code (max 20 chars) |
country |
string |
Yes |
Country (max 100 chars) |
Payment Information (Optional)
| Field |
Type |
Required |
Description |
brand |
string |
No |
Card brand (e.g., "Visa") |
lastFourDigits |
string |
No |
Last 4 digits of the card |
expiry |
string |
No |
Card expiry (e.g., "12/25") |
holderName |
string |
No |
Name on the card (max 255 chars) |
Technical Data (Optional)
| Field |
Type |
Required |
Description |
ipAddress |
string |
No |
Customer IP (IPv4 or IPv6) |
userAgent |
string |
No |
Browser user agent (max 1000 chars) |
Order Items (Optional)
| Field |
Type |
Required |
Description |
name |
string |
Yes |
Item name (max 255 chars) |
quantity |
number |
Yes |
Quantity (positive integer) |
price |
number |
Yes |
Price (positive number) |
sku |
string |
No |
Product SKU (max 100 chars) |
Example Request
curl -X POST https://verify-ai.tdcapps.com/api/your-org/order-verification \
-H "Authorization: Bearer YOUR_API_KEY" \
-H "Content-Type: application/json" \
-d '{
"orderId": "ORD-12345",
"orderAmount": 299.99,
"currency": "USD",
"orderTimestamp": "2024-01-15T14:30:00Z",
"items": [
{
"name": "Wireless Headphones",
"quantity": 1,
"price": 299.99,
"sku": "WH-1000"
}
],
"customerName": "John Doe",
"customerEmail": "john.doe@example.com",
"customerPhone": "+1234567890",
"isFirstTimeCustomer": false,
"accountAgeInDays": 180,
"totalOrders": 3,
"fulfilledOrders": 2,
"averageOrderValue": 150.00,
"shippingAddress": {
"street": "123 Main Street",
"city": "New York",
"state": "NY",
"postalCode": "10001",
"country": "United States"
},
"billingAddress": {
"street": "123 Main Street",
"city": "New York",
"state": "NY",
"postalCode": "10001",
"country": "United States"
},
"paymentInfo": {
"brand": "Visa",
"lastFourDigits": "4242",
"expiry": "12/26",
"holderName": "John Doe"
},
"ipAddress": "192.168.1.1",
"userAgent": "Mozilla/5.0 (Windows NT 10.0; Win64; x64)..."
}'
Response
{
"success": true,
"data": {
"riskScore": 25,
"riskLevel": "low",
"riskFactors": [
{
"factor": "IP Location Mismatch",
"severity": "low",
"description": "IP address location differs from shipping address, but within same country.",
"category": "technical"
}
],
"reasoning": "This order shows low fraud risk. The customer has an established account history with 3 previous orders, and both billing and shipping addresses match. The email domain is legitimate and not associated with fraud databases.",
"recommendations": [
"Process order normally",
"No additional verification required"
]
}
}
Response Fields
Risk Score
| Score Range |
Risk Level |
Recommended Action |
| 0-30 |
Low |
Process normally |
| 31-60 |
Medium |
Manual review recommended |
| 61-85 |
High |
Verify before processing |
| 86-100 |
Critical |
Reject or require verification |
Risk Factors
Each risk factor includes:
| Field |
Description |
factor |
Brief description of the risk |
severity |
low, medium, high, or critical |
description |
Detailed explanation |
category |
customer, address, technical, or behavioral |
Risk Categories
| Category |
Examples |
customer |
Disposable email, fraud database match |
address |
Invalid address, billing/shipping mismatch |
technical |
VPN usage, suspicious IP |
behavioral |
Unusual order patterns, velocity issues |
Integration Examples
E-commerce Checkout
async function verifyOrderAtCheckout(orderData) {
const response = await fetch(
'https://verify-ai.tdcapps.com/api/your-org/order-verification',
{
method: 'POST',
headers: {
Authorization: `Bearer ${API_KEY}`,
'Content-Type': 'application/json'
},
body: JSON.stringify(orderData)
}
)
const result = await response.json()
if (!result.success) {
throw new Error(result.message)
}
const { riskScore, riskLevel, recommendations } = result.data
// Handle based on risk level
if (riskLevel === 'critical') {
return { action: 'reject', reason: 'High fraud risk detected' }
}
if (riskLevel === 'high') {
return { action: 'review', reason: 'Manual review required' }
}
return { action: 'approve' }
}
Order Event Integration
Use with your e-commerce platform's order-created event handler:
app.post('/orders/new', async (req, res) => {
const order = req.body
// Transform order data to API format
const verificationData = {
orderId: order.id,
orderAmount: order.total,
currency: order.currency,
customerName: order.customer.name,
customerEmail: order.customer.email,
isFirstTimeCustomer: order.customer.ordersCount === 0,
shippingAddress: order.shippingAddress,
billingAddress: order.billingAddress,
paymentInfo: {
brand: order.payment.brand,
lastFourDigits: order.payment.last4,
expiry: order.payment.expiry,
holderName: order.payment.holderName
}
}
const result = await verifyOrder(verificationData)
// Take action based on result
if (result.data.riskLevel === 'critical') {
await cancelOrder(order.id)
}
res.status(200).send('OK')
})
Best Practices
- Provide Complete Data: More data leads to more accurate assessments
- Include Customer History: Order history significantly improves accuracy
- Handle All Risk Levels: Implement workflows for each risk tier
- Log Results: Store verification results for dispute resolution
- Set Thresholds: Define your acceptable risk levels based on business needs
Error Responses
400 Bad Request
Invalid request parameters:
{
"success": false,
"message": "Invalid request body: ..."
}
402 Payment Required
Insufficient credits:
{
"success": false,
"message": "Insufficient credits. Please purchase credits to continue."
}