Skip to content

Conversation

@NatElkins
Copy link
Contributor

Summary

  • Change prices array to singular price object on Product and CheckoutProduct schemas
  • Add currency field to price objects
  • Add products.list contract for fetching organization products

This aligns with the Polar model where one product = one price. Monthly/yearly variants are separate products rather than multiple prices on a single product.

Breaking Changes

  • ProductSchema.pricesProductSchema.price (nullable single object)
  • CheckoutProductSchema.pricesCheckoutProductSchema.price (nullable single object)

Test plan

  • Updated schema tests to use single price model
  • Tested with moneydevkit.com backend changes
  • Verified checkout calculation uses product.price correctly

Align with Polar model: one product = one price. METERED prices
are filtered at API level, so SDK consumers only see the base price.

- ProductSchema.price is now singular (nullable)
- CheckoutProductSchema.price is now singular (nullable)
- Added currency field to price objects
Create shared CurrencySchema (z.enum(["USD", "SAT"])) in schemas/currency.ts
and use it throughout the API contract for type safety and validation.

- Add src/schemas/currency.ts with CurrencySchema and Currency type
- Update checkout.ts, products.ts, invoice.ts to use CurrencySchema
- Export CurrencySchema from index.ts
@NatElkins NatElkins merged commit 471daed into main Jan 14, 2026
2 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants