Fees for partners

Fees are essential charges associated with purchasing, using, or maintaining a product. They come in various forms and serve different purposes, such as covering costs and generating revenue.

Fees configuration

The fee configuration is defined inside the -storefront- configuration. The type of the fee tells us the intention of the fee and the entity field the entity to which it will apply.

enum FeeTypes {
  SERVICE
  MATERIAL
  PERCEPTION
}

enum FeeEntities {
  NONE
  PRODUCT
}

type ConfigFee {
    type: FeeType!
    entity: FeeEntities! 
}

Prices

Multiple fees with varying thresholds can be configured for a single product, introducing a tier-based functionality where each fee is triggered once a specific threshold is exceeded.

A fee is imposed when the cumulative gross price (base price multiplied by the quantity of each product) of all items in the cart surpasses the set threshold.


type FeeThreshold {
    type: FeeType! 
    threshold: Float! // threshold to trigger the field expressed in amount 
    fee: Float! // total fee to be added to each product expressed in amount
}

type Price {
    id: ID!
    sku: String!
    key: String!
    price: Float!
    basePrice: Float
    fees: [FeeThreshold]
    isActive: Boolean
    customFields: JSON
    createdAt: Date
    updatedAt: Date
}

Cart

The list of active fees with the total of each fee is stored inside the -activeFees- array. The total fee is summed automatically to the total of the cart.

type FeeThreshold {
    type: FeeType!
    threshold: Float!
    fee: Float!
 }

  type ActiveFee {
    fee: FeeThreshold
    total: Float
}

type Cart {
    id: ID!
    items: [CartProduct]
    total: Float
    subtotal: Float
    activePromotions: [ActivePromotion]
    status: CartStatus
    warnings: [String]
    customFields: JSON
    groups: [CartGroup]
    activeFees: [ActiveFee]
    createdAt: Date
    updatedAt: Date
  }

Fees are calculated automatically each time a product is added or removed from the cart.

Order

For the order, the fees are stored the same as it is in the cart.

type FeeThreshold {
    type: FeeType!
    threshold: Float!
    fee: Float!
 }

  type ActiveFee {
    fee: FeeThreshold
    total: Float
}

type Order {
		...    
    activeFees: [ActiveFee]
    ....
 }