v2.0

GoRules Version 2 is here - redesigned, now with managed cloud.GoRules Version 2 is here!

Watch the launch videoWatch

Payment 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:

  1. 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.
  2. Channel Evaluation: Assesses the submission channel (web, mobile, POS, API) and adjusts fees and risk scores accordingly.
  3. Amount-Based Processing: Applies graduated fee adjustments and security requirements based on transaction value, with special rules for specific payment routes.
  4. Fee Calculation: Combines all fee components (base percentage, channel additions, amount adjustments) to determine the final fee amount, enforcing minimum fee requirements.
  5. 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.

Decision graph6 nodes · read-only
input payment-requesttable payment-type-processingtable channel-routingtable amount-based-processingexpression fee-calculationexpression security-verification
01

Payment Request

input

A 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"
    }
  }
}
02

Payment Type Processing

table

Each 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.

Decision tablefirst hit policy
Payment Typepayment.typeProcessor Routerouting.processorBase Fee Percentagefee.base_percentageRisk Scoresecurity.base_risk_score
'credit_card''credit_processor'2.925
'debit_card''debit_processor'1.515
'bank_transfer''ach_processor'1.010
'cryptocurrency''crypto_processor'1.835
'digital_wallet''wallet_processor'2.520
-'default_processor'3.550
03

Channel Routing

table

Fees 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.

Decision tablefirst hit policy
Channelpayment.channelBase Risk Scoresecurity.base_risk_scoreChannel Fee Additionfee.channel_additionChannel Risk Additionsecurity.channel_risk_additionProcessing Priorityrouting.priority
'web'> 300.515'low'
'web'<= 300.35'medium'
'mobile'> 300.820'low'
'mobile'<= 300.510'medium'
'pos'> 301.05'medium'
'pos'<= 300.80'high'

+2 more rows in the downloadable template

04

Amount Based Processing

table

Value 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.

Decision tablefirst hit policy
Payment Amountpayment.amountProcessor Routerouting.processorAmount-based Fee Adjustmentfee.amount_adjustmentAmount-based Security Additionsecurity.amount_risk_additionVerification Methodsecurity.verification_method
>= 10000--0.530'3ds_and_manual'
>= 5000, < 10000--0.320'3ds'
>= 1000, < 5000-010'cvv_check'
< 1000-0.50'standard'
>= 5000'ach_processor'-0.815'account_verification'
>= 5000'crypto_processor'040'blockchain_verification'
05

Fee Calculation

expression

All 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.

Expressions4 fields
final_fee_percentagefee.base_percentage + fee.channel_addition + fee.amount_adjustment
fee_amountpayment.amount * ($.final_fee_percentage / 100)
fee.final_amount$.fee_amount < 0.5 ? 0.5 : $.fee_amount
payment.net_amountpayment.amount - $.fee.final_amount
06

Security Verification

expression

Risk 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.

Expressions5 fields
security.total_risk_scoresecurity.base_risk_score + security.channel_risk_addition + security.amount_risk_addition
security.high_risk_flag$.security.total_risk_score >= 50
security.velocity_check_required$.security.total_risk_score >= 30
security.fraud_scan_level$.security.total_risk_score >= 75 ? "enhanced" : $.security.total_risk_score >= 50 ? "standard" : $.security.total_risk_score >= 25 ? "basic" : "minimal"
routing.processing_instructions{ "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 }

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.