> ## Documentation Index
> Fetch the complete documentation index at: https://docs.fype.dev/llms.txt
> Use this file to discover all available pages before exploring further.

# Reconciliation

# Reconciliation & Reporting

For any payment system, maintaining a source of truth between your database, fype, and the payment gateway is essential. This guide covers how to perform reconciliation and handle edge cases.

## 1. Using the Reference ID

When creating a payment, always provide a `reference_id` (your internal order number).

* fype indexes this field, allowing you to search for payments by your own internal ID in both the API and Dashboard.
* Standardized webhooks include this `reference_id`, allowing you to find the correct order in your system without a separate database lookup.

## 2. Handling Missed Webhooks

Webhooks are "at-least-once" delivery. While fype has a robust retry policy, your server might be down for an extended period.

* **Polling Fallback**: If an order remains "Pending" in your system for more than 1 hour, use the `GET /v1/payments/{id}` endpoint to sync the status manually.
* **Sync on User Interaction**: When a customer returns to your `success_url`, you should fetch the latest status from fype to provide immediate feedback, while still relying on the webhook for final order fulfillment logic.

## 3. Deduplication Logic

fype ensures that events delivered to your webhook endpoint have a unique `id` (e.g., `evt_...`).

* **Idempotent Processing**: Your webhook handler should be idempotent. Store the processed fype `event_id` in your database. If you receive the same event again (due to a delivery retry), ignore it.

## 4. Reconciling with Gateway Reports

If you are auditing your Razorpay settlement reports:

* The `provider_payment_id` (e.g., `pay_...`) stored in fype matches the ID shown in your Razorpay dashboard and settlement exports.
* fype stores the raw `provider_response` for every successful transaction, which contains the exact timestamp and amount as recorded by the gateway.

## 5. Exporting Data

You can export your payment history from the fype Dashboard as a CSV. This report includes:

* fype Payment ID
* Reference ID
* Amount & Currency
* Status
* Gateway Reference
* Creation Timestamp
* Metadata (Flattened)
