> ## Documentation Index
> Fetch the complete documentation index at: https://docs.withorb.com/llms.txt
> Use this file to discover all available pages before exploring further.

# Use the prepurchase ledger with multiple custom credit types

> Orb allows you to define multiple types of custom pricing units to manage various products or services under different credit pools. This feature is useful when you want separate credit allocations for different types of usage, such as API calls and transactions. Here’s how to set up and manage multiple custom pricing units for your customers.

<iframe src="https://www.loom.com/embed/2566eb244a364736a0f0ece0ea062b59?sid=583eb364-7453-4244-972d-170290cd260a" title="Embedded content" className="w-full h-96 rounded-xl" />

## Step 1: Creating multiple custom pricing units

1. **Go to Settings** > **Pricing Units**:
   1. You can define multiple custom pricing units based on the types of products or services you offer.
2. **Create Custom Pricing Units**:
   1. Example: Create **API Credits** for tracking API usage and **Transaction Credits** for monitoring transaction completions.
   2. You can name the credits based on their use case. These credits will act as separate pools of currency from which your usage prices can be drawn.

## Step 2: Setting up a plan with multiple custom pricing units

1. **Create a new plan**: Navigate to the **Plans** tab and click **New** to create a plan. For example, “Starter with Multiple Products.”
2. **Enable Custom Pricing Units**: This will allow you to configure different credit types for different usage metrics.
3. **Add Usage-Based Prices**:
   1. Define a **Billable Metric** for each product. For instance:
      1. Select **API calls** for the first usage-based price, assign **API Credits** as the pricing currency, and set the rate (e.g., 1 API credit per API call, each credit worth \$2).
      2. For the second usage-based price, choose **Transactions Completed** and assign **Transaction Credits** with a rate of, for example, one transaction credit per transaction, each worth \$5.

This plan will draw down from the appropriate credit pool based on which product is being used (API calls or transactions).

## Step 3: Subscribing a customer to a plan with multiple credit pools

1. **Create a subscription** for a customer using the plan that contains multiple custom credit currencies (e.g., “Starter with Multiple Products”).
2. **Ingest Usage**: As usage events are ingested, Orb will draw from the relevant credit pool for each metric. For example:
   1. API calls will deduct from the **API Credits** pool.
   2. Transactions will deduct from the **Transaction Credits** pool.
3. **Managing Credits**: You can add credits to each pool individually:
   1. Add credits to the **API Credit** pool if the customer is using API calls.
   2. Add credits to the **Transaction Credit** pool if the customer is completing transactions.
   3. Usage will be deducted from the corresponding credit pool based on the service used.

## Step 4: Handling overages and currency matching

1. **Overages**: If a customer exhausts their credit pool, overage charges will apply as defined in the plan.
   1. Example: If a customer runs out of API credits, they might be charged \$2 for each additional API call.
2. **Currency Matching**: Orb ensures that the **currency of the credit pool** matches the **currency of the usage price**.
   1. For instance, if the usage price is in **USD**, Orb will first draw from a USD credit pool (if it exists), and then charge overages in USD if the pool is exhausted.
   2. For custom pricing units, you’ll need to define the conversion rate on the plan (e.g., 1 API credit equals \$2).
3. **Real-World Currencies**: The same logic applies to real-world currencies like USD. If your usage prices are in USD, Orb will deduct from any USD credit block before applying overage charges.

## Step 5: Viewing the credit ledger

1. **Track Credit Usage**: You can view a detailed breakdown of how credits are being used for different products.
   1. The **Credit Ledger** will display increments and decrements for each credit pool.
   2. You can backdate the credits up to three months, and Orb will adjust the ledger accordingly to account for previous usage events.
2. **Pending States**: The credit ledger may show pending states for usage events that are still within the grace period. Once the grace period elapses, these events will be finalized, and credits will be fully deducted.
