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
| Header | Required | Description |
|---|---|---|
X-Api-Key | Yes | Your PacSpace API key |
Path Parameters
| Parameter | Type | Required | Description |
|---|---|---|---|
customerId | string | Yes | Unique 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
| Field | Type | Description |
|---|---|---|
customerId | string | The customer account the receipt was generated for |
generatedAt | string | ISO 8601 timestamp of when the receipt was created |
deltasCount | number | Total number of verified deltas included in the receipt |
finalBalance | number | The computed balance after all verified deltas |
receiptId | string | Unique identifier for this receipt |
deltas | array | Complete list of verified delta records |
windowSummaries | array | Aggregated summaries grouped by time period |
verification | object | Proof that the receipt data has not been tampered with |
Delta Object
| Field | Type | Description |
|---|---|---|
anchorId | string | Unique identifier for this delta |
delta | number | The adjustment amount |
reason | string | Human-readable reason for the adjustment |
referenceId | string | Your internal reference ID, or null if not provided |
status | string | Always VERIFIED for receipt entries |
createdAt | string | ISO 8601 timestamp of when the delta was created |
Window Summary Object
| Field | Type | Description |
|---|---|---|
period | string | Time period label (e.g., 2026-01) |
totalCredits | number | Sum of all positive deltas in the period |
totalDebits | number | Sum of all negative deltas in the period |
netChange | number | Net balance change for the period |
deltasCount | number | Number of deltas in the period |
Verification Object
| Field | Type | Description |
|---|---|---|
rootHash | string | Hash covering all deltas in the receipt |
algorithm | string | Hashing algorithm used (e.g., sha256) |
timestamp | string | ISO 8601 timestamp of when verification was performed |
status | string | Verification 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