checkout_ui_sdk 0.1.2
checkout_ui_sdk: ^0.1.2 copied to clipboard
A Flutter checkout UI SDK that initiates payment sessions and returns a redirect URL for web-based payment flows. Designed for merchant apps to collect required payment details and hand off securely t [...]
How to Use 1️⃣ Import the SDK import 'package:checkout_ui_sdk/checkout_page.dart';
2️⃣ Open Checkout Page
Use CheckoutPage anywhere in your Flutter app:
Navigator.push( context, MaterialPageRoute( builder: (_) => CheckoutPage( paymentSessionUrl: 'https://api.example.com/payment/session', headers: { 'Content-Type': 'application/x-www-form-urlencoded', 'Authorization': 'Bearer YOUR_AUTH_TOKEN', }, onRedirect: (redirectUrl) { // Handle redirect URL // Example: open in WebView or browser print('Redirect to checkout: $redirectUrl'); }, ), ), );
3️⃣ What the SDK Handles Internally
The SDK automatically handles:
Order ID generation
Hash (ha) generation
Merchant token (mac)
Callback URL (murl)
Currency (hardcoded)
These fields are not shown in the UI and are securely handled inside the SDK.
4️⃣ Fields Shown in UI
The checkout screen collects the following mandatory fields:
Terminal Number
Order ID (read-only, auto-generated)
Amount
Currency (read-only)
Customer Name
Mobile Number
Email Address
5️⃣ Web-Based Checkout
This SDK does not embed a WebView.
Once the payment session is created, the SDK returns a redirect URL via the onRedirect callback. The host app is responsible for:
Opening the URL in a WebView
OR launching it in the browser
OR handling it using any custom navigation logic
This design keeps the SDK lightweight and flexible.
Example WebView Handling onRedirect: (url) { Navigator.push( context, MaterialPageRoute( builder: (_) => WebViewPage(url: url), ), ); }