finmont_checkout 0.1.0
finmont_checkout: ^0.1.0 copied to clipboard
Flutter SDK for FinMont payment orchestration — headless core and prebuilt UI supporting cards, wallets, bank redirects, APMs, 3DS, and split payments.
FinMont Checkout Flutter SDK #
A standalone Flutter SDK for integrating FinMont payment orchestration into Flutter applications.
The SDK provides a headless payment client with optional prebuilt UI components, 3D Secure authentication, alternative payment methods, digital wallets, and multi-party split payment capabilities.
The SDK is designed around consistent payment concepts and models, including PaymentIntent, PaymentMethod, CheckoutResult, and CheckoutError, with a structured error-handling and payment-processing architecture.
Features #
-
Multi-Environment Support Seamlessly switch between
FinmontEnvironment.dev,FinmontEnvironment.staging, andFinmontEnvironment.productionwith automatic API URL resolution. -
Card Payments Client-side card capture, card brand detection, Luhn checksum validation, and secure card tokenization through the FinMont Tokenizer API.
-
3D Secure (3DS) Automatic 3DS challenge detection, full-screen Flutter WebView presentation, return URL callback interception, and secondary authorization handling.
-
Multi-Party Split Payments Process payments across multiple cards or payment legs with session caching using
cacheReference, live progress streams, and partial failure handling. -
Alternative Payment Methods (APMs) Support for payment methods including SEPA Direct Debit, iDEAL, SOFORT, Bancontact, Klarna, PayPal, Crypto, Vouchers, and UATP airline cards.
-
Digital Wallets Native platform integration for Apple Pay and Google Pay.
-
Prebuilt UI Widgets Optional customizable UI components including
CardFormField,PaymentMethodSelector,SplitBreakdownView,CheckoutResultView, andAddressForm. -
Merchant Branding UI components can be configured using merchant branding and checkout settings.
-
Headless Payment Processing Use the core payment client independently from the provided UI components for fully custom checkout experiences.
-
Secure Card Handling Card information is tokenized through the FinMont Tokenizer API and is not persisted by the SDK.
Getting Started #
Installation #
Add finmont_checkout to your pubspec.yaml:
dependencies:
finmont_checkout:
git:
url: https://github.com/Finmont-India/finmont_checkout.git
If the package is published on pub.flutter-io.cn, you can use:
dependencies:
finmont_checkout: ^0.1.0
Then run:
flutter pub get
Quick Start #
Initialize FinmontCheckout with your FinMont API authentication token:
import 'package:finmont_checkout/finmont_checkout.dart';
final checkout = FinmontCheckout(
apiKey: 'your_api_jwt_bearer_token',
environment: FinmontEnvironment.dev,
);
Usage Examples #
1. Simple Card Checkout #
Create a payment intent and process a card payment:
final intent = PaymentIntent(
amount: const Amount(
currency: 'EUR',
value: 4999,
), // €49.99 in minor units
order: const Order(
reference: 'ORD-1001',
),
shopper: const Shopper(
name: 'Jane Doe',
email: 'jane@example.com',
),
);
final card = const CardDetails(
number: '4111111111111111',
expiryMonth: '12',
expiryYear: '28',
cvc: '123',
holderName: 'Jane Doe',
);
// Process payment.
// The SDK tokenizes the card and submits the payment
// through the FinMont payment orchestration layer.
final authorized = await checkout.processCardPayment(
intent: intent,
card: card,
);
// Handle 3DS if required.
if (authorized.is3D) {
final threeDSResult = await ThreeDSWebView.show(
context,
challengeUrl: authorized.response3Ds!.url!,
receiptReference: authorized.receiptReference!,
);
if (threeDSResult != null && threeDSResult.isSuccess) {
final finalResult = await checkout.confirmThreeDS(
receiptReference: authorized.receiptReference!,
previousIntent: authorized,
);
print('Payment confirmed: ${finalResult.receiptReference}');
}
} else {
print('Payment authorized: ${authorized.receiptReference}');
}
2. Using the Prebuilt Card Form Widget #
The SDK provides a customizable card form for collecting and validating card information:
final cardFormKey = GlobalKey<CardFormFieldState>();
CardFormField(
key: cardFormKey,
currency: 'EUR',
onCardChanged: (cardDetails) {
print('Card valid: ${cardDetails?.last4}');
},
);
ElevatedButton(
onPressed: () {
if (cardFormKey.currentState?.validate() ?? false) {
final card = cardFormKey.currentState!.getCardDetails()!;
// Execute payment...