Receipt

The Receipt model represents the single canonical payment receipt Canvas generates for a payment collection. Canvas creates one receipt per PaymentCollection, and the model exposes that receipt’s PDF through a presigned URL.

Basic Usage #

from canvas_sdk.v1.data import Receipt

receipt = Receipt.objects.get(id="d2194110-5c9a-4842-8733-ef09ea5ead11")

Each receipt belongs to one PaymentCollection, and you can reach it from the collection through the one-to-one reverse accessor:

from canvas_sdk.v1.data import PaymentCollection

collection = PaymentCollection.objects.get(id="f47ac10b-58cc-4372-a567-0e02b2c3d479")
receipt = collection.receipt  # the one-to-one Receipt; raises if the collection has none

Finding a patient’s receipts #

A patient-portal plugin should show only the signed-in patient’s receipts. A receipt belongs to a PaymentCollection, and the patient who paid is the payer on that collection’s BulkPatientPosting, so filter on that path:

from canvas_sdk.v1.data import Patient, Receipt

patient = Patient.objects.get(id="b80b1cdc2e6a4aca90ccebc02e683f35")

receipts = Receipt.objects.filter(
    payment_collection__bulkpatientposting__payer=patient,
    entered_in_error__isnull=True,
)

Accessing the receipt PDF #

The receipt_url property returns a presigned S3 URL for the receipt PDF. The URL is valid for one hour and is regenerated on each access, so fetch it at render time rather than persisting or caching it. It returns None when the receipt has no PDF. The receipt field itself holds the stored file path, not a URL, so use receipt_url to link a patient to their PDF.

from canvas_sdk.v1.data import Receipt

receipt = Receipt.objects.get(id="d2194110-5c9a-4842-8733-ef09ea5ead11")
url = receipt.receipt_url  # presigned S3 URL (valid for 1 hour), or None

Attributes #

Receipt #

Field NameTypeDescription
idUUID 
dbidInteger 
createdDateTime 
modifiedDateTime 
originatorCanvasUser 
entered_in_errorCanvasUser 
payment_collectionPaymentCollection 
account_balance_before_collectionDecimal 
account_balance_after_collectionDecimal 
discountDecimal 
receiptString 
receipt_urlString (computed)Presigned S3 URL for the receipt PDF, valid for 1 hour, or None while the PDF is still being generated
total_posted_amountDecimal (computed)Sum of the payments and write-off adjustments across the payment collection’s active postings
copay_amountDecimal (computed)Amount posted as copays with the payment collection
  • account_balance_before_collection and account_balance_after_collection are snapshots of the patient’s account balance taken when the receipt was generated. They don’t change as the balance changes.
  • discount is the discount amount recorded on the receipt, or 0.00 when no discount was applied.