GoRules Version 2 is here - redesigned, now with managed cloud.GoRules Version 2 is here!
Watch the launch videoWatchPayment Routing & Fee Calculator
Intelligent payment processing that determines optimal routing paths, calculates precise fees, and applies security measures per transaction.
Solution
This payment processing system dynamically routes transactions through the most appropriate payment channels while calculating precise fees and enforcing security measures tailored to each transaction. The solution evaluates payment type (credit card, debit card, bank transfer, cryptocurrency, digital wallet) and automatically selects the optimal processor with appropriate base fee rates.
Channel-specific routing logic adjusts fees and risk assessments based on whether transactions occur via web, mobile, point-of-sale, or API integrations. Transaction amount thresholds trigger graduated security measures, from standard verification for small amounts to enhanced 3D Secure and manual review for large transactions. The system calculates final fees by combining base percentages with channel and amount-based adjustments, while implementing appropriate security protocols including fraud scanning, velocity checks, and verification requirements matched to the risk profile.
How it works
The payment routing system follows a logical sequence:
- Payment Type Analysis: Identifies the transaction type (credit card, debit, ACH, crypto, digital wallet) and assigns the corresponding processor, base fee, and initial risk score.
- Channel Evaluation: Assesses the submission channel (web, mobile, POS, API) and adjusts fees and risk scores accordingly.
- Amount-Based Processing: Applies graduated fee adjustments and security requirements based on transaction value, with special rules for specific payment routes.
- Fee Calculation: Combines all fee components (base percentage, channel additions, amount adjustments) to determine the final fee amount, enforcing minimum fee requirements.
- Security Verification: Calculates total risk score from all factors to determine necessary verification methods, fraud scan levels, velocity checks, and potential manual review requirements.
Where teams use it
- E-commerce payment processing
- Omnichannel retail transactions
- Subscription billing systems
- Marketplace payment distribution
- Cross-border commerce
- High-value B2B transactions
Inside the decision model
Payment Routing & Fee Calculator ships as a JDM decision graph with 6 nodes, 3 decision tables and 20 rules. Download it, load it into GoRules, and run it as-is on Zen Engine.
Payment Request
inputA payment object with the type, amount, and channel does most of the work downstream, while the merchant profile and session context (device, location) travel along for enrichment.
Sample requestJSON
{
"payment": {
"id": "pmt_12345678",
"type": "credit_card",
"amount": 2500,
"currency": "USD",
"channel": "web",
"timestamp": "2025-03-18T10:30:45Z",
"customer_id": "cust_87654321",
"metadata": {
"card_last_four": "4242",
"card_network": "Visa",
"save_for_future": true
}
},
"merchant": {
"id": "merch_98765432",
"category": "retail",
"country": "US",
"processing_history": {
"total_transactions": 1256,
"average_amount": 175.5,
"chargeback_rate": 0.2
}
},
"session": {
"ip_address": "192.168.1.1",
"device_id": "dev_abcdef123456",
"browser": "Chrome",
"location": {
"country": "US",
"state": "CA",
"city": "San Francisco"
}
}
}Payment Type Processing
tableEach payment.type maps to a processor, a base fee, and a starting risk score under a first hit policy: 'credit_card' routes to 'credit_processor' at 2.9 percent with a risk score of 25, 'debit_card' to 'debit_processor' at 1.5 and 15, 'bank_transfer' to 'ach_processor' at 1.0 and 10, 'cryptocurrency' to 'crypto_processor' at 1.8 and 35, and 'digital_wallet' to 'wallet_processor' at 2.5 and 20. Unrecognized types hit the default row at 3.5 percent and a risk score of 50.
The fee ladder tracks real acquiring economics: 2.9 percent is a common headline rate for card-not-present credit card processing, debit interchange runs materially cheaper, and ACH transfers are the cheapest rail of all. Cryptocurrency starts with the highest risk score of the named types because settlement is irreversible, and pricing the unknown default worst is a standard defensive posture.
| Payment Typepayment.type | Processor Routerouting.processor | Base Fee Percentagefee.base_percentage | Risk Scoresecurity.base_risk_score |
|---|---|---|---|
| 'credit_card' | 'credit_processor' | 2.9 | 25 |
| 'debit_card' | 'debit_processor' | 1.5 | 15 |
| 'bank_transfer' | 'ach_processor' | 1.0 | 10 |
| 'cryptocurrency' | 'crypto_processor' | 1.8 | 35 |
| 'digital_wallet' | 'wallet_processor' | 2.5 | 20 |
| - | 'default_processor' | 3.5 | 50 |
Channel Routing
tableFees and risk are adjusted per payment.channel, with each of 'web', 'mobile', and 'pos' split on whether the base risk score exceeds 30: web adds 0.5 fee and 15 risk in the high-risk split versus 0.3 and 5 below it, mobile runs 0.8/20 against 0.5/10, and 'pos' adds at most 5 risk. The 'api' row applies a flat 0.1 fee addition with 'high' priority regardless of score, and the default channel is priced at 1.0 with 25 risk and 'low' priority.
Card-present POS traffic carrying the lowest risk additions mirrors the industry's card-present versus card-not-present distinction, since a physically presented card is far harder to abuse than a typed-in number. The near-free 'api' row reflects trusted server-to-server integrations where the merchant has already been vetted, and the priority field lets clean channels jump the processing queue.
| Channelpayment.channel | Base Risk Scoresecurity.base_risk_score | Channel Fee Additionfee.channel_addition | Channel Risk Additionsecurity.channel_risk_addition | Processing Priorityrouting.priority |
|---|---|---|---|---|
| 'web' | > 30 | 0.5 | 15 | 'low' |
| 'web' | <= 30 | 0.3 | 5 | 'medium' |
| 'mobile' | > 30 | 0.8 | 20 | 'low' |
| 'mobile' | <= 30 | 0.5 | 10 | 'medium' |
| 'pos' | > 30 | 1.0 | 5 | 'medium' |
| 'pos' | <= 30 | 0.8 | 0 | 'high' |
+2 more rows in the downloadable template
Amount Based Processing
tableValue tiers set both a fee adjustment and a security posture: payments of 10000 or more take a -0.5 fee discount but add 30 to security risk and demand '3ds_and_manual' verification, the 5000 to 10000 band gets -0.3 with '3ds', 1000 to 5000 keeps fees flat with a 'cvv_check', and under 1000 pays a 0.5 premium with 'standard' checks. Two route-specific rows at the bottom define ach_processor and crypto_processor handling at 5000 and above ('account_verification' and 'blockchain_verification'), though under the first hit policy the generic amount rows above them match first.
Discounting large transactions while hardening their verification is standard acquiring practice: percentage fees over-recover on big tickets, so processors rebate them, while absolute fraud exposure grows with size, which is why 3D Secure and manual review gate the top tier. The 1000/5000/10000 breakpoints themselves are business calibration, not a regulatory schedule.
| Payment Amountpayment.amount | Processor Routerouting.processor | Amount-based Fee Adjustmentfee.amount_adjustment | Amount-based Security Additionsecurity.amount_risk_addition | Verification Methodsecurity.verification_method |
|---|---|---|---|---|
| >= 10000 | - | -0.5 | 30 | '3ds_and_manual' |
| >= 5000, < 10000 | - | -0.3 | 20 | '3ds' |
| >= 1000, < 5000 | - | 0 | 10 | 'cvv_check' |
| < 1000 | - | 0.5 | 0 | 'standard' |
| >= 5000 | 'ach_processor' | -0.8 | 15 | 'account_verification' |
| >= 5000 | 'crypto_processor' | 0 | 40 | 'blockchain_verification' |
Fee Calculation
expressionAll three components merge here: final_fee_percentage sums fee.base_percentage, fee.channel_addition, and fee.amount_adjustment, fee_amount applies that rate to payment.amount, and a floor expression keeps fee.final_amount at no less than 0.5. The node also derives payment.net_amount, the figure the merchant actually receives, so settlement logic downstream needs no arithmetic of its own.
fee.base_percentage + fee.channel_addition + fee.amount_adjustmentpayment.amount * ($.final_fee_percentage / 100)$.fee_amount < 0.5 ? 0.5 : $.fee_amountpayment.amount - $.fee.final_amountSecurity Verification
expressionRisk contributions from type, channel, and amount are added into security.total_risk_score, which then gates everything else: a high_risk_flag at 50 or more triggers manual review, velocity_check_required starts at 30, and fraud_scan_level steps through 'minimal', 'basic', 'standard', and 'enhanced' at the 25, 50, and 75 marks. The final processing_instructions object packages processor, priority, and every security decision into one directive for the payment gateway.
security.base_risk_score + security.channel_risk_addition + security.amount_risk_addition$.security.total_risk_score >= 50$.security.total_risk_score >= 30$.security.total_risk_score >= 75 ? "enhanced" : $.security.total_risk_score >= 50 ? "standard" : $.security.total_risk_score >= 25 ? "basic" : "minimal"{
"priority": routing.priority,
"processor": routing.processor,
"verification_required": security.verification_method,
"fraud_scan": $.security.fraud_scan_level,
"velocity_check": $.security.velocity_check_required,
"manual_review": $.security.high_risk_flag
}Other Financial templates
View all templatesLoan Approval
Automated system that evaluates credit scores, income, debt ratios, and employment history to determine mortgage eligibility and personalized interest rates.
FinancialReal-Time Fraud Detection
Advanced transaction monitoring system that identifies suspicious financial activities using location analysis, spending patterns, and behavioral anomalies.
FinancialCustomer Onboarding KYC Verification
Automated compliance checks that validate identity documents, screen against watchlists, and apply risk-based due diligence during onboarding.
Make this template
your own.
Load Payment Routing & Fee Calculator into GoRules, adjust the rules to your policy, and ship it behind your own API.