Skip to content

Quick Start

Calculate scheme fees, interchange, and fixed fees for any payment transaction through a single API call.

Prerequisites

Step 1: Get Your API Token

  1. Login to dashboard.recivr.com
  2. Select your entity → Account SettingsAPI Tokens
  3. Click Generate New Token and copy it — you won't see it again

Step 2: Your First API Call

Send a transaction with the 7 required fields + txn_metadata:

bash
curl -X POST "https://api.recivr.com/v1/calculate" \
  -H "Authorization: Bearer YOUR_JWT_TOKEN" \
  -H "Content-Type: application/json" \
  -d '{
    "txn_id": "test-001",
    "txn_amount": "25.00",
    "txn_currency": "EUR",
    "merchant_id": "merchant-123",
    "merchant_country": "DE",
    "card_range": "53635423",
    "mcc": "5411",
    "txn_metadata": {
      "transaction_type": "PURCHASE",
      "entry_mode": "ECOM",
      "transaction_status": "NEW"
    }
  }'
javascript
const response = await fetch('https://api.recivr.com/v1/calculate', {
  method: 'POST',
  headers: {
    'Authorization': 'Bearer YOUR_JWT_TOKEN',
    'Content-Type': 'application/json'
  },
  body: JSON.stringify({
    txn_id: 'test-001',
    txn_amount: '25.00',
    txn_currency: 'EUR',
    merchant_id: 'merchant-123',
    merchant_country: 'DE',
    card_range: '53635423',
    mcc: '5411',
    txn_metadata: {
      transaction_type: 'PURCHASE',
      entry_mode: 'ECOM',
      transaction_status: 'NEW'
    }
  })
});

const result = await response.json();
console.log('Total fees:', result.total_fees_by_currency);
console.log('Scheme:', result.scheme);
console.log('Region:', result.txn_region);
python
import requests

response = requests.post(
    "https://api.recivr.com/v1/calculate",
    headers={
        "Authorization": "Bearer YOUR_JWT_TOKEN",
        "Content-Type": "application/json"
    },
    json={
        "txn_id": "test-001",
        "txn_amount": "25.00",
        "txn_currency": "EUR",
        "merchant_id": "merchant-123",
        "merchant_country": "DE",
        "card_range": "53635423",
        "mcc": "5411",
        "txn_metadata": {
            "transaction_type": "PURCHASE",
            "entry_mode": "ECOM",
            "transaction_status": "NEW"
        }
    }
)

result = response.json()
print(f"Total fees: {result['total_fees_by_currency']}")
print(f"Scheme: {result['scheme']}")
print(f"Region: {result['txn_region']}")

Expected Response

json
{
  "txn_id": "test-001",
  "txn_amount": "25.00",
  "txn_currency": "EUR",
  "scheme": "mastercard",
  "txn_region": "INTRA_EEA",

  "scheme_fees": {
    "total_by_currency": { "EUR": "0.025000" }
  },
  "interchange": {
    "ird_code": "IRF001",
    "rate_percent": "0.20",
    "flat_fee": "0.00",
    "fee_amount": "0.040000",
    "currency": "EUR"
  },
  "fixed_fees": {
    "total_by_currency": { "EUR": "0.005000" }
  },
  "total_fees_by_currency": { "EUR": "0.070000" },

  "included": ["scheme", "interchange", "fixed"]
}

Step 3: Calculation Modes

Control what gets calculated with options.mode:

bash
# Scheme fees only (fastest)
curl -X POST "https://api.recivr.com/v1/calculate" \
  -H "Authorization: Bearer YOUR_JWT_TOKEN" \
  -H "Content-Type: application/json" \
  -d '{
    "txn_id": "test-002",
    "txn_amount": "50.00",
    "txn_currency": "EUR",
    "merchant_id": "merchant-123",
    "merchant_country": "DE",
    "card_range": "53635423",
    "mcc": "5411",
    "options": { "mode": "scheme" },
    "txn_metadata": {
      "transaction_type": "PURCHASE",
      "entry_mode": "ECOM",
      "transaction_status": "AUTHORIZED"
    }
  }'
javascript
const response = await fetch('https://api.recivr.com/v1/calculate', {
  method: 'POST',
  headers: {
    'Authorization': 'Bearer YOUR_JWT_TOKEN',
    'Content-Type': 'application/json'
  },
  body: JSON.stringify({
    txn_id: 'test-002',
    txn_amount: '50.00',
    txn_currency: 'EUR',
    merchant_id: 'merchant-123',
    merchant_country: 'DE',
    card_range: '53635423',
    mcc: '5411',
    options: { mode: 'scheme' },
    txn_metadata: {
      transaction_type: 'PURCHASE',
      entry_mode: 'ECOM',
      transaction_status: 'AUTHORIZED'
    }
  })
});
python
response = requests.post(
    "https://api.recivr.com/v1/calculate",
    headers={"Authorization": "Bearer YOUR_JWT_TOKEN", "Content-Type": "application/json"},
    json={
        "txn_id": "test-002",
        "txn_amount": "50.00",
        "txn_currency": "EUR",
        "merchant_id": "merchant-123",
        "merchant_country": "DE",
        "card_range": "53635423",
        "mcc": "5411",
        "options": {"mode": "scheme"},
        "txn_metadata": {
            "transaction_type": "PURCHASE",
            "entry_mode": "ECOM"
        }
    }
)
ModeWhat's calculatedTypical response time
"all" (default)Scheme + interchange + fixed fees50–80ms
"scheme"Scheme + fixed fees only40–60ms
"interchange"Interchange only30–50ms

Step 4: Add a Breakdown

Set breakdown: true to get per-fee line items:

json
{
  "options": { "mode": "all", "breakdown": true }
}

This adds a breakdown array inside scheme_fees and fixed_fees with individual fee IDs, descriptions, and amounts.

Required vs Optional Fields

FieldRequiredNotes
txn_idUnique transaction ID
txn_amountAmount as string (e.g. "100.00")
txn_currencyISO 4217 (e.g. "EUR")
merchant_idMerchant identifier
merchant_countryISO 3166-1 alpha-2 (e.g. "GB")
card_rangeCard BIN (6-8 digits)
mccMerchant Category Code (4 digits)
txn_metadata.transaction_typePURCHASE, REFUND, REVERSAL, etc.
txn_metadata.entry_modeECOM, CHIP, CONTACTLESS, etc.
txn_metadata.transaction_statusAUTHORIZED, DECLINED, REVERSED, etc.
txn_timestampAuto-generated if omitted
arnAcquirer Reference Number
card_detailsAuto-enriched from BIN lookup
txn_metadata.service_indicatorse.g. ["3ds_v2"]
optionsDefaults to mode: "all", breakdown: false

For the full field reference including Tier 3 fields, see API Reference.

Case-Insensitive Validation

All enum fields accept both uppercase and lowercase:

  • "purchase" or "PURCHASE" → both work
  • "ecom" or "ECOM" → both work
  • Values are auto-normalized

Troubleshooting

ErrorCauseFix
401 UnauthorizedInvalid or expired JWTGenerate a new token in dashboard
400 Bad RequestMissing required field or invalid valueCheck field validation in Transaction Metadata
404 Not FoundWrong endpointUse /v1/calculate

Next Steps

Recivr — The intelligence layer of the payments stack.