verifyCard method
Future<void>
verifyCard({
- required BuildContext context,
- required CardData card,
- required void onCardVerified(
- CardData input
- bool showCardVerifiedSheet = true,
- required PaymentRequest request,
Runs the "Proceed to Payment" flow: shows 3D Secure initiating sheet,
then OTP entry sheet. Call this from your payment gateway screen when
the user taps "Proceed to Payment".
When request is provided, the OTP sheet shows the order amount from
request.orderDetails instead of $0.00 (Verification).
Implementation
Future<void> verifyCard({
required BuildContext context,
required CardData card,
required void Function(CardData card) onCardVerified,
bool showCardVerifiedSheet = true,
required PaymentRequest request,
}) async {
if (!context.mounted) return;
showModalBottomSheet<void>(
context: context,
isDismissible: false,
enableDrag: false,
backgroundColor: Colors.transparent,
shape: PayorcSdkUiConstants.bottomSheetModalShape,
builder: (ctx) => const Initiating3DSecureSheet(),
);
await Future.delayed(const Duration(seconds: 3));
if (!context.mounted) return;
Navigator.of(context).pop();
if (!context.mounted) return;
final amountLabel = _amountLabelFromRequest(request);
showModalBottomSheet<void>(
context: context,
isScrollControlled: true,
backgroundColor: Colors.transparent,
shape: PayorcSdkUiConstants.bottomSheetModalShape,
builder: (ctx) => SecureOtpSheet(
cardLastFour: card.lastFourDigits,
onCardVerified: () => onCardVerified(card),
showCardVerifiedSheet: showCardVerifiedSheet,
amountLabel: amountLabel,
),
);
}