VaultBackend

interface VaultBackend

The app's view of the server's Stripe Customer + vault rail (roadmap #7) — mirrors PayoutBackend's shape: save/list/charge each do a server round-trip against core:protocol DTOs. Implemented in core:network.

A modern retelling of the five-gateway card_id vault pattern: save a card token once against a customer, charge it later without re-entering. The raw token never comes back from the server — only SavedInstrument's masked brand/last4.

Functions

Link copied to clipboard
abstract suspend fun charge(customerId: String, instrumentId: String, catalogItemId: String, idempotencyKey: String): InstrumentCharge

POST /vault/{customerId}/instruments/{instrumentId}/charge. idempotencyKey must be stable across retries of the SAME logical charge attempt.

Link copied to clipboard
abstract suspend fun list(customerId: String): List<SavedInstrument>

GET /vault/{customerId}/instruments — list saved instruments for a customer.

Link copied to clipboard
abstract suspend fun save(customerId: String, cardToken: String, brand: String, last4: String, idempotencyKey: String): SavedInstrument

POST /vault/{customerId}/instruments. idempotencyKey must be stable across retries of the SAME logical save attempt, same contract as PaymentBackend.createOrder's.