Accept payments in your Flutter app with ease by using Moyasar. With this SDK, you can quickly and safely accept payments through Apple Pay, Samsung Pay, STC Pay and Credit Card (with managed 3DS step).
Package selection guidance compiled from public package information, community data, and project usage.
Moyasar is a Flutter/Dart package that enables seamless and secure payment integration in mobile applications. It supports multiple payment methods including Apple Pay, Samsung Pay, STC Pay, and credit cards with built-in 3DS authentication. Designed for developers using Flutter, it simplifies the process of accepting payments across Android and iOS platforms. The SDK ensures compliance with security standards and provides a smooth checkout experience for users.
Use cases
In-app purchases
E-commerce apps
Subscription services
Digital service payments
Mobile wallet integrations
Key features
Support for Apple Pay and Samsung Pay
STC Pay integration
Credit card payments with 3DS
Cross-platform compatibility (Android & iOS)
Secure payment processing
Suitable for
Flutter developers building e-commerce apps
Businesses targeting Middle Eastern markets
Apps requiring multi-payment method support
Developers seeking quick payment integration
Considerations
Requires valid Moyasar account and API keys
Limited to supported payment methods
Dependent on external payment gateway stability
Original README
Original README snapshot from the linked source repository. Visit the repository for the latest content.
Moyasar Flutter SDK
Accept payments in your Flutter app through Apple Pay, Samsung Pay, STC Pay, and Credit Card — with the 3DS step handled for you.
Method
Platforms
Widget
Credit Card (with managed 3DS)
iOS, Android
CreditCard
Apple Pay
iOS
ApplePay
Samsung Pay
Android (Samsung devices)
SamsungPay
STC Pay
iOS, Android
STCPay
Every widget hides itself when its method isn't available on the device, so you can drop them all into one screen without platform checks.
Install
flutter pub add moyasar
Requires Flutter >=1.17.0, Dart >=2.18.2 <4.0.0, and iOS 12.0+.
You'll need a Moyasar account — get your API keys.
Samsung Android devices only. Add the spay_sdk_api_level meta-data to your AndroidManifest.xml — see the integration guide. The SDK bundles Samsung's official Flutter plugin, so no app-level override is needed.
The widget hides itself when Samsung Pay isn't ready. To check explicitly in a custom flow:
final eligible = awaitSamsungPayEligibility.isEligible(paymentConfig);
final result = awaitSamsungPayEligibility.check(paymentConfig); // with diagnosticsdebugPrint('${result.reason}'); // ready, notAndroid, notReady, sdkError, timeout...
Credit Card & STC Pay
Both render a full form and accept an optional locale. Localization.ar() also switches the layout to RTL; individual strings can be overridden through its named parameters.
Override the API host, e.g. https://apimig.moyasar.com.
applyCoupon
bool?
null
Set false to skip coupon application.
ApplePayConfig
Field
Type
Default
Description
merchantId
String
required
Must match Xcode and your dashboard.
label
String
required
Store name in the payment sheet.
manual
bool
required
Authorize now, capture later.
saveCard
bool
required
Tokenize for later charges.
merchantCapabilities
List<String>
["3DS", "debit", "credit"]
Must include "3DS".
supportedCountries
List<String>
["SA"]
Widening this raises fraud risk.
SamsungPayConfig
Field
Type
Default
Description
serviceId
String
required
From the Samsung merchant dashboard.
merchantName
String
required
Shown in the payment sheet.
orderNumber
String?
auto-generated
[A-Za-z0-9-], max 36 chars. Returned as samsungpay_order_id in the response metadata.
manual
bool
false
Authorize now, capture later.
CreditCardConfig
saveCard (bool, required) — tokenize after a successful payment.
manual (bool, required) — authorize now, capture later.
PaymentSplit
Divide a payment among recipients, in compliance with SAMA and ZATCA. Aggregation clients only — splits on other payments are ignored. The splits must total the payment amount.
With a custom Credit Card UI, 3DS is your responsibility: when status is initiated, open (result.source as CardPaymentResponseSource).transactionUrl in a web view and watch for the redirect to PaymentConfig.callbackUrl.
STC Pay takes two steps — start the payment, then verify the OTP:
final result = awaitMoyasar.pay(
apiKey: paymentConfig.publishableApiKey,
paymentRequest: PaymentRequest(paymentConfig, StcRequestSource(mobile: '0512345678')),
);
final transactionUrl = (result.source asStcResponseSource).transactionUrl!;
final verified = awaitMoyasar.verifyOTP(
transactionURL: transactionUrl,
otpRequest: OtpRequestSource(otpValue: '1234'),
);
Testing
Credit Card — test cards work against the sandbox.
Apple Pay — use a real device; the simulator can't complete an authorization. Test amounts.
Samsung Pay — requires a Samsung device. The example app uses flavors: flutter run --flavor default_ (Apple Pay) or --flavor spay (Samsung Pay). See example/CONFIGURATION_GUIDE.md.
Deprecations
STCPaymentComponent is deprecated and will be removed in the next major version — it's a drop-in rename to STCPay.