Skip to content

Balance API

Receipt — Generate a Receipt

Generate a human-readable receipt of all verified deltas for a customer.

Use this endpoint to generate a complete, human-readable receipt of all verified deltas for a customer. Receipts are useful for invoicing, audits, and sharing a tamper-evident transaction history.


Endpoint

GET https://balance-api.pacspace.io/api/v1/balance/receipt/:customerId

Headers

HeaderRequiredDescription
X-Api-KeyYesYour PacSpace API key

Path Parameters

ParameterTypeRequiredDescription
customerIdstringYesUnique identifier for the customer account

Example

cURL

bash
curl -X GET "https://balance-api.pacspace.io/api/v1/balance/receipt/cust_12345" \
  -H "X-Api-Key: YOUR_API_KEY"

JavaScript (Node.js)

javascript
const response = await fetch(
  "https://balance-api.pacspace.io/api/v1/balance/receipt/cust_12345",
  {
    headers: {
      "X-Api-Key": "YOUR_API_KEY",
    },
  }
);

const result = await response.json();
console.log(result);

Python

python
import requests

response = requests.get(
    "https://balance-api.pacspace.io/api/v1/balance/receipt/cust_12345",
    headers={"X-Api-Key": "YOUR_API_KEY"},
)

result = response.json()
print(result)

Response

json
{
  "success": true,
  "data": {
    "customerId": "cust_12345",
    "generatedAt": "2026-02-11T12:00:00Z",
    "deltasCount": 127,
    "finalBalance": 48500,
    "receiptId": "rcpt_abc123def456",
    "deltas": [
      {
        "anchorId": "a_1234567890",
        "delta": -1000,
        "reason": "Monthly subscription charge",
        "referenceId": "inv_98765",
        "status": "VERIFIED",
        "createdAt": "2026-02-10T14:30:00Z"
      },
      {
        "anchorId": "a_1234567891",
        "delta": 500,
        "reason": "Referral bonus",
        "referenceId": null,
        "status": "VERIFIED",
        "createdAt": "2026-02-11T09:15:00Z"
      }
    ],
    "windowSummaries": [
      {
        "period": "2026-01",
        "totalCredits": 10000,
        "totalDebits": -8500,
        "netChange": 1500,
        "deltasCount": 42
      },
      {
        "period": "2026-02",
        "totalCredits": 500,
        "totalDebits": -1000,
        "netChange": -500,
        "deltasCount": 5
      }
    ],
    "verification": {
      "rootHash": "0xabc789...",
      "algorithm": "sha256",
      "timestamp": "2026-02-11T12:00:00Z",
      "status": "VALID"
    }
  }
}

Response Fields

FieldTypeDescription
customerIdstringThe customer account the receipt was generated for
generatedAtstringISO 8601 timestamp of when the receipt was created
deltasCountnumberTotal number of verified deltas included in the receipt
finalBalancenumberThe computed balance after all verified deltas
receiptIdstringUnique identifier for this receipt
deltasarrayComplete list of verified delta records
windowSummariesarrayAggregated summaries grouped by time period
verificationobjectProof that the receipt data has not been tampered with

Delta Object

FieldTypeDescription
anchorIdstringUnique identifier for this delta
deltanumberThe adjustment amount
reasonstringHuman-readable reason for the adjustment
referenceIdstringYour internal reference ID, or null if not provided
statusstringAlways VERIFIED for receipt entries
createdAtstringISO 8601 timestamp of when the delta was created

Window Summary Object

FieldTypeDescription
periodstringTime period label (e.g., 2026-01)
totalCreditsnumberSum of all positive deltas in the period
totalDebitsnumberSum of all negative deltas in the period
netChangenumberNet balance change for the period
deltasCountnumberNumber of deltas in the period

Verification Object

FieldTypeDescription
rootHashstringHash covering all deltas in the receipt
algorithmstringHashing algorithm used (e.g., sha256)
timestampstringISO 8601 timestamp of when verification was performed
statusstringVerification result: VALID or INVALID

Use Cases

  • Invoicing — Attach a receipt to customer invoices as a verified record of all charges and credits in a billing period.
  • Audits — Provide auditors with a complete, tamper-evident history of balance changes.
  • Dispute resolution — Share a receipt with a counterparty to establish a common set of facts when balances disagree.
  • Record keeping — Archive receipts for compliance or internal bookkeeping purposes.

Tip: Combine receipts with the Checkpoint endpoint to generate period-specific receipts that align with your billing cycles.

Was this page helpful?

Last updated February 11, 2026