Last updated

Face-to-face transaction database changes

While not required, the following is a list of database tables we recommend to support your Trustap integration.

Every marketplace uses its own domain entities which can be items, listings or something similar to present to users what they are buying and selling. In the existing integrations of marketplaces and Trustap, the following database changes has been shown as good practice.

To track Trustap transactions and connect them to domain entities, alongside domain users with Trustap users, three data tables are proposed:

  • EntityTrustapTransaction
    • entityId
    • transactionId, integer
    • transactionType, string
    • sellerId
    • buyerId
    • created, timestamp
    • updated, timestamp
    • status, string
    • price, integer
    • charge, integer
    • chargeSeller, integer
    • currency, string
    • entityTitle, string
    • claimedBySeller, bool
    • claimedByBuyer, bool
    • complaintPeriodDeadline, timestamp
  • EntityTrustapMetadata
    • entityId
    • trustapEnabled, boolean
    • transactionType, string (for use cases where both types are used in the same integration)
  • UserTrustapMetadata
    • domainUserId
    • trustapGuestUserId, string
    • trustapFullUserId, string
    • trustapFullUserEmail, string

Proposed data tables are intentionally made in such a way that Trustap data don’t interfere with existing data tables. When looking at tables EntityTrustapMetadata and UserTrustapMetadata which could be columns in existing tables, we recommend explicitly leaving those data separated because this way the existing system isn’t coupled with Trustap integration, at least at the model layer.

The table EntityTrustapTransaction is a table which uses three domain values:

  • entityId → ID of domain entity which is sold and bought
  • sellerId → ID of the domain user which is a seller in this transaction, in other transactions this user can be buyer
  • buyerId → ID of the domain user which is a buyer in this transaction Regarding this data table, its data can be extended to contain more information that is sent from Trustap API. Again its records need to be updated every time there is a webhook request regarding the underlying transaction.