Reference types

Commerce reference types link between data types in the Codat commerce data model.

For accounting reference types, see Reference types in the Accounting section.

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' from the Customers data type
}

locationRef

Links to the Locations data type in the following objects:

  • Products variant inventory locations include a locationRef that contains the ID and name of the location at which stock is held.

  • Orders include a locationRef that contains the ID and name of the location where the order was placed.

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

paymentMethodRef

Links to the Payment Methods data type. Payments include a paymentMethodRef that contains the ID and name of the method of payment.

"paymentMethodRef": {
    "id": "string",  // 'id' unique to the payment method - from the Payment Methods data type
    "name": "string" // 'name' from the Payment Methods 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" // 'name' from the Products 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 source of a transaction in the Transactions data type when the transaction has been triggered by an event. The transactionSourceRef contains the ID and type of the original event. For example, the transaction triggered by a refund will include a reference to 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?