Skip to content
Get started
Menu
Get started

Manual VA transfer

Show the exact virtual account number and amount the host issued, let the payer copy the number, and check the status of the same payment attempt. The deadline tells the payer when to transfer by. Reaching it is never a payment verdict: only the host’s status says whether the money arrived.

Virtual account number with a copy action, exact amount Rp152.500, deadline countdown and pinned Check status action.Virtual account number with a copy action, exact amount Rp152.500, deadline countdown and pinned Check status action.
Pay into the issued account
Deadline countdown at 00:00 with a warning to check status before paying again; Check status stays pinned.
Deadline passed, still pending
The issuing response was lost, so no account number is shown and only Check status for the same attempt is offered.
Issuing response lost

From example/:

Terminal window
flutter run -d <device-id> -t lib/manual_transfer_demo.dart

Tap the copy icon: the demo’s host adapter writes the number to the clipboard. Tap Cek status; the synthetic host confirms success for the same attempt. The developer menu offers four scenarios:

  • Batas waktu lewat: the countdown reaches zero and a warning appears. The status stays pending until Cek status returns the host’s answer.
  • Cek status gagal: the first check fails; the last known pending status and the account stay on screen and the next check succeeds.
  • Respons VA hilang: the issuing response is unknown, so the kit hides the account. Cek status reconciles the same attempt and then shows the number. The block never offers a second transfer or a new attempt.

Changing a scenario starts a fresh synthetic session and ignores answers that belong to the previous one.

ManualTransferBlock takes the host’s PaymentAttempt, amount, a clock and callbacks for checking status and copying. The host keeps the attempt durable and calls PaymentAttempt.reconcile with every new snapshot; the kit drops snapshots for another attempt, older revisions and downgrades.

UI Existing library surface
Status, amount and Check status PaymentStatusView, PaymentAttempt, Observation
Account number, copy, amount and deadline PaymentInstructions, VirtualAccountInstructions
Lost issuing response SubmissionState.outcomeUnknown

The clipboard, polling, deep links and bank instructions stay in the host. The copy callback returns false when copying failed so the kit can say so. Every account number and amount in the demo is fictional. See the status and receipt pattern and the checkout pattern.

Source: compositions/manual_transfer_block.dart

Open this file on GitHub. Copy and adapt it in your host app.

import 'dart:async';
import 'package:flutter/material.dart';
import 'package:rakit_ui/rakit_ui.dart';
/// Copyable host composition for paying into a virtual account.
///
/// Every value is host data: the attempt and its snapshot, the account
/// number, exact amount and deadline. The deadline only tells the payer when
/// to transfer by. Reaching it is never a payment verdict: the status stays
/// whatever the host last reported and Check status remains available for
/// the same attempt. While the issuing response is unknown the kit hides the
/// account, so nobody is invited to transfer to an unconfirmed number.
class ManualTransferBlock extends StatelessWidget {
const ManualTransferBlock({
super.key,
required this.attempt,
required this.amount,
required this.invoice,
required this.payerLabel,
required this.clock,
required this.onCheckStatus,
required this.onCopy,
this.checking = false,
this.onDone,
});
final PaymentAttempt attempt;
final Money amount;
/// Invoice and merchant, shown as supporting context above the status.
final String invoice;
/// Already masked by the host, e.g. "Akun •••• 2190".
final String payerLabel;
final DateTime Function() clock;
final Future<void> Function() onCheckStatus;
/// Host clipboard: return false when copying failed.
final Future<bool> Function(String value) onCopy;
final bool checking;
/// Shown as the quiet footer action once the host reports a final status.
final VoidCallback? onDone;
@override
Widget build(BuildContext context) {
final theme = PaymentTheme.of(context);
final type = PaymentType.of(context);
final va = attempt.snapshot?.instructions;
final done =
attempt.snapshot?.status == PaymentStatus.succeeded && onDone != null;
return PaymentStatusView(
attempt: attempt,
amount: amount,
busyAction: checking ? PaymentAction.checkStatus : null,
onAction: (action) => switch (action) {
PaymentAction.checkStatus => onCheckStatus(),
// Only actions the host allowed reach here; this block offers none
// that starts a new attempt or pays again.
_ => null,
},
header: Padding(
padding: EdgeInsets.only(bottom: theme.space(PaymentSpace.block)),
child: Text('$invoice · $payerLabel', style: type.caption),
),
instructions: va == null
? null
: PaymentInstructions(
instructions: va,
clock: clock,
onCopyNumber: onCopy,
),
secondaryAction: done
? PaymentButton(
label: 'Selesai',
variant: PaymentButtonVariant.quiet,
onPressed: onDone,
)
: null,
);
}
}
Source: manual_transfer_demo.dart

Open this file on GitHub. Copy and adapt it in your host app.

import 'package:flutter/material.dart';
import 'package:rakit_ui/rakit_ui.dart';
import 'block_demo_shell.dart';
import 'compositions/manual_transfer_block.dart';
void main() => runBlockDemo(const ManualTransferDemo());
enum ManualTransferScenario { open, elapsed, checkOffline, issueUnknown }
final manualTransferIssuedAt = DateTime(2026, 11, 4, 10, 0);
final manualTransferDeadline = DateTime(2026, 11, 4, 11, 0);
const manualTransferAmount = Money.idr(152500);
/// Synthetic VA host. Status answers are declared fixture responses: time
/// passing never produces one. There is no bank SDK, network or polling.
class ManualTransferDemo extends StatefulWidget {
const ManualTransferDemo({
super.key,
this.initialScenario = ManualTransferScenario.open,
this.initialDark = false,
this.delay = const Duration(milliseconds: 600),
this.clock,
});
final ManualTransferScenario initialScenario;
final bool initialDark;
final Duration delay;
/// Fixed clock for tests and captures; the demo otherwise starts 18 minutes
/// after issue and runs in real time from there.
final DateTime Function()? clock;
@override
State<ManualTransferDemo> createState() => _ManualTransferDemoState();
}
class _ManualTransferDemoState extends State<ManualTransferDemo> {
late bool dark = widget.initialDark;
late ManualTransferScenario scenario;
late DateTime started;
late PaymentAttempt attempt;
final launched = DateTime.now();
bool checking = false;
int checks = 0;
int generation = 0;
/// Every check names this one attempt; the demo never creates another.
static const attemptId = 'VA-DEMO-217';
@override
void initState() {
super.initState();
reset(widget.initialScenario);
}
DateTime now() =>
widget.clock?.call() ?? started.add(DateTime.now().difference(launched));
PaymentStatusSnapshot snapshot(
PaymentStatus status, {
int revision = 1,
String? reason,
}) => PaymentStatusSnapshot(
attemptId: attemptId,
serverReference: 'TX-DEMO-88104217',
status: status,
revision: revision,
updatedAt: now(),
safeReason: reason,
allowedActions: status == PaymentStatus.pending
? const {PaymentAction.checkStatus}
: const {},
instructions: status == PaymentStatus.pending
? VirtualAccountInstructions(
providerLabel: 'Virtual Account Bank Demo',
accountNumber: '8808 1234 5678 9012',
amount: manualTransferAmount,
expiresAt: manualTransferDeadline,
steps: const [
'Buka aplikasi atau ATM bank Anda.',
'Pilih transfer ke virtual account.',
'Masukkan nomor di atas dan pastikan jumlahnya sama persis.',
'Simpan bukti transfer, lalu ketuk Cek status.',
],
)
: null,
);
void reset(ManualTransferScenario value) {
generation++;
scenario = value;
checking = false;
checks = 0;
// Elapsed starts past the deadline: the host still reports pending.
started = manualTransferIssuedAt.add(
Duration(minutes: value == ManualTransferScenario.elapsed ? 75 : 18),
);
attempt = value == ManualTransferScenario.issueUnknown
? const PaymentAttempt(
attemptId: attemptId,
quoteId: 'QUOTE-DEMO-217',
quoteRevision: 1,
methodId: 'va',
submission: SubmissionState.outcomeUnknown,
)
: PaymentAttempt(
attemptId: attemptId,
quoteId: 'QUOTE-DEMO-217',
quoteRevision: 1,
methodId: 'va',
submission: SubmissionState.accepted,
snapshot: snapshot(PaymentStatus.pending),
lastCheckedAt: now(),
);
}
Future<void> check() async {
if (checking) return;
final current = generation;
final count = ++checks;
setState(() {
checking = true;
attempt = attempt.copyWith(observation: Observation.refreshing);
});
await Future<void>.delayed(widget.delay);
if (!mounted || current != generation) return;
setState(() {
checking = false;
if (scenario == ManualTransferScenario.checkOffline && count == 1) {
// Failed refresh: keep the last known pending snapshot and attempt.
attempt = attempt.copyWith(observation: Observation.unavailable);
return;
}
final next = switch (scenario) {
// The issuing call was received after all: the account is now known.
ManualTransferScenario.issueUnknown when count == 1 => snapshot(
PaymentStatus.pending,
),
ManualTransferScenario.elapsed => snapshot(
PaymentStatus.succeeded,
revision: 2,
reason:
'Bank mengonfirmasi transfer yang diterima sebelum batas '
'waktu.',
),
_ => snapshot(PaymentStatus.succeeded, revision: 2),
};
// The kit's ordering rules drop wrong-attempt, stale or downgrading
// snapshots; a rejected one leaves the last known status in place.
attempt = attempt
.reconcile(next)
.attempt
.copyWith(observation: Observation.fresh, lastCheckedAt: now());
});
}
@override
Widget build(BuildContext context) => BlockDemoShell(
title: 'Transfer VA · Demo',
dark: dark,
onToggleDark: () => setState(() => dark = !dark),
scenarios: [
for (final (value, label) in [
(ManualTransferScenario.open, 'Menunggu transfer'),
(ManualTransferScenario.elapsed, 'Batas waktu lewat'),
(ManualTransferScenario.checkOffline, 'Cek status gagal'),
(ManualTransferScenario.issueUnknown, 'Respons VA hilang'),
])
(label: label, onSelected: () => setState(() => reset(value))),
],
body: (context) => ManualTransferBlock(
key: ValueKey(generation),
attempt: attempt,
amount: manualTransferAmount,
invoice: 'INV-DEMO-217 · Ruang Bayar Akademi',
payerLabel: 'Akun •••• 2190',
clock: now,
checking: checking,
onCheckStatus: check,
onDone: () => setState(() => reset(ManualTransferScenario.open)),
onCopy: copyToClipboard,
),
);
}
Source: block_demo_shell.dart

Open this file on GitHub. Copy and adapt it in your host app.

import 'package:flutter/material.dart';
import 'package:flutter/services.dart';
import 'package:flutter_localizations/flutter_localizations.dart';
import 'package:rakit_ui/rakit_ui.dart';
import 'themes.dart';
/// Starts a block demo edge-to-edge, as the shipped checkout demo does.
void runBlockDemo(Widget app) {
WidgetsFlutterBinding.ensureInitialized();
SystemChrome.setEnabledSystemUIMode(SystemUiMode.edgeToEdge);
runApp(app);
}
/// The example host's clipboard effect. It reports the real outcome and never
/// claims a copy that did not happen. The kit itself never touches the
/// clipboard (B11).
Future<bool> copyToClipboard(String value) async {
try {
await Clipboard.setData(ClipboardData(text: value));
return true;
} on PlatformException {
return false;
}
}
/// One developer scenario in the demo menu. Choosing it restarts the
/// synthetic session; it is never an end-user action.
typedef DemoScenario = ({String label, VoidCallback onSelected});
/// Ordinary phone host chrome shared by the block demos: app themes, Indonesian
/// localization, D85 system-bar styling, a light/dark switch and a developer
/// scenario menu. It is example scaffolding, not a block runtime: copy the
/// composition under `compositions/` and keep your own app shell.
class BlockDemoShell extends StatelessWidget {
const BlockDemoShell({
super.key,
required this.title,
required this.dark,
required this.onToggleDark,
required this.body,
this.scenarios = const [],
this.lightTheme,
this.darkTheme,
this.locale = const Locale('id'),
this.textScale,
});
final String title;
final bool dark;
final VoidCallback onToggleDark;
final List<DemoScenario> scenarios;
/// Optional illustrative host themes; the payment demos use Ruang Bayar.
final ThemeData? lightTheme;
final ThemeData? darkTheme;
/// Host locale for this synthetic demo.
final Locale locale;
/// Optional fixed text scale for accessibility captures; null follows the
/// device setting.
final double? textScale;
/// Built below the Scaffold, so sheets and toasts find their ancestors.
final WidgetBuilder body;
@override
Widget build(BuildContext context) => MaterialApp(
debugShowCheckedModeBanner: false,
theme: lightTheme ?? buildTheme(DemoBrand.ruangBayar, Brightness.light),
darkTheme: darkTheme ?? buildTheme(DemoBrand.ruangBayar, Brightness.dark),
themeMode: dark ? ThemeMode.dark : ThemeMode.light,
locale: locale,
supportedLocales: const [Locale('id'), Locale('en')],
localizationsDelegates: const [
PaymentLocalizations.delegate,
GlobalMaterialLocalizations.delegate,
GlobalWidgetsLocalizations.delegate,
GlobalCupertinoLocalizations.delegate,
],
builder: (context, child) {
final scale = textScale;
if (scale == null) return child!;
return MediaQuery(
data: MediaQuery.of(
context,
).copyWith(textScaler: TextScaler.linear(scale)),
child: child!,
);
},
home: AnnotatedRegion<SystemUiOverlayStyle>(
// D85: the host styles the system bars from its resolved theme.
value: (dark ? SystemUiOverlayStyle.light : SystemUiOverlayStyle.dark)
.copyWith(
systemNavigationBarColor: Colors.transparent,
systemNavigationBarDividerColor: Colors.transparent,
systemNavigationBarContrastEnforced: false,
),
child: Scaffold(
appBar: AppBar(
title: Text(title),
actions: [
PaymentIconButton(
icon: dark ? Icons.light_mode_outlined : Icons.dark_mode_outlined,
tooltip: dark ? 'Mode terang' : 'Mode gelap',
onPressed: onToggleDark,
),
if (scenarios.isNotEmpty)
PopupMenuButton<int>(
tooltip: 'Skenario demo',
onSelected: (i) => scenarios[i].onSelected(),
itemBuilder: (_) => [
for (final (i, s) in scenarios.indexed)
PopupMenuItem(value: i, child: Text(s.label)),
],
),
],
),
body: SafeArea(top: false, child: Builder(builder: body)),
),
),
);
}

Widget tests cover the exact account and amount, same-attempt status checks, elapsed deadlines, failed checks and a reachable action at 320 dp with 200% text. The demo does not connect to a bank. See Compatibility for device coverage.