Reference types

Reference types link between data types in the Codat commerce data model.

customerRef

Links to the Customers data type. Orders, which include payments, discounts, and service charges, use a customerRef that contains the ID and name of the linked customer.

"customerRef": {
            "id": "string", // 'id' unique to the customer - from the Customers data type
            "name": "string" // 'name' of the customer - from the Customers data type
}

locationRef

Links to the Locations data type. Products variant inventory locations include a locationRef that contains the ID and name of the location at which stock is held.

"locationRef": {
            "id": "string", // 'id' unique to the product - from the Locations data type
            "name": "string" // 'name' from the Locations data type
}

productRef

Links to the Products data type. Order line items include a productRef that contains the ID and name of the linked product.

"productRef": {
        "id": "string", // 'id' unique to the product - from the Products data type
        "name": "string" // 'customerName' from the Customers data type
}

productVariantRef

Links to the Products data type. Order line items include a productVariantRef that contains the ID and name of the linked product variant.

"productVariantRef": {
            "id": "string", // 'id' unique to the product - from the Products data type
            "name": "string" // 'name' from the Products data type
}

transactionSourceRef

Links to the Transactions data type. Transactions, for example, a refund, include a transactionSourceRef, that contains the ID and type of the original transaction. In this case, the order that was refunded.

{
   "transactions":[
      {
         "id":"62fce855-4aff-41b0-8607-54e1cf4d35a4",
         "totalAmount":-18.42,
         "currency": "GBP",
         "type":"Refund",
         "transactionSourceRef":{
            "id":"5bb8f0cb-168f-41ad-ab62-cd511a7e5282",
            "type":"Order"
         }
      }
   ]
}
"transactionSourceRef": {
        "id": "string", // 'id'unique to the transaction -  from the Transactions data type
        "type": "string" // 'type' from the Transactions data type Unknown, Fee, Order, Payment or Service Charge
}

Did this page help you?