DocsChangelog
Getting Started

Usage

Initialize feda_flutter and start processing payments.

Initialization

Initialize FedaFlutter once at app startup (e.g. in main.dart):

main.dart
import 'package:feda_flutter/feda_flutter.dart';

void main() {
 FedaFlutter.applyConfig(
 apiKey: 'your_api_key',
 environment: ApiEnvironment.sandbox, // or .live
 );
 runApp(MyApp());
}

Creating a transaction

final repo = FedaFlutter.instance.transactions;

final res = await repo.createTransaction(TransactionCreate(
 description: 'Order #42',
 amount: 5000,
 currency: CurrencyIso(iso: 'XOF'),
 customer: CustomerCreate(
 firstname: 'John',
 lastname: 'Doe',
 email: 'john@example.com',
 phoneNumber: PhoneNumber(number: '97000000', country: 'BJ'),
 ),
));

if (res.data != null) {
 print('Transaction created: ${res.data!.id}');
}

Using PayWidget

PayWidget handles the full payment flow across all platforms (WebView on mobile, browser redirect with status polling on desktop):

PayWidget(
 transactionToken: 'ts_token_xxx',
 onPaymentSuccess: () => print('Payment successful!'),
 onPaymentFailed: () => print('Payment failed.'),
)
Use ApiEnvironment.sandbox during development and switch to .live for production.