PracHub
QuestionsPremiumCoachesLearningGuidesInterview Prep
|Home/System Design/Meta

Implement hold/accept/cancel transfers

Last updated: Mar 29, 2026

Quick Overview

This question evaluates competency in transactional state management, concurrency control, idempotency, authorization, and failure recovery for pull-style fund transfers in the System Design category, emphasizing O(1) in-memory data structures and explicit transfer state transitions.

  • medium
  • Meta
  • System Design
  • Software Engineer

Implement hold/accept/cancel transfers

Company: Meta

Role: Software Engineer

Category: System Design

Difficulty: medium

Interview Round: Take-home Project

Implement pull-style transfers with hold/accept/cancel. Provide methods: String transfer(long timestamp, String targetAccountId, int amount) -> transferId; boolean accept(long timestamp, String accountId, String transferId); boolean cancel(long timestamp, String accountId, String transferId). On transfer, place a hold on the source account’s funds; accept moves the held funds to the target; cancel fully resets and clears the hold. Maintain allTransfer and pendingTransfer in hash maps rather than lists for O( 1) access. Describe state transitions, idempotency, failure recovery, and complexity.

Quick Answer: This question evaluates competency in transactional state management, concurrency control, idempotency, authorization, and failure recovery for pull-style fund transfers in the System Design category, emphasizing O(1) in-memory data structures and explicit transfer state transitions.

Related Interview Questions

  • Design Top-K, Crawler, and Chess Systems - Meta (hard)
  • Design Search And Web Crawling Systems - Meta (medium)
  • Design an Instagram-Style Social Feed - Meta (medium)
  • Design an Online Game Leaderboard - Meta (hard)
  • Design an On-Demand Delivery Platform - Meta (medium)
Meta logo
Meta
Sep 6, 2025, 12:00 AM
Software Engineer
Take-home Project
System Design
4
0

Pull-Style Transfers with Hold/Accept/Cancel

Context

You are building a wallet service that supports pull-style transfers. A transfer is initiated by the source account to place a hold on funds; the target account may accept to capture the held funds, or either party may cancel to release the hold back to the source. You will maintain transfer indices in hash maps for O(1) access.

Assume calls are made in an authenticated context where the caller's accountId is available. The provided method signatures intentionally omit an explicit source account for transfer(), implying the caller is the source. The accept() and cancel() methods include an accountId so you can authorize which party is acting.

Requirements

  1. Implement the following APIs:
    • transfer(long timestamp, String targetAccountId, int amount) -> String transferId
    • accept(long timestamp, String accountId, String transferId) -> boolean
    • cancel(long timestamp, String accountId, String transferId) -> boolean
  2. Semantics:
    • On transfer(), place a hold on the source account’s funds for the amount and create a PENDING transfer.
    • On accept(), move the held funds from source to target and mark the transfer ACCEPTED.
    • On cancel(), fully reset the source account’s funds (release hold) and mark the transfer CANCELED.
  3. Data structures:
    • Maintain allTransfers and pendingTransfers in hash maps (O(1) average-time lookups) keyed by transferId. Use an accounts map for account lookup.
  4. Describe and implement:
    • State transitions for a transfer.
    • Idempotency rules for each API.
    • Failure recovery approach (atomicity, crash safety).
    • Time/space complexity.

Assumptions

  • Amounts are non-negative integers (e.g., cents). No overdrafts.
  • The timestamp is provided by the caller and may be used for ordering/auditing and optional expiration checks.
  • Only the target account can accept; either source or target may cancel while pending.
  • A transfer may optionally expire after a TTL (if you choose to implement expiry); otherwise ignore timestamp except for audit.
  • In-memory solution is acceptable for this exercise; describe how you would make it durable in production.

Solution

Show

Submit Your Answer

Sign in to leave a comment

Loading comments...

Browse More Questions

More System Design•More Meta•More Software Engineer•Meta Software Engineer•Meta System Design•Software Engineer System Design
PracHub

Master your tech interviews with 8,500+ real questions from top companies.

Product

  • Questions
  • Learning Tracks
  • Interview Guides
  • Resources
  • Premium
  • For Universities
  • Student Access

Browse

  • By Company
  • By Role
  • By Category
  • Topic Hubs
  • SQL Questions
  • Compare Platforms
  • Discord Community

Support

  • support@prachub.com
  • (916) 541-4762

Legal

  • Privacy Policy
  • Terms of Service
  • About Us

© 2026 PracHub. All rights reserved.