@crxpay/types
v0.1.0
Published
Shared TypeScript types for the crxpay SDK and React paywall.
Downloads
24
Maintainers
Readme
@crxpay/types
Shared TypeScript types for the crxpay SDK and React paywall components.
This package contains the type definitions for Subscription, Customer, Entitlement, Offering, OfferingPackage, Paywall, and the webhook payloads emitted by the crxpay backend. It exists so that @crxpay/sdk and @crxpay/react-paywall (and your own server-side code, if you consume our webhooks) can share one source of truth without circular dependencies.
You don't need to install this package directly — @crxpay/sdk depends on it.
Install
npm install @crxpay/types
# or
pnpm add @crxpay/typesUsage
import type { Subscription, Entitlement, Offering, Paywall } from '@crxpay/types';
function isPro(subscription: Subscription | null): boolean {
return subscription?.status === 'active' || subscription?.status === 'trialing';
}
function getPaywallTitle(paywall: Paywall): string {
return paywall.config.headline ?? 'Upgrade to Pro';
}What's in here
| Type | Used by | What it represents |
| ------------------- | -------------------------------- | -------------------------------------------- |
| Subscription | SDK, server webhooks | A customer's current subscription state |
| Customer | SDK, server webhooks | One paying user |
| Entitlement | SDK, server | A capability gated by a subscription |
| Offering | SDK, react-paywall | A pricing screen's set of plans |
| OfferingPackage | SDK, react-paywall | One plan inside an offering |
| Paywall | SDK, react-paywall | A configured paywall (visual + behavior) |
| WebhookEvent | Server-side webhook handlers | Strongly-typed webhook payloads from crxpay |
All types are versioned with the SDK — bump them in lockstep.
Links
- crxpay.io — landing page
- docs.crxpay.io — full SDK documentation
- Source on GitHub — issues and PRs
- Changelog — release notes (shared with the SDK)
License
MIT — see LICENSE.
