Skip to content

update examples to use sdk v0.16.2 #13

@lpmsh

Description

@lpmsh

need to utilize the new createUsageEvent method on useBilling from v0.16.2

effects all examples in home-client.txt (nextjs) and index.tsx (tanstack) in the

can do away with dedicated usage events api route in favor of the catchall since it's handled in the sdk

this needs replacing:

const response = await fetch("/api/usage-events", {
  method: "POST",
  headers: {
    "Content-Type": "application/json",
  },
  body: JSON.stringify({
    usageMeterSlug: "fast_generations",
    amount,
    transactionId,
  }),
});

with something like:

const result = await billing.createUsageEvent({
  usageMeterSlug: "fast_generations",
  amount,
  transactionId,
});

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions