Logo

Customer

Beta
Beta

OpenMeter Billing is currently in Beta.

Customers can be individuals or organizations that can subscribe to plans and have access to features. You can create customers using the API or the dashboard.

Create a Customer

When you onboard a customer, you must provide the following information:

NameDescription
NameThe name of the customer. e.g. "ACME, Inc."
Assigned Subject(s)The subject(s) that the customer is associated with in the meters e.g. "my-identifier"

Example: Create a Customer

const customer = await openmeter.customers.create({
  name: 'ACME, Inc.',
  usageAttribution: { subjects: ['my-identifier'] },
});

Read more about assigned subjects below.

Bring Your ID

OpenMeter accepts an optional key property when creating a customer. The key is a unique identifier for the customer that you can use to reference the customer in OpenMeter by using your internal id. A Couple of ideas for the customer key include your database ID, CRM ID, etc.

Example: Create a Customer with a Key

const customer = await openmeter.customers.create({
  name: 'ACME, Inc.',
  key: 'my-database-id',
  usageAttribution: { subjects: ['my-identifier'] },
});

You can look up the customer by the key field using the list API as:

Example: Get a Customer by Key

const customers = await openmeter.customers.list({ key: 'my-database-id' });

The endpoint will return an array of customers with one or zero elements. The key filter is a case-sensitive exact match.

Assigned Subjects

Billable events ingested to OpenMeter have a subject associated with them. Subjects in OpenMeter are entities with metered usage.

Customers can have one or many subjects assigned to them. This abstraction allows you to group usage data and billing for a customer.

For example, a customer can have multiple subjects like department1 or department2.

One Subject During Beta

During billing beta, only one subject can be assigned to a customer. In the future, you can assign multiple subjects to a customer.

Currency

Customers have a currency property that defines the currency in which OpenMeter will bill the customer. Customers can only subscribe to plans with the same currency as the customer.

Billing Profile

OpenMeter supports multiple billing profiles to control which tax, invoice, and payment provider to use for billing. Billing profiles also control collection methods and periods for invoices.

OpenMeter has a default billing profile that is used for all customers. You can create additional billing profiles to support different billing requirements and assign them to specific customers.

App Metadata

OpenMeter uses apps to extend the functionality of the platform. For example, you can use apps to integrate with external systems like Stripe or Salesforce.

Customers can have additional per-app metadata associated with them. This metadata helps to connect customers with external systems and maintain relevant metadata. For example, you can store a customer's Stripe Customer ID.

Example: Assign App Data to a Customer

const customer = await openmeter.customerApps.upsert(customer.id, [
  {
    type: 'stripe',
    stripeCustomerId: 'cus_123',
    // Optionally set the default payment method
    // stripeDefaultPaymentMethodId: 'pm_123',
  },
]);
Simplified Stripe Integration

Make sure to read the simplified Stripe Checkout Guide.