Handles cryptocurrency payments for Lilith premium content. The orchestrator coordinates wallet handoff, quote construction, compliance, settlement verification, revenue distribution, and access provisioning.
Pipeline#
- Compliance guard – validates purchase intent and settlement safety.
- Content catalog – retrieves premium content metadata, pricing, and access policy.
- Pricing engine – emits on-chain quotes with fee and revenue split breakdowns.
- Wallet gateway – generates smart contract call data and verifies settlement receipts.
- Session store – persists payment session state transitions and expiry.
- Ledger – records authorizations, settlements, and failure trails.
- Royalty splitter – computes creator/platform/treasury payouts per settlement.
- Access manager – activates premium content access following confirmed payment.
- Notification service – informs the buyer and stakeholders of lifecycle events.
- Analytics reporter – publishes metrics for observability and financial reporting.
Usage#
ts
import { createCryptoPaymentService } from './service';
const service = createCryptoPaymentService({
contentCatalog,
pricingEngine,
walletGateway,
sessionStore,
ledger,
royaltySplitter,
accessManager,
notificationService,
analyticsReporter,
complianceGuard,
});
const session = await service.createPaymentSession({
contentId: 'premium-meditation-aurora',
walletAddress: '0xuserwallet',
chainId: 137,
quantity: 1,
locale: 'en-US',
referralCode: 'LUMINA2025',
});
await service.confirmSettlement({
sessionId: session.sessionId,
transactionHash: '0xsettle',
});
Tests#
bash
npx jest --config apps/lilith/svc-payment-orchestrator/jest.config.cjs --runInBand