Transactions API

Look up one of your transactions to see where Versa is with its receipt: the receipt-retrieval state, what became of the booking, and every receipt Versa has collected for it. It answers the same question as the receipt_retrieval.completed webhook, on demand: use it to reconcile a missed delivery, or to check on a transaction before its receipt has arrived.

The Transactions API is served at https://api.versa.org/transactions and uses the same client credentials as the Events API, the Flags API and the Files API.

Quick Example: Look up a transaction by your own id

cURL Example
curl 'https://api.versa.org/transactions?merchant_transaction_id=your_booking_id' \
  -H 'Authorization: Basic CLIENT_ID:CLIENT_SECRET'

Authentication

Every request carries your client credentials in an Authorization header using the Basic scheme, either as the raw pair or base64-encoded:

Authorization: Basic CLIENT_ID:CLIENT_SECRET

Use a production client credential of your organization: the response carries download URLs for your receipts. A test credential is refused with 403 and the body {"error": "Test credentials are not accepted on the Transactions API"}. A missing or incorrect credential answers 401 with the body {"error": "Invalid client credentials"}. If Versa cannot complete the credential check, the request answers 503 with the body {"error": "Credential check unavailable"}.

Every error on this API is a JSON object with a single error message. A transaction that is not yours, or that does not exist, answers 404 with {"error": "Not found"}; the two cases are deliberately indistinguishable.

API Reference

Get a transaction

GET https://api.versa.org/transactions?transaction_id={transaction_id}
GET https://api.versa.org/transactions?merchant_transaction_id={merchant_transaction_id}

Returns the transaction the id names, with its receipts. Name it by exactly one of the two ids the webhooks carry.

Query Parameters

ParameterTypeDescription
transaction_idstringThe Versa network id returned when the transaction's event was posted to the Events API.
merchant_transaction_idstringYour own id for the transaction, as you supplied it.

Provide exactly one of the two.

Example Request

curl 'https://api.versa.org/transactions?transaction_id=txn_555raszzb2esgvra33qn9kyw6t' \
  -H 'Authorization: Basic CLIENT_ID:CLIENT_SECRET'

Response

{
  "id": "dtx_01kxb4yq3ce00a78ns2gqj6xqs",
  "transaction_id": "txn_555raszzb2esgvra33qn9kyw6t",
  "merchant_transaction_id": "your_booking_id",
  "created": 1789516800,
  "receipt_retrieval_state": "completed",
  "booking_disposition": "completed",
  "receipts": [
    {
      "file_id": "file_01kxb5d7qve00a78ns2gqj6xqs",
      "url": "https://storage.googleapis.com/...",
      "size": 55555,
      "content_type": "application/pdf",
      "created": 1789776000
    }
  ]
}

Response fields

FieldTypeDescription
idstringVersa's id for the transaction. If Versa has combined two records of the same purchase (a booking and its card charge, say), this is the id of the combined transaction.
transaction_idnullable stringThe Versa network id, when the transaction came from an event you posted.
merchant_transaction_idnullable stringYour own id for the transaction, when you supplied one.
createdintegerWhen Versa created the transaction, in Unix seconds.
receipt_retrieval_stateenumWhere Versa is with the receipt, as of this response. See Receipt retrieval states.
booking_dispositionnullable enumcompleted, canceled or no_show: what became of the booking as far as Versa knows now. null when the transaction has no booking, or Versa could not determine it; treat null as unknown.
receiptsarrayEvery receipt on the transaction, newest first, in the same shape as receipts[] on the receipt_retrieval.completed webhook. Empty until a receipt arrives.
receipts[].file_idstringThe file's id. Use it with the Files API to fetch a fresh URL or the extracted receipt data.
receipts[].urlstringA signed download URL, valid for 15 minutes from the response.
receipts[].sizeintegerFile size in bytes.
receipts[].content_typestringThe file's MIME type, for example application/pdf.
receipts[].createdintegerWhen the file was stored, in Unix seconds.

Receipts Versa collected from your corporate card provider are not listed here, as on the Files API.

Receipt retrieval states

StateMeaning
scheduledNot due yet: the stay has not ended, or the card charge has not settled.
pending_merchant_evalVersa is identifying the merchant and how to reach it.
pending_networkThe merchant delivers receipts over the Versa network; Versa is waiting for it there.
pending_responseVersa has asked the merchant for the receipt and is waiting for a reply.
inboxVersa is working on the receipt: a reply from the merchant to act on, or a next request to make.
completedVersa has a receipt for the transaction. Final.
failedVersa stopped trying to retrieve the receipt. Final; the receipt_retrieval.failed webhook carried the reason.

The state is computed when you ask, so it can move between the non-final states from one request to the next.

StatusMeaning
400Neither or both ids were given ("Provide exactly one of transaction_id or merchant_transaction_id"), or the one given is blank ("<field> must not be blank").
403The credential is a test credential; use a production one.
404No transaction of your organization has that id.
409The id names more than one transaction ("This identifier matches more than one transaction"); look it up by the other id.
503Versa could not read the transaction or reach file storage; retry shortly.