Skip to content

feat: add subscription schemas and contracts (MDK-401)#12

Merged
NatElkins merged 10 commits into
mainfrom
mdk-401
Jan 27, 2026
Merged

feat: add subscription schemas and contracts (MDK-401)#12
NatElkins merged 10 commits into
mainfrom
mdk-401

Conversation

@NatElkins
Copy link
Copy Markdown
Contributor

Summary

  • Add subscription webhook payload schema with events: subscription.created, subscription.renewed, subscription.canceled, subscription.payment_failed
  • Add subscription contract with get, createRenewalCheckout, and cancel endpoints
  • Export new schemas and contracts from main index

Related

Part of MDK-401 subscriptions MVP implementation.

Add subscription support for recurring payments:
- SubscriptionSchema with status, period dates, and cancellation fields
- SubscriptionWebhookPayloadSchema for subscription.* events
- Subscription ORPC contracts (createRenewalCheckout, cancel, get)
Add customer endpoint support for subscription management:
- CustomerSchema with subscriptions and hasActiveSubscription
- CustomerSubscriptionSchema for subscription summaries
- GetCustomerInputSchema with externalId/email/customerId lookup
- customer.get ORPC contract
@NatElkins NatElkins marked this pull request as ready for review January 27, 2026 14:07
@NatElkins
Copy link
Copy Markdown
Contributor Author

@codex Review

Copy link
Copy Markdown

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: 44e20820ff

ℹ️ About Codex in GitHub

Codex has been enabled to automatically review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

When you sign up for Codex through ChatGPT, Codex can also answer questions or update the PR, like "@codex address that feedback".

Comment thread src/schemas/subscription.ts Outdated
@NatElkins
Copy link
Copy Markdown
Contributor Author

@codex Review

@chatgpt-codex-connector
Copy link
Copy Markdown

Codex Review: Didn't find any major issues. Bravo.

ℹ️ About Codex in GitHub

Codex has been enabled to automatically review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

When you sign up for Codex through ChatGPT, Codex can also answer questions or update the PR, like "@codex address that feedback".

Comment thread src/contracts/subscription.ts
Comment thread src/schemas/customer.ts Outdated
Comment thread src/schemas/customer.ts Outdated
…cription

- Add z.string().datetime() validation to currentPeriodStart, currentPeriodEnd
  in SubscriptionSchema and CustomerSubscriptionSchema
- Remove hasActiveSubscription from CustomerSchema as it can be derived
  from subscriptions array client-side
Allows the schema to handle edge cases while business logic
enforces email requirement at subscription creation time.
Resolve conflicts:
- package.json: use version 0.1.18 from main, keep prepare script
- src/index.ts: add subscription to contracts, keep MCP schemas/contracts
- src/contracts/customer.ts: keep both SDK and MCP customer endpoints
- src/schemas/customer.ts: keep both CustomerSchema (SDK) and McpCustomerSchema (MCP)
@NatElkins NatElkins merged commit 3616078 into main Jan 27, 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.

2 participants