Skip to content

Fetch Invoices Method

Fetches invoices by their identifiers.

RPC: invoice.v1.PubInvoiceService/FetchInvoices


TIP

Pass one or many ids. If the list is empty, the service may return an empty result.
Timestamps are in RFC 3339 / ISO 8601 format.

Request Example

shell
curl 'https://api.ibuy.exchange/invoice.v1.PubInvoiceService/FetchInvoices'   --header 'Authorization: Bearer <token>'   --header 'Content-Type: application/json'   --data '{
    "ids": ["inv_7f4b3b2c", "inv_12aa34bb"]
  }'
typescript
import { createClient } from "@connectrpc/connect";
import { ibuy } from "@ibuy.exchange/api";

const invoiceService = createClient(ibuy.invoicev1.PubInvoiceService, transport);

const response = await invoiceService.fetchInvoices({
  ids: ["inv_7f4b3b2c", "inv_12aa34bb"],
});

for (const inv of response.invoices) {
  console.log(inv.id, inv.status, inv.amount, inv.paymentUrl);
}

Response Example

json
{
  "invoices": [
    {
      "id": "inv_7f4b3b2c",
      "merchant_id": "mrc_001",
      "external_id": "inv-ext-001",
      "payment_url": "https://pay.ibuy.exchange/i/inv_7f4b3b2c",
      "amount": "1499.00",
      "status": "PENDING",
      "metadata": {
        "user_id": "user_42",
        "cart_id": "cart_777"
      },
      "created_at": "2025-10-29T10:15:00Z",
      "expires_at": "2025-10-29T12:15:00Z",
      "bank": {
        "id": "bank_001",
        "code": "tinkoff"
      },
      "payment_method_id": "pm_123"
    },
    {
      "id": "inv_12aa34bb",
      "merchant_id": "mrc_001",
      "payment_url": "https://pay.ibuy.exchange/i/inv_12aa34bb",
      "amount": "500.00",
      "status": "FAILED",
      "created_at": "2025-10-28T08:00:00Z",
      "expires_at": "2025-10-28T10:00:00Z",
      "bank": {
        "id": "bank_002",
        "code": "sber"
      }
    }
  ]
}