SureSafe AI - Fraud detection SDK for Bank Transfer, Credit Card, Online Payment, and UPI transactions
Project description
SureSafe AI
A unified Python SDK for fraud detection across multiple transaction types using machine learning models.
Installation
pip install suresafe-ai
Quick Start
from suresafe_ai import create_client
client = create_client(
base_url="https://api.yoursite.com",
api_key="your-api-key"
)
# Check service health
health = client.health_check()
print(health)
# {'bank_transfer': True, 'credit_card': True, 'online_payment': True, 'upi': True}
Available Methods
Bank Transfer Fraud Detection
4-model ensemble (Isolation Forest, LOF, One-Class SVM, MCD + XGBoost)
result = client.bank_transfer(
TransactionAmount=1500,
TransactionType="Debit",
Location="Houston",
DeviceID="D000051",
MerchantID="M052",
Channel="Online",
CustomerAge=35,
CustomerOccupation="Engineer",
TransactionDuration=120,
LoginAttempts=1,
AccountBalance=5000,
Hour=14,
DayOfWeek=2,
Month=6
)
print(result.is_fraud) # True
print(result.fraud_probability) # 0.32
print(result.risk_level) # 'HIGH'
print(result.model_votes) # 3
Credit Card Fraud Detection
3-model ensemble (XGBoost, LightGBM, CatBoost)
result = client.credit_card(
amt=500,
merchant="amazon_store",
category="shopping_net",
gender="M",
job="Engineer",
lat=33.96,
long=-80.93,
city_pop=333497,
merch_lat=33.98,
merch_long=-81.20,
hour=14,
day_of_week=2,
month=6,
age=35
)
print(result.prediction) # 'SAFE'
print(result.risk_level) # 'LOW'
Online Payment Fraud Detection
Random Forest classifier with balance flow analysis
result = client.online_payment(
amount=5000,
oldbalanceOrg=10000,
newbalanceOrig=5000,
oldbalanceDest=20000,
newbalanceDest=25000,
isFlaggedFraud=0
)
print(result.fraud_probability) # 0.02
UPI Fraud Detection
Random Forest with Indian banking features
result = client.upi(
amount=5000,
transaction_type="P2P",
merchant_category="Shopping",
sender_age_group="26-35",
receiver_age_group="26-35",
sender_state="Delhi",
sender_bank="SBI",
receiver_bank="ICICI",
device_type="Android",
network_type="4G",
hour_of_day=14,
is_weekend=0
)
print(result.risk_level) # 'MEDIUM'
Response Format
All methods return a FraudResult object:
@dataclass
class FraudResult:
is_fraud: bool # True if fraud detected
fraud_probability: float # 0-1 probability score
prediction: str # 'FRAUD' or 'SAFE'
risk_level: str # 'HIGH', 'MEDIUM', or 'LOW'
Bank transfer results include additional fields:
model_votes: Number of models that flagged as fraud (0-4)details: Individual model predictions
Error Handling
from suresafe_ai import create_client
client = create_client(base_url="http://localhost")
try:
result = client.bank_transfer(...)
except ConnectionError as e:
print("Server not reachable:", e)
except TimeoutError as e:
print("Request timed out:", e)
except Exception as e:
print("API error:", e)
License
MIT
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file suresafe_ai-1.0.0.tar.gz.
File metadata
- Download URL: suresafe_ai-1.0.0.tar.gz
- Upload date:
- Size: 7.2 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.2.0 CPython/3.12.3
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
60fba562087df2f8688a448057b8e3c9ec7f111087ff77a53294c4e096da29c3
|
|
| MD5 |
edad7738eb8aab947d4ac02b3a3968f7
|
|
| BLAKE2b-256 |
ca0ee291ea746ef39c54a9891f85161351617730a4618a7ab8e9dd130aacbf7e
|
File details
Details for the file suresafe_ai-1.0.0-py3-none-any.whl.
File metadata
- Download URL: suresafe_ai-1.0.0-py3-none-any.whl
- Upload date:
- Size: 7.1 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.2.0 CPython/3.12.3
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
373e37601656518e4ddcbb081d4fac7c6d53998f16098c63cabc53c8ba5852bb
|
|
| MD5 |
42c351c5ce8a0832a58437588558a269
|
|
| BLAKE2b-256 |
f780ed1cba5696dad325b78c63cc5dcda9efab004bee7f76f41cbdeac12b9d6b
|