# Service Snapshot — Payment Platform (Torbat Pay MVP 14.0–14.5)

# Normative spec: docs/ai-framework/service-snapshot-policy.md

schema_version: 1
snapshot_version: 4

service_name: payment
commercial_product: Torbat Pay
current_version: "0.14.5.0"
current_phase: payment-14.5
last_completed_phase: payment-14.5
next_phase: payment-14.6

completed_phases:
  - payment-reg
  - payment-arch
  - payment-14.0
  - payment-14.1
  - payment-14.2
  - payment-14.3
  - payment-14.4
  - payment-14.5

remaining_phases:
  - payment-14.6
  - payment-14.7
  - payment-14.8
  - payment-14.9
  - payment-14.10

registered_modules:
  - payment.foundation
  - payment.workspaces
  - payment.bundle_definitions
  - payment.tenant_bundles
  - payment.feature_toggles
  - payment.provider_assignments
  - payment.psp_registry
  - payment.credit_provider_registry
  - payment.psp_connections
  - payment.psp_routing
  - payment.merchant_accounts
  - payment.requests
  - payment.callbacks
  - payment.transactions
  - payment.ledger
  - payment.audit
  - payment.configuration
  - payment.refunds
  - payment.splits
  - payment.settlement_batches
  - payment.connectors
  - payment.checkout_sessions
  - payment.reconciliation
  - payment.accounting_intents
  - payment.analytics
  - payment.fraud_hooks

enabled_capabilities:
  - payment.foundation
  - payment.workspaces
  - payment.bundles
  - payment.feature_toggles
  - payment.provider_assignments
  - payment.psp_registry
  - payment.psp_connections
  - payment.psp_routing
  - payment.merchant_accounts
  - payment.requests
  - payment.callbacks
  - payment.transactions
  - payment.ledger
  - payment.audit
  - payment.configuration

enabled_bundles:
  - payment.byo_psp.basic
  - payment.torbat_pay.merchant

public_apis:
  - GET /health
  - GET /capabilities
  - GET /metrics
  - /api/v1/payment-workspaces
  - /api/v1/bundle-definitions
  - /api/v1/tenant-bundles
  - /api/v1/feature-toggles
  - /api/v1/provider-assignments
  - /api/v1/psp-provider-registrations
  - /api/v1/credit-provider-registrations
  - /api/v1/configurations
  - /api/v1/settings
  - /api/v1/audit
  - /api/v1/permissions/catalog
  - /api/v1/psp-connections
  - /api/v1/psp-routing-policies
  - /api/v1/merchant-accounts
  - /api/v1/merchant-settlement-profiles
  - /api/v1/payment-requests
  - /api/v1/callbacks/{provider_code}/{connection_id}
  - /api/v1/payment-transactions
  - /api/v1/payment-ledger-entries

published_events:
  - payment.request.created
  - payment.request.redirect_issued
  - payment.request.paid
  - payment.request.failed
  - payment.transaction.recorded

permission_prefix: payment.*

active_adrs:
  - ADR-001
  - ADR-003
  - ADR-006
  - ADR-010
  - ADR-012
  - ADR-020
  - ADR-021

payment_sources:
  implemented:
    - PSP
    - MERCHANT_FACILITATOR
  reserved:
    - CREDIT_PROVIDER

credit_reference_fields:
  - credit_provider_id
  - financing_reference
  - credit_authorization_reference
  - installment_contract_reference

reserved_future_services:
  - service_id: credit
    commercial_product: Torbat Credit
    database: credit_db
    event_namespace: credit.*
    integration_pattern: CreditProviderAdapter from Payment (same as PSP provider pattern)
    ownership: scoring, KYC, BNPL, financing, installment calculation — exclusive to Torbat Credit
    payment_ownership: schedule shell via InstallmentPlanContract only; opaque refs on intents

reserved_event_namespaces:
  - credit.*
    owner: credit
    note: Payment does not publish or consume credit.* in current implementation

integration_contracts:
  - contract: payment_intent.v1
    phase: payment-14.3
    status: implemented
    doc: docs/reference/payment-contracts.md
    includes_credit_refs: true
  - contract: callback_ingress.v1
    phase: payment-14.4
    status: implemented
    doc: docs/reference/payment-contracts.md
  - contract: checkout_session.v1
    phase: payment-14.8
    doc: docs/reference/payment-contracts.md
    status: reserved
  - contract: settlement_intent.v1
    phase: payment-14.9
    doc: docs/reference/payment-contracts.md
    status: reserved
  - contract: refund_intent.v1
    phase: payment-14.6
    status: reserved
  - contract: split_allocation.v1
    phase: payment-14.7
    status: reserved
  - contract: subscription_billing.v1
    phase: future
    status: reserved
  - contract: wallet_topup.v1
    phase: future
    status: reserved
  - contract: installment_plan.v1
    phase: future
    status: reserved
    note: Payment schedule shell only — not Credit Engine
  - contract: credit_authorization.v1
    phase: future
    status: reserved
    consumer: payment via CreditProviderAdapter
  - service: credit
    pattern: external Credit Provider; adapter registry like PSP; not implemented
    status: architecture reserved
  - service: core-platform
    pattern: L1 entitlement payment.module.enabled + feature_access.changed
  - service: accounting
    pattern: settlement_intent.v1 events — posting intents only
  - service: communication
    pattern: receipt/refund notify client
  - service: identity
    pattern: payer user_ref validation optional
  - service: crm
    pattern: contact_ref on payer
  - service: hospitality
    pattern: PaymentIntent consumer; pos_ticket refs
  - service: marketplace
    pattern: CheckoutSession + split_allocation.v1
  - service: sports_center
    pattern: PaymentIntent; membership refs
  - service: delivery
    pattern: optional COD payment ref
  - service: experience
    pattern: CheckoutSession; paid forms
  - service: loyalty
    pattern: wallet_topup.v1 future consumer

licensing_model:
  l1_core_entitlement: payment.module.enabled
  l2_payment_bundles:
    - payment.byo_psp.basic
    - payment.torbat_pay.merchant
    - payment.marketplace.splits
    - payment.advanced.refunds
    - payment.advanced.reconciliation
    - payment.future.subscriptions
    - payment.future.installments
    - payment.future.wallet_topup
    - payment.future.credit_provider
  l3_feature_toggles:
    - payment.capture.enabled
    - payment.refunds.enabled
    - payment.splits.enabled
    - payment.installments.enabled
    - payment.subscriptions.enabled
    - payment.wallet_topup.enabled
    - payment.credit_provider.enabled
    - payment.fraud_hooks.enabled

runtime:
  service_path: backend/services/payment
  database: payment_db
  api_port: 8012
  migration_head: "0006_phase_145_ledger"
  compose_service: payment-service

known_limitations:
  - Mock PSP adapter only — live ZarinPal/IDPay integrations deferred
  - CREDIT_PROVIDER payment source reserved but rejected at API (422)
  - Torbat Credit service not registered or implemented
  - credit.* event namespace reserved only — no producers
  - Refunds, splits, connectors, reconciliation, analytics not implemented (14.6+)
  - Vertical connector clients not implemented in consumer services
  - Accounting journal posting remains in Accounting service only

open_todos: []

deployment:
  host: "192.168.10.162"
  date: "2026-07-27"
  version: "0.14.5.0"
  migration_head: "0006_phase_145_ledger"
  health: ok
  frontend_hub: /payment/hub=200

last_handover_reference: docs/phase-handover/phase-14-5.md
last_updated: "2026-07-27"
