lpe 0.0.3
lpe: ^0.0.3 copied to clipboard
Learmond Pay Element - Paysheet built in flutter. Transposable to any app framework.
example/main.dart
import 'package:flutter/material.dart';
import 'package:lpe/lpe.dart';
void main() => runApp(const MyApp());
class MyApp extends StatelessWidget {
const MyApp({super.key});
@override
Widget build(BuildContext context) {
return MaterialApp(
title: 'LPE Example',
home: const HomePage(),
);
}
}
class HomePage extends StatelessWidget {
const HomePage({super.key});
@override
Widget build(BuildContext context) {
return Scaffold(
appBar: AppBar(title: const Text('LPE Example')),
body: Center(
child: ElevatedButton(
child: const Text('Show Pay Sheet'),
onPressed: () async {
final result = await LearmondPaySheet.show(
context: context,
publishableKey: 'pk_test_...', // Replace with your key
clientSecret: 'pi_..._secret_...', // Replace with your secret
method: 'card',
title: 'Pay $10.00',
);
if (context.mounted) {
ScaffoldMessenger.of(context).showSnackBar(
SnackBar(
content: Text(result.success
? 'Payment succeeded!'
: 'Payment failed: ${result.error ?? 'Unknown error'}'),
),
);
}
},
),
),
);
}
}