Docs

Log into read the version of docs relevant to your site.

Using account Hierarchy with Chargebee

Problem Statement

This article explains how to check hierarchical relations in Chargebee, find parent/child accounts, view invoicing and payment setup, and check when hierarchy was created or modified.

Solution

Use the hierarchies table to view hierarchy details. Example: one parent with two children.

1. How many relations does a customer have?

Search the hierarchies table by customer handle. Use:

  • hierarchies.lft – Starts at 1 (no parent). Value 1 = no parent; 2 = two parent accounts above; etc.
  • hierarchies.rgt – Starts at 4 (no children). Adds 1 per child: value 6 = two children; 5 = one child.

2. What is the parent account?

Use hierarchies.parent_id. Empty means no parent.

3. What are the child accounts?

There is no child column. Use hierarchies.rgt to infer if the customer has children (as described above).

4. Invoicing and payment setup

Use hierarchies.invoice_owner_id and hierarchies.payment_owner_id.

5. When was the hierarchy created or modified?

Use hierarchies.created_at and hierarchies.modified_at.

Note: If invoicing and payment are set to different accounts, hierarchies.rgt increases by 1.

Was this article helpful?