When a customer pays an invoice with cryptocurrency, TRXN verifies that the payment was actually made and converts the crypto amount to fiat value at the time of the transaction. This verification answers the question: did the customer pay the correct amount?
Verification flow
Fetch blockchain data
TRXN queries the blockchain to find all transactions from the sender address to the recipient address within the expected date range.This returns transaction hashes, timestamps, and crypto amounts.The blockchain provider is selected through the TransactionProviderFactory. The current provider is Bitquery.
Get historical prices
For each transaction found, TRXN looks up the crypto-to-fiat exchange rate at the exact moment the transaction occurred.For example: “What was 0.002 BTC worth in USD on Jan 15 at 10:00 AM?”The price provider is selected through the CurrencyQuoteProviderFactory. Current providers include CoinMarketCap and CoinAPI.
Calculate fiat values
Each transaction’s crypto amount is multiplied by the historical price to get the fiat value at the time of payment.0.002 BTC x $50,000/BTC = $100 USD
Verify payment status
The system sums all transaction fiat values and compares the total to the invoice amount.This step determines:
- Total amount paid (in fiat)
- Whether the payment is complete or partial
- Remaining balance (if any)
The slippage margin is applied at this step to accommodate price fluctuations.
Verification result
After verification completes, the result contains:
{
"paid_in_full": true,
"amount_paid": 100.00,
"amount_due": 100.00,
"remaining": 0.00,
"transactions": [...]
}
When slippage margin is applied, the result also includes:
{
"slippage_margin_percent": 2.0,
"fiat_minimum_acceptable": 98.00
}
Why historical prices matter
Cryptocurrency prices are volatile. A payment of 0.002 BTC could be worth:
- $80 on Monday
- $100 on Tuesday
- $95 on Wednesday
TRXN uses the price at the exact moment of the transaction to determine the fiat value. This ensures fair verification regardless of when the verification is performed.
Multiple transactions
Customers may pay an invoice across multiple transactions. TRXN sums all transactions to determine the total paid:
| Transaction | Amount | Fiat value | Running total |
|---|
| Tx 1 (Jan 10) | 0.001 BTC | $50.00 | $50.00 |
| Tx 2 (Jan 15) | 0.001 BTC | $52.00 | $102.00 |
The total paid is 102.00.Iftheinvoiceamountis100.00, the payment is complete.
Each transaction’s fiat value is calculated independently using the exchange rate at its own timestamp. This means two transactions of the same crypto amount may have different fiat values.
Supported cryptocurrencies
Currently supported:
- BTC (Bitcoin)
- ETH (Ethereum)
Each cryptocurrency uses blockchain-specific query providers and may have different price data sources.
Verification diagram
┌──────────────────────────────────────────────┐
│ Verification request │
│ │
│ "Verify that address A sent $100 USD worth │
│ of BTC to address B between Jan 1-31" │
└──────────────────┬───────────────────────────┘
│
v
┌──────────────────────────────────────────────┐
│ Step 1: Fetch blockchain data │
│ │
│ Query blockchain for transactions from A │
│ to B within the date range. │
│ │
│ Provider: TransactionProviderFactory │
└──────────────────┬───────────────────────────┘
│
v
┌──────────────────────────────────────────────┐
│ Step 2: Get historical prices │
│ │
│ For each transaction, look up the exchange │
│ rate at the exact moment it occurred. │
│ │
│ Provider: CurrencyQuoteProviderFactory │
└──────────────────┬───────────────────────────┘
│
v
┌──────────────────────────────────────────────┐
│ Step 3: Calculate fiat values │
│ │
│ crypto amount x historical price = fiat │
│ 0.002 BTC x $50,000/BTC = $100 USD │
└──────────────────┬───────────────────────────┘
│
v
┌──────────────────────────────────────────────┐
│ Step 4: Verify payment status │
│ │
│ Sum all fiat values. Compare to invoice. │
│ Apply slippage margin if configured. │
└──────────────────┬───────────────────────────┘
│
v
┌──────────────────────────────────────────────┐
│ Verification result │
│ │
│ paid_in_full: true │
│ amount_paid: 100.00 │
│ amount_due: 100.00 │
│ remaining: 0.00 │
└──────────────────────────────────────────────┘
Related pages