Receipt Schema

Itemized receipts are the core data model of Versa. They include both “header” information — the merchant name, merchant logo, total purchase amount, purchase date, etc. — as well as “line item” details — the quantity, description, and cost of each item purchased.

Technically, the Versa receipt object is an “invoice” combined with an associated payment. In certain pre-purchase scenarios, the invoice and the payment are decoupled, however in most Versa cases, the invoice and payment confirmation come through together, composing the complete receipt in a single payload.

A JSON Schema document and corresponding TypeScript Types are available on GitHub or via the @versa/schema package.

Versa receipts are composed of four sections:

  1. Header: Top-level fields, e.g. merchant details, receipt total, purchase date.
  2. Itemization: Description, quantity, unit cost, and total for each line item. Type-specific templates describe special receipt types, e.g. flight, e-commerce purchase, service.
  3. Actions: Optional merchant-defined links, pivoting off the purchase. For example: ‘Contact Support,’ ‘Buy Again,’ ‘Manage Subscription.’
  4. Payments: Payment status and details.

Rough diagram of receipt elements.

Wrapper

Receipts are wrapped in an object that includes the schema version. The overall Versa receipt structure looks like this:

{
  "schema_version": "2.1.0",
  "header": { ... },
  "itemization": { ... },
  "payments": [ ... ],
  "footer": { ... }
}
FieldTypeDescription
schema_versionstringVersion of the receipt schema; useful for validating the receipt.
headerobjectReceipt header.
itemizationobjectReceipt itemization object.
paymentsnullable arrayList of payments.
footerobjectThe footer includes actions and supplemental text.

Below we cover each of these sections in detail.

The receipt header is the 10,000 foot view of the transaction, describing the “who,” “when,” and “where” (the “what” is covered in the itemization section). An example receipt header:

"header": {
  "currency": "USD",
  "subtotal": 5928,
  "total": 6332,
  "paid": 6332,
  "invoiced_at": 1713295619,
  "invoice_number": "1024",
  "mcc": 3234,
  "third_party": null,
  "customer": null,
  "location": null,
  "invoice_asset_id": "asset_6dbca44449094eb28aaa6b3c6b2aa4",
  "receipt_asset_id": null
}
FieldTypeDescription
currencystringAn ISO 4217 currency code, e.g. USD.
subtotalintegerReceipt subtotal (before taxes, fees, tip).
totalintegerReceipt total amount. This amount is in the receipt currency and in the smallest currency unit.
paidintegerSum of all payments. Will equal total if the invoice is paid in full.
invoiced_atintegerTime at which the invoice was created. Measured in seconds since the Unix epoch.
invoice_numbernullable stringUnique identifier for the invoice / receipt.
mccnullable stringMerchant Category Code. This value should match the value on the card network.
third_partynullable objectThird party involved in the transaction, where applicable.
customernullable objectCustomer involved in the transaction, where applicable.
locationnullable objectPlace object for the merchant. Also where you can set the primary timezone.
invoice_asset_idnullable stringAsset id of uploaded invoice PDF or image.
receipt_asset_idnullable stringAsset id of uploaded receipt PDF or image.
Third Party Object

Third Party

Use the optional third party object in cases where the sender is a platform / broker. For example, if a coffee shop uses Square to process sales, the ‘sending merchant’ would be Square and the ‘third party merchant’ would be the coffee shop. The make_primary flag specifies whether the sending merchant or the third party merchant should get top billing on the receipt.

FieldTypeDescription
relationenumOne of bnpl, delivery_service, marketplace, payment_processor, platform, point_of_sale.
make_primarybooleanDetermines whether the merchant or third party gets top billing on the receipt.
merchantnullable objectAn org object representing the third party.
Customer Object

Customer

Used in cases where the merchant has a profile for the customer. Can be left null i.e. for guest checkout flows.

FieldTypeDescription
namestring
emailnullable string
websitenullable string
addressnullable objectAn address object.
phonenullable stringPhone number in the E.164 format.
metadataarrayArray of metadata objects, for any additional info.

Itemization

The Itemization section describes the goods and services that compose the purchase. Based on the type of purchase, the object conforms to one of seven templates: General, Car Rental, E-commerce, Flight, Lodging, Service, or Transit Route. Exactly one itemization template must be non-null. When in doubt, use the 'general' template.

"itemization": {
  "general": { ... },
  "car_rental": null,
  "ecommerce": null,
  "flight": null,
  "lodging": null,
  "service": null,
  "transit_route": null
}
General Object

General

FieldTypeDescription
itemsarrayAn array of generic item objects.
invoice_level_adjustmentsarrayArray of adjustments applied at the top (invoice) level. These are independent of line item adjustments, which are added at the line item level.
Car Rental Object

Car Rental

View a complete car rental receipt example.

"car_rental": {
  "rental_at": 1713196492,
  "return_at": 1713415500,
  "rental_location": { ... },
  "return_location": { ... },
  "vehicle": {
    "description": "Polestar 2",
    "image": null,
    "license_plate_number": null,
    "vehicle_class": "EDAE"
  },
  "driver_name": "Henry Ford",
  "odometer_reading_in": 100,
  "odometer_reading_out": 210,
  "items": [ ... ],
  "metadata": [],
  "invoice_level_adjustments": [],
}
FieldTypeDescription
rental_atintegerRental time. Measured in seconds since the Unix epoch.
return_atintegerReturn time. Measured in seconds since the Unix epoch.
rental_locationobjectA place describing the rental location.
return_locationobjectA place describing the return location.
vehicleobjectA vehicle object.
driver_namenullable string
odometer_reading_innullable integer
odometer_reading_outnullable integer
itemsarrayAn array of generic item objects.
metadataarrayArray of metadata objects, for any additional info.
invoice_level_adjustmentsarrayArray of adjustments applied at the top (invoice) level. These are independent of line item adjustments, which are added at the line item level.

Vehicle

FieldTypeDescription
descriptionstringType of car.
imagenullable stringImage of car.
license_plate_numbernullable string
vehicle_classnullable stringACRISS car code, four letters.
E-commerce Object

E-commerce

For online orders, with shipping info. If items have not been assigned to a shipment, add those items to invoice_level_line_items. Once they’ve been assigned to a shipment, move them to shipment.items. View a complete E-commerce receipt example.

FieldTypeDescription
invoice_level_line_itemsarrayAn array of item objects at the invoice level. For items that are part of shipment, move them under the shipment object.
shipmentsarrayAn array of shipment objects.
invoice_level_adjustmentsarrayArray of adjustments applied at the top (invoice) level. These are independent of line item adjustments, which are added at the line item level.

Shipment

FieldTypeDescription
itemsarrayAn array of item objects at shipment level.
carriernullable stringShipping carrier name (e.g., "FedEx", "UPS").
tracking_numbernullable stringLabel that appears on the button.
expected_delivery_atnullable intMeasured in seconds since the Unix epoch.
shipment_statusnullable enumOne of prep, in_transit, delivered.
destination_addressnullable objectAn address object.
Flight Object

Flight

View a complete flight receipt example.

FieldTypeDescription
ticketsarrayAn array of ticket objects.
itinerary_locatornullable string
invoice_level_adjustmentsarrayArray of adjustments applied at the top (invoice) level. These are independent of line item adjustments, which are added at the line item level.

Tickets

FieldTypeDescription
segmentsarrayArray of segments.
numbernullable string
record_locatornullable stringPNR.
passengernullable objectA person object.
metadataarrayArray of metadata objects, for any additional info.
farenullable integerOptional, only needed if fares are not included on the contained segments.
taxesarrayOptional, only needed if taxes are not included on the contained segments.

Segments

FieldTypeDescription
departure_airport_codestringThe three-letter IATA airport code that the flight departed from.
arrival_airport_codestringThe three-letter IATA airport code of the flight’s destination.
farenullable integerShould be included, unless fare is on the parent ticket object instead.
taxesarrayArray of tax objects.
departure_atnullable integerDeparture time. Measured in seconds since the Unix epoch.
arrival_atnullable integerArrival time. Measured in seconds since the Unix epoch.
departure_tznullable stringA list of possible time zone values is maintained at the IANA Time Zone Database.
arrival_tznullable stringA list of possible time zone values is maintained at the IANA Time Zone Database.
flight_numbernullable stringThe two-letter IATA airline designator followed by a one to four digit number (e.g. 'DL123').
class_of_servicenullable string
seatnullable string
aircraft_typenullable stringThe ICAO code of the aircraft.
metadataarrayArray of metadata objects, for any additional info.
adjustmentsarrayArray of adjustment objects.
Lodging Object

Lodging

View a complete lodging receipt example.

lodging: {
  "check_in": 1713196492,
  "check_out": 1713473361,
  "guests": [{
    "first_name": "Susan",
    "last_name": "Doe",
    "preferred_first_name": "Sue",
    "email": "sdoe@platform.co",
    "phone": "+14155552671",
    "metadata": []
  }],
  "room": "806",
  "location": { ... },
  "items": [ ... ],
  "metadata": [],
  "invoice_level_adjustments": []
}
FieldTypeDescription
check_inintCheck-in date-time. Measured in seconds since the Unix epoch.
check_outintCheck-out date-time. Measured in seconds since the Unix epoch.
guestsarrayArray of person objects.
roomnullable stringRoom number.
locationnullable objectA place object describing the hotel / lodging.
itemsarrayAn array of generic item objects. This includes the room rate, as well as incidentals / full folio.
metadataarrayArray of metadata objects, for any additional info.
invoice_level_adjustmentsarrayArray of adjustments applied at the top (invoice) level. These are independent of line item adjustments, which are added at the line item level.
Service Object

Service

For airport parking, SaaS subscriptions, phone bills, etc. View a complete service receipt example.

"service": {
  "service_items": [{
    "recurring": true,
    "description": "Pro monthly plan",
    "amount": 1000,
    "interval": "month",
    "interval_count": 1,
    "current_period_start_at": 1679609767,
    "current_period_end_at": 1682288167,
    "quantity": 10,
    "unit_cost": 875,
    "taxes": [],
    "metadata": [],
    "adjustments": []
  }],
  "invoice_level_adjustments": []
}
FieldTypeDescription
service_itemsarrayAn array of service item objects.
invoice_level_adjustmentsarrayArray of adjustments applied at the top (invoice) level. These are independent of line item adjustments, which are added at the line item level.

Service Item

FieldTypeDescription
amountintegerSubtotal for the line item (typically quantity × unit_cost + adjustments). Does not include taxes.
service_locationnullable objectA place object describing the location where the service was provided (e.g., parking lot, service center).
recurringbooleanWhether this is a recurring service.
descriptionstringDescription of the service.
intervalnullable enumOne of day, week, month or year.
interval_countnullable integerThe number of intervals (specified in the interval attribute) between subscription billings. For example, interval=month and interval_count=3 bills every 3 months.
current_period_start_atnullable integerStart of the current period of the service. Measured in seconds since the Unix epoch.
current_period_end_atnullable integerEnd of the current period. Measured in seconds since the Unix epoch.
quantitynullable numberQuantity of items.
unit_costnullable integerCost of the service in the smallest currency unit.
taxesarrayArray of tax objects.
metadataarrayArray of key/value metadata pairs, e.g. SKU.
adjustmentsarrayArray of adjustment objects.
Transit Route Object

Transit Route

A route, typically used by rideshare / taxi services, or rail / bus / ferry / etc. View complete taxi receipt or rail receipt examples.

"transit_route": {
  "transit_route_items": [{
    "departure_address": {
      "street_address": "273 Sesame St",
      "city": "Brooklyn",
      "region": "NY",
      "country": "US",
      "postal_code": "11205",
      "lat": 40.68266,
      "lon": -73.94237,
      "tz": "America/New_York"
    },
    "arrival_address": {
      "street_address": "141 Broadway",
      "city": "Brooklyn",
      "region": "NY",
      "country": "US",
      "postal_code": "11205",
      "lat": 40.69954,
      "lon": -73.97064,
      "tz": "America/New_York"
    },
    "fare": 4215,
    "departure_at": 1713196492,
    "arrival_at": 1713197752,
    "passenger": null,
    "polyline": "syhwFxzhbMrFtdAmpAhOlGzmAi%5CdEaGEDgEoAEMfK",
    "taxes": [],
    "metadata": [],
    "adjustments": []
  }],
  "invoice_level_adjustments": []
}
FieldTypeDescription
transit_route_itemsarrayArray of transit route item objects.
invoice_level_adjustmentsarrayArray of adjustments applied at the top (invoice) level. These are independent of line item adjustments, which are added at the line item level.

Transit Route Item

FieldTypeDescription
departure_locationobjectThe origin place object.
arrival_locationobjectThe destination place object.
fareintegerRide amount, typically the same as the header subtotal.
departure_atnullable integerDeparture time. Measured in seconds since the Unix epoch.
arrival_atnullable integerArrival time. Measured in seconds since the Unix epoch.
modenullable enumOne of car, taxi, rail, bus, ferry, other.
passengernullable objectA person object.
polylinenullable stringAn encoded polyline of the route.
taxesarrayArray of tax objects.
metadataarrayArray of key/value metadata pairs.
adjustmentsarrayArray of adjustment objects.
FieldTypeDescription
actionsarrayList of actions.
supplemental_textnullable stringTerms and conditions or other info. Supports Markdown.

Actions

Merchants have the option to provide useful next actions in the Actions section. An action is typically a deep link to a page within the merchant’s website. For example 'Buy Again' might deep link to a pre-filled shopping cart. There is a limit of three actions per receipt.

NOTE

For security reasons, we recommend that the action urls share the same domain as the sending merchant, wherever possible. Action URLs that don’t share a domain with the sending merchant may be filtered by the receiver.

"actions": [
  {
    "name": "Emergency Roadside Assistance",
    "url": "https://yourco.com/support/be1e1b57-8fe9-4729-8b7d-f9a4690bb2cd"
  },
  {
    "name": "Rebook",
    "url": "https://yourco.com/buy/ad058b82-d0dd-4534-a915-d448df098167"
  }
]
FieldTypeDescription
namestringLabel that appears on the button.
urlstringAction deep link.

Payments

"payments": [
  {
    "paid_at": 1679609767,
    "payment_type": "card",
    "amount": 234,
    "card_payment": {
      "last_four": "7806",
      "network": "mastercard"
    },
    "ach_payment": null
  }
]
FieldTypeDescription
amountint
paid_atintMeasured in seconds since the Unix epoch.
payment_typenullable enumOne of card or ach.
card_paymentnullable objectCard payment object.
ach_paymentnullable objectACH payment object.
Card Payment Object

Card Payment

FieldTypeDescription
last_fourstringThe last four digits of the card number.
networknullable enumOne of amex, diners, discover, eftpos_au, jcb, mastercard, unionpay, or visa.
ACH Payment Object

ACH Payment

FieldTypeDescription
routing_numberstringACH routing number.

Primitives

Foundational objects used in a variety of locations within the receipt schema.

Org Primitive

Org

A merchant, third party, or employer profile.

TIP

The org object is used to describe both a sending merchant and a third party merchant. In the former case, the org object is expanded implicitly via the Versa Registry, whereas in the latter case, the org object is explicitly encoded into the receipt, via the header third_party object.

{
  "name": "Some Co",
  "legal_name": "Some Co, Inc.",
  "brand_color": "#f0C14B",
  "logo": "https://static.platform.co/image_url.png",
  "logo_asset_id": "asset_6dbca44449094eb28aaa6b3c6b2aa4",
  "website": "platform.co",
  "vat_number": null,
  "address": null
}
FieldTypeDescription
namestringThe organization's common name.
legal_namenullable stringThe organization's legal name.
brand_colornullable stringHex color.
logonullable string⚠️ Deprecated: Logo image url, in a square aspect ratio. Use logo_asset_id instead.
logo_asset_idnullable stringAsset id of uploaded logo image. Recommended size 400x400 in a square aspect ratio.
websitenullable stringOrganization's primary website url.
vat_numbernullable string
addressnullable objectAn address object.
Person Primitive

Person

{
  "first_name": "Theodore",
  "last_name": "Doe",
  "preferred_first_name": "Ted",
  "email": "tdoe@platform.co",
  "phone": "+14155552671",
  "metadata": []
}
FieldTypeDescription
first_namenullable stringLegal first name.
last_namenullable stringLegal last name.
preferred_first_namenullable string
emailnullable string
phonenullable stringPhone number in the E.164 format.
metadataarrayArray of metadata objects, for any additional info.
Place Primitive

Place

Describes a brick-and-mortar location.

{
  "name": "Widget Co",
  "address": {
    "tz": "America/New_York"
  },
  "phone": "+14155552671",
  "url": null,
  "google_place_id": null,
  "image": null
}
FieldTypeDescription
namenullable stringPlace name.
addressnullable objectAn address object.
phonenullable stringPhone number in the E.164 format.
urlnullable stringURL for specific place, e.g. chain.com/store-id.
google_place_idnullable stringMapping to the Google Places database.
imagenullable stringImage representing the place.
Address Primitive

Address

{
  "street_address": "123 Main St",
  "city": "Anytown",
  "region": "CA",
  "country": "US",
  "postal_code": "12345",
  "lat": 37.7749,
  "lon": -122.4194,
  "tz": "America/Los_Angeles"
}
FieldTypeDescription
street_addressnullable string
citynullable string
regionnullable stringTwo letter region code.
countrynullable stringTwo letter ISO 3166 country code.
postal_codenullable string
latnullable number
lonnullable number
tznullable stringA list of possible time zone values is maintained at the IANA Time Zone Database.
Item Primitive

Item

A generic line item.

{
  "description": "Blue Cheese Crumbles",
  "amount": 1780,
  "quantity": 10,
  "unit_cost": 178,
  "unit": null,
  "product_image_asset_id": null,
  "group": null,
  "unspsc": null,
  "url": null,
  "date": null,
  "taxes": [
    {
      "amount": 432,
      "rate": 0.0875,
      "name": "GST"
    }
  ],
  "metadata": [{ "key": "SKU", "value": "524959" }],
  "adjustments": []
}
FieldTypeDescription
descriptionstringDescription of the good / service.
amountintegerSubtotal for the line item (typically quantity × unit_cost + adjustments). Does not include taxes.
quantitynullable numberQuantity of items.
unit_costnullable integerCost of the good / service in the smallest currency unit.
unitnullable stringField describing the unit type, typically for weight or volume -based values, e.g. 'kg' or 'gallons'. Leave null for 'each'.
product_image_asset_idnullable stringAsset id of uploaded product image.
groupnullable stringGrouping of line items.
unspscnullable stringThe 8-digit UNSPSC code for this item.
urlnullable stringURL to product page.
datenullable stringDate corresponding to the line item, in ISO 8601 format (YYYY-MM-DD), e.g. for nightly rate in a hotel folio.
taxesarrayArray of tax objects.
metadataarrayArray of key/value metadata pairs, e.g. SKU.
adjustmentsarrayArray of adjustment objects.
Metadata Primitive

Metadata

Use line item metadata to track things not otherwise in the schema. E.g. SKU, Size, Color, UNSPSC Code, etc.

{
  "key": "SKU",
  "value": "524959"
}
FieldTypeDescription
keystringThe type of metadata, e.g. 'Size', 'Brand', 'Product Condition', 'Special Instructions', etc.
valuestringThe corresponding value.
Tax Primitive

Tax

{
  "amount": 432,
  "name": "GST",
  "rate": 0.0875
}
FieldTypeDescription
amountintThe total tax, in the smallest currency unit.
namestringE.g. 'VAT' or 'GST'.
ratenullable numberThe tax rate, e.g. 0.05 for 5%.
Adjustment Primitive

Adjustment

To be used for discounts, tip, fees, surcharges, tolls.

{
  "amount": 1234,
  "adjustment_type": "tip",
  "name": "Tip",
  "rate": null
}
FieldTypeDescription
amountintThe total of the adjustment, in the smallest currency unit. Positive value for tip / fee, negative value for discount.
adjustment_typeenumOne of discount, tip, fee, add_on, other.
namenullable stringThe name of the adjustment.
ratenullable numberThe adjustment rate, e.g. -0.1 for 10% discount, or 0.2 for 20% tip. Null for fixed adjustment.

Definitions & Formatting

Currency Values

All API requests expect amounts to be provided in a currency’s smallest unit. For example, to represent 10 USD, provide an amount value of 1000 (that is, 1000 cents). For zero-decimal currencies, still provide amounts as an integer but without multiplying by 100. For example, to represent ¥500, provide an amount value of 500.

Images

Images must be hosted at public URLs. The images are likely to be indexed by the receiver. For best results, no image dimension should be less than 400px, or greater than 2,000px.