Files
eryao/web/src/lib/api-routes.ts
T
zl-q f07e307e82 feat: integrate CREEM web payment for credits purchase
Replace abandoned iOS App Store route with CREEM Merchant of Record
payment integration for web-based credits purchase.

Backend changes:
- Add CreemClient for CREEM API communication
- Add CreemService for checkout creation and webhook handling
- Add creem_transactions table for payment tracking
- Fix webhook payload parsing (id, order.id, customer.id structure)
- Integrate with existing points ledger system

Frontend changes:
- Display dynamic prices from CREEM API
- Support decimal price formatting (e.g., $1.00)
- Add checkout flow with redirect to CREEM hosted page
2026-05-11 18:38:21 +08:00

38 lines
1.2 KiB
TypeScript

export const API_ROUTES = {
auth: {
sendOtp: '/api/v1/auth/otp/send',
emailSession: '/api/v1/auth/email-session',
refreshSession: '/api/v1/auth/sessions/refresh',
deleteSession: '/api/v1/auth/sessions',
},
users: {
profile: '/api/v1/users/me/profile',
updateProfile: '/api/v1/users/me/profile',
updateSettings: '/api/v1/users/me/settings',
avatarUploadUrl: '/api/v1/users/me/avatar/upload-url',
uploadAvatar: '/api/v1/users/me/avatar',
},
points: {
balance: '/api/v1/points/balance',
packages: '/api/v1/points/packages',
},
payments: {
creemCheckout: '/api/v1/payments/creem/checkouts',
},
notifications: {
list: '/api/v1/notifications',
unreadCount: '/api/v1/notifications/unread-count',
markRead: (id: string) => `/api/v1/notifications/${id}/read`,
markAllRead: '/api/v1/notifications/mark-all-read',
},
agent: {
history: '/api/v1/agent/history',
historyByThread: (threadId: string) => `/api/v1/agent/history?threadId=${threadId}`,
runs: '/api/v1/agent/runs',
runEvents: (threadId: string) => `/api/v1/agent/runs/${threadId}/events`,
},
feedback: {
submit: '/api/v1/feedback',
},
} as const;