diff --git a/api-features/query-requests.mdx b/api-features/query-requests.mdx index 9a3abbc..9a1b529 100644 --- a/api-features/query-requests.mdx +++ b/api-features/query-requests.mdx @@ -3,103 +3,83 @@ title: "Query Requests" description: "Request status monitoring, lifecycle management, and information retrieval" --- - -**AI-Generated Content** – This page was generated with AI assistance and may contain inaccuracies. While likely close to accurate, please verify critical details with the [stable documentation](https://docs.request.network) or [contact support](https://github.com/orgs/RequestNetwork/discussions). - - ## Overview -Query requests provides comprehensive request status monitoring and information retrieval, enabling real-time tracking of payment requests throughout their lifecycle. +Use query endpoints to retrieve the latest status for a specific request. -## Request Status Lifecycle +These endpoints are the main reconciliation surface for request-level state (paid/not paid, payment references, transaction hash, and optional metadata). - - - Created, pending, partially paid - - - - Paid, cancelled, expired - - +## Core Endpoints + +- [GET /v2/request/{requestId}](https://api.request.network/open-api/#tag/v2request/GET/v2/request/{requestId}) - get request status/details +- [GET /v2/payments](https://api.request.network/open-api/#tag/v2payments/GET/v2/payments) - wallet-level payment search and reconciliation ## How It Works -```mermaid -graph LR - A[Request ID] --> B[Query Status] - B --> C[Retrieve Info] - C --> D[Check Payments] - D --> E[Update Status] -``` - -**Query Process:** -1. **Identify:** Use request ID for lookup -2. **Retrieve:** Get current request information -3. **Analyze:** Check payment status and history -4. **Update:** Reflect latest blockchain state - -## Status Types - -### Request States -- `created` - Request initialized and stored -- `pending` - Awaiting payment completion -- `paid` - Full payment received and confirmed -- `cancelled` - Request cancelled by creator -- `expired` - Past due date without payment - -### Payment States -- `no_payment` - No payment transactions detected -- `partially_paid` - Partial payment received -- `paid` - Full payment amount received -- `overpaid` - Payment exceeds requested amount - -## Query Methods + + +Call [GET /v2/request/{requestId}](https://api.request.network/open-api/#tag/v2request/GET/v2/request/{requestId}) to get current request-level status fields. - - - Detailed status for specific request - - - - Multiple request status in one call - - +Typical fields include: -### Information Retrieved -- **Basic Details:** Amount, currency, participants -- **Payment History:** Transaction details and confirmations -- **Status Timeline:** Creation, updates, completion dates -- **Network Data:** Blockchain and transaction information +- `hasBeenPaid` +- `paymentReference` +- `txHash` +- `isListening` +- optional metadata such as `customerInfo` and `reference` + -## Real-time Monitoring + +Use [Webhooks & Events](/api-features/webhooks-events) for push updates, and use query endpoints as source-of-truth reads. + -### Automatic Updates -Combine with [Payment Detection](/api-features/payment-detection) for automatic status updates + +For wallet-level reconciliation views, use [GET /v2/payments](https://api.request.network/open-api/#tag/v2payments/GET/v2/payments). + + -### Event Integration -Use [Webhooks & Events](/api-features/webhooks-events) for instant notifications +## Request Status Query -## Advanced Filtering +`GET /v2/request/{requestId}` is the canonical request-level status endpoint for: -Filter requests by: -- **Date Range:** Creation or due date periods -- **Status:** Current request or payment state -- **Participants:** Payee or payer addresses -- **Amount Range:** Minimum and maximum values +- request payment completion checks (`hasBeenPaid`) +- transaction linkage (`txHash`) +- request identification (`requestId`, `paymentReference`) +- conversion-related status fields when applicable (`amountInUsd`, `conversionRate`, `conversionBreakdown`) -## Used In +## Reconciliation Pattern - - Real-time payment tracking + + React to events in real time and update app state immediately. - - Invoice status reconciliation + + Use query endpoints to confirm latest status and backfill missed events. + + + +## Practical Notes + +- Use `requestId` for deterministic lookup. +- Keep idempotent reconciliation logic in case the same request is processed multiple times by your workers. + +## Related Pages + + + + Understand automatic detection and status updates. + + + + Search and reconcile payment-level events. + + + + Build real-time event-driven reconciliation. -## Implementation Details +## API Reference -See [API Reference - Query Requests](/api-reference/endpoints/get-request) for complete technical documentation. \ No newline at end of file +For full schemas and examples, see [Request Network API Reference](https://api.request.network/open-api).