Skip to main content

Receipts

Generated HTTP reference for the 2 operations the published OpenAPI document describes under receipts.

1 min read
View MarkdownEdit on GitHub

Receipts

This page is generated from the published OpenAPI document. It is complete with respect to that document and says nothing about surfaces the document does not describe yet. See what is generated here for what that means.

Base URL: https://api.codespar.dev

Every operation below requires a Bearer token. See Authentication.

GET /v1/consumers/receipts/{id}

GEThttps://api.codespar.dev/v1/consumers/receipts/{id}

Read one agentic receipt

Path parameters

NameTypeRequiredDescription
idstringyesThe receipt id.

Responses

StatusBodyDescription
200objectOK
404objectNo receipt with this id in this project. A receipt in another project of the same organization answers the same way.

Response 200

FieldTypeRequiredDescription
chainstringyes
deliveryobject,nullyesNull until a delivery proof has been sealed onto the receipt.
exceptionsarray of objectyes
mandateobjectyes
paymentobjectyes
quoteobject,nullyesNull when the receipt carries neither a seller nor a resource.
receipt_idstringyes
receipt_sigstringyes
state"paid" | "delivered" | "exception" | "voided"yes
Example request
curl -X GET https://api.codespar.dev/v1/consumers/receipts/{id} \
  -H "Authorization: Bearer $CODESPAR_API_KEY"
const res = await fetch("https://api.codespar.dev/v1/consumers/receipts/{id}", {
  method: "GET",
  headers: {
    Authorization: `Bearer ${process.env.CODESPAR_API_KEY}`,
  },
});

const data = await res.json();
Example response 200
application/json
{
  "receipt_id": "receipt_0000000000000000",
  "state": "paid",
  "mandate": {
    "id": "obj_0000000000000000",
    "nonce": "string",
    "scope": "string",
    "currency": "BRL",
    "sig": "string"
  },
  "quote": {},
  "payment": {
    "rail": "string",
    "amount_minor": 1000,
    "amount_authorized": "1000",
    "amount_charged": "1000",
    "amount_refunded": "1000",
    "metering": {
      "basis": "string",
      "units": "string",
      "unit_price": "string"
    },
    "sandbox": true,
    "attempt_id": "attempt_0000000000000000",
    "money_moved": true,
    "at": "string"
  },
  "delivery": {
    "result": "confirmed"
  },
  "chain": "string",
  "receipt_sig": "string",
  "exceptions": [
    {
      "code": "string",
      "detail": "string",
      "at": "string"
    }
  ]
}

GET /v1/consumers/{consumerId}/receipts

GEThttps://api.codespar.dev/v1/consumers/{consumerId}/receipts

A consumer's agentic receipts

Path parameters

NameTypeRequiredDescription
consumerIdstringyes

Responses

StatusBodyDescription
200objectOK

Response 200

FieldTypeRequiredDescription
receiptsarray of objectyes
Example request
curl -X GET https://api.codespar.dev/v1/consumers/{consumerId}/receipts \
  -H "Authorization: Bearer $CODESPAR_API_KEY"
const res = await fetch("https://api.codespar.dev/v1/consumers/{consumerId}/receipts", {
  method: "GET",
  headers: {
    Authorization: `Bearer ${process.env.CODESPAR_API_KEY}`,
  },
});

const data = await res.json();
Example response 200
application/json
{
  "receipts": [
    {
      "receipt_id": "receipt_0000000000000000",
      "state": "paid",
      "mandate": {
        "id": "obj_0000000000000000",
        "nonce": "string",
        "scope": "string",
        "currency": "BRL",
        "sig": "string"
      },
      "quote": {},
      "payment": {
        "rail": "string",
        "amount_minor": 1000,
        "amount_authorized": "1000",
        "amount_charged": "1000",
        "amount_refunded": "1000",
        "metering": {
          "basis": "string",
          "units": "string",
          "unit_price": "string"
        },
        "sandbox": true,
        "attempt_id": "attempt_0000000000000000",
        "money_moved": true,
        "at": "string"
      },
      "delivery": {
        "result": "confirmed"
      },
      "chain": "string",
      "receipt_sig": "string",
      "exceptions": [
        {
          "code": "string",
          "detail": "string",
          "at": "string"
        }
      ]
    }
  ]
}
Receipts | CodeSpar