Wompi Web Checkout
A Dart package that provides a seamless integration with Wompi's web checkout system, allowing you to easily implement payment processing in your Flutter applications.
- 🔒 Secure payment processing with Wompi
- 🛠️ Simple Dart API
Getting Started
Prerequisites
- Dart SDK (>=2.17.0)
Installation
Add the package to your pubspec.yaml
:
dependencies:
wompi_web_checkout: ^<latest_version>
Then run:
dart pub get
// or
flutter pub get
Usage
-
Import the package:
import 'package:wompi_web_checkout/wompi_web_checkout.dart';
-
Initialize the Wompi controller with your keys:
final wompiCheckout = WompiWebCheckout( publicKey: '<YOUR_PUBLIC_KEY>', integrityKey: '<YOUR_INTEGRITY_KEY>', );
-
Create a payment with basic data:
final paymentData = WompiWebCheckoutData( amountInCents: 10000000, reference: 'unique_reference', redirectUrl: 'https://your-domain.com/redirect', );
-
Add customer information (optional):
final paymentData = WompiWebCheckoutData( // ... basic payment data customerInfo: WompiWebCheckoutCustomerInfo( email: 'customer@example.com', fullName: 'John Doe', phoneNumber: '3991111111', legalId: '1234567890', legalIdType: WompiLegalId.cc, ), );
-
Add shipping information (optional):
final paymentData = WompiWebCheckoutData( // ... basic payment data // ... customer info shippingAddressInfo: WompiWebCheckoutShippingAddressInfo( addressLine1: 'Calle 100 # 100-100', country: 'CO', region: 'Antioquia', city: 'Medellín', postalCode: '100001', phoneNumber: '3991111111', name: 'John Doe', addressLine2: 'Apt 1', ), );
-
Process the payment:
try { final url = await wompiCheckout.getCheckoutUri(paymentData); // Use the URL to redirect the user to the Wompi web checkout page print('Checkout URL: $url'); } on WompiException catch (err) { // Handle Wompi exceptions } catch (err) { // Handle other exceptions }
Additional Information
You can see the example app in the /example
folder.
For more detailed information about the Wompi Web Checkout, please refer to the official documentation.
Contributing
Contributions are welcome! Please feel free to submit a Pull Request.
Issues
If you encounter any issues or have suggestions for improvements, please open an issue.
License
This project is licensed under the MIT License - see the LICENSE file for details.