Receipts API Reference

Manage purchase receipts, confirmations, and receipt-related operations in the transaction system.

Base Path: /api/receipts

Overview

The Receipts API provides endpoints for managing purchase receipts including creation, retrieval, export functionality, and deletion. Supports both soft and hard delete operations.

Key Operations


API Endpoints

POST /api/receipts

Create Receipt

Creates a new purchase receipt for a completed order.

Authentication

Bearer Token or Service Token

Request Body

{
  "orderId": "ord_456",
  "customerId": "cust_123",
  "receiptNumber": "RCP-2026-001",
  "receiptDate": "2026-06-02T10:30:00Z",
  "items": [
    {
      "description": "Cloud Server Premium",
      "quantity": 1,
      "price": 299.99,
      "amount": 299.99
    }
  ],
  "subtotal": 299.99,
  "tax": 29.99,
  "total": 329.98,
  "currency": "USD",
  "paymentMethod": "credit_card"
}

Response

{
  "id": "rcp_789",
  "receiptNumber": "RCP-2026-001",
  "orderId": "ord_456",
  "customerId": "cust_123",
  "total": 329.98,
  "createdAt": "2026-06-02T10:30:00Z"
}
GET /api/receipts

List Receipts

Gets all receipts with filtering and pagination.

Authentication

Bearer Token or Service Token

Query Parameters

Parameter Type Description
$filter string OData filter expression
$skip integer Skip n records
$top integer Take n records

Response

{
  "value": [
    {
      "id": "rcp_789",
      "receiptNumber": "RCP-2026-001",
      "orderId": "ord_456",
      "customerId": "cust_123",
      "total": 329.98,
      "receiptDate": "2026-06-02T10:30:00Z"
    }
  ],
  "count": 150
}
GET /api/receipts/{id}

Get Receipt by ID

Gets receipt details by ID with all line items.

Authentication

Bearer Token or Service Token

Path Parameters

Parameter Type
id string

Response

{
  "id": "rcp_789",
  "receiptNumber": "RCP-2026-001",
  "orderId": "ord_456",
  "customerId": "cust_123",
  "receiptDate": "2026-06-02T10:30:00Z",
  "items": [
    {
      "description": "Cloud Server Premium",
      "quantity": 1,
      "price": 299.99,
      "amount": 299.99
    }
  ],
  "subtotal": 299.99,
  "tax": 29.99,
  "total": 329.98,
  "currency": "USD",
  "paymentMethod": "credit_card",
  "createdAt": "2026-06-02T10:30:00Z"
}
POST /api/receipts/{id}/export-pdf

Export Receipt as PDF

Exports receipt to PDF format.

Authentication

Bearer Token or Service Token

Path Parameters

Parameter Type
id string

Response

PDF file download

DELETE /api/receipts/{id}

Delete Receipt

Soft deletes receipt (marks as deleted but preserves data).

Authentication

Bearer Token or Service Token

Path Parameters

Parameter Type
id string

Query Parameters

Parameter Type Description
hard boolean Set to true for permanent hard delete

Response

{
  "success": true,
  "message": "Receipt deleted"
}

Error Responses

Code HTTP Status Description
RECEIPT_NOT_FOUND 404 Receipt does not exist
ORDER_NOT_FOUND 404 Associated order not found
RECEIPT_ALREADY_EXISTS 409 Receipt already exists for this order

Quick Links