kashier_flutter_sdk 0.1.0
kashier_flutter_sdk: ^0.1.0 copied to clipboard
Kashier payment SDK for Flutter. Accept Card, Apple Pay, and mobile wallet payments in Egypt with a prebuilt, localized (EN/AR) payment sheet.
Kashier Flutter SDK #
Accept Card, Apple Pay, and mobile wallet payments in Egypt with a prebuilt, localized (English/Arabic) payment sheet — all from a single API call.
Platform support: iOS and Android for Card and mobile wallet payments. Apple Pay is iOS-only and requires iOS 14.0+. Android apps should not add Apple Pay setup; Card and Wallet do not require it.
Installation #
Add the dependency to your pubspec.yaml:
dependencies:
kashier_flutter_sdk: ^0.1.0
For iOS apps, ensure your ios/Podfile targets at least iOS 14.0:
platform :ios, '14.0'
Setup #
Wrap your app with KashierPaymentProvider so the SDK can render its payment
sheet on its own overlay (works with any navigation solution):
void main() {
runApp(
KashierPaymentProvider(
child: MaterialApp(home: HomeScreen()),
),
);
}
Initialize the SDK once before starting any payment:
KashierSDK.initialize(
mode: KashierMode.test, // or KashierMode.live
language: KashierLanguage.en, // or KashierLanguage.ar
);
Quick start #
Your backend creates a payment session via Kashier's Payment Sessions API and hands the session ID to your app. The app passes only that session ID to the SDK — no API keys or card data ever live in the mobile binary.
KashierSDK.startPayment(
sessionId: 'sess_abc123', // from your backend
onSuccess: (KashierPaymentResult result) {
print('Paid: ${result.transactionId}');
},
onPending: (KashierPaymentPending pending) {
// Terminal: payment still settling — confirm via webhook/backend
print('Pending order: ${pending.orderId}');
},
onFailure: (KashierPaymentError error) {
if (error.code == KashierErrorCode.userCancelled) return;
print('Failed: ${error.message}');
},
);
The SDK fetches the session, shows the method-selection sheet (Apple Pay, Wallet, Card — whichever the session and device support), runs the chosen flow end-to-end (including 3DS WebViews and wallet reconcile polling), and fires exactly one callback when done.
Apple Pay #
Apple Pay is available only on iOS and requires setup in your Xcode project:
- Enable the Apple Pay capability (Signing & Capabilities → + Capability → Apple Pay).
- Add
merchant.com.kashier.paymentsto your app's entitlements file (com.apple.developer.in-app-payments), mirroringexample/ios/Runner/Runner.entitlements.
Kashier's Apple Pay merchant identifier is bundled inside the SDK, so you do
not register your own merchant ID or generate certificates — but your Apple
Developer team must be authorized to use Kashier's merchant ID
(merchant.com.kashier.payments). Contact the Kashier team to arrange this access.
Testing Apple Pay requires a physical iOS device; the Simulator reports
applePayNotAvailable.
Wallets and cards #
- Mobile wallets (Vodafone Cash and other Egyptian R2P wallets): the customer enters their phone number and approves the charge in their wallet app while the SDK polls for reconciliation.
- Cards: new card, saved cards, and 3-D Secure are handled inside the SDK's own sheet. Card data is tokenized directly against Kashier — it never touches your app, keeping you out of PCI scope.
Error handling #
All failures (including user cancellation) arrive via
onFailure(KashierPaymentError). Inspect error.code
(a KashierErrorCode) to decide how to respond — for example, suppress error
UI for userCancelled, and offer a retry for networkError or
paymentDeclined. Every error carries localized message (English) and
messageAr (Arabic) copy.
Test mode #
Initialize with KashierMode.test and create sessions against Kashier's test
API. Use the test card to exercise the card flow:
4508 7500 1574 1019
Documentation #
Full integration guide, API reference, and backend session setup: developers.kashier.io/flutter
License #
MIT — see LICENSE.