Skip to main content

libyan_payments_for_mypay 1.0.2 copy "libyan_payments_for_mypay: ^1.0.2" to clipboard
libyan_payments_for_mypay: ^1.0.2 copied to clipboard

Libyan Payments for MyPay — native in-app Flutter checkout (OTP, Masrafi/Yasr/Sahara Pay, banking card). Session credentials only; never embed client secrets.

Libyan Payments for MyPay (libyan_payments_for_mypay) #

MyPay

Native in-app MyPay checkout for Flutter (iOS / Android). Your merchant backend holds API secrets; the app only receives a checkout session.

Requirements #

  • Flutter >=3.24.0 and Dart ^3.10.0
  • Android: host Activity should be a FlutterFragmentActivity
  • iOS: deployment target 15.0+
  • A MyPay merchant account with API credentials and a server you control for Pay API calls

Security #

  • Never put client_id, secret_id, or webhook secrets in the app or this package.
  • Your merchant backend calls Pay API v1 (authentication/token, payment/create, POST /checkout/sessions) and returns only session_id + session_token to the app.
  • After the session is open, device calls use X-MyPay-Session-Token only (no payment access token on device).
  • UI success is not fulfillment authority — confirm with signed webhooks (X-MyPay-Signature).

Backend (short) #

For each order on your server:

  1. POST /authentication/token
  2. POST /payment/create
  3. POST /checkout/sessions with { "payment_token": "...", "mode": "native" }
  4. Return only session_id and session_token to the Flutter app

Full API details: Payments (Native Checkout) · Merchant guide: Flutter Package

Install #

dependencies:
  libyan_payments_for_mypay: ^1.0.2
import 'package:libyan_payments_for_mypay/libyan_payments_for_mypay.dart';

Example #

A merchant demo app lives in example/. Paste session_id / session_token from your backend, pick a gateway alias, and call themed checkout:

cd example
flutter pub get
flutter run

See example/README.md.

Payment methods #

Gateways available through Native Checkout (alias in parentheses):

Banking card SADAD Edfali Mobicash Masrafi Pay Yasr Pay Sahara Pay

Alias Method
moamalat Banking card
sadad SADAD
edfali Edfali
mobicash Mobicash
masrafi-pay Masrafi Pay
yasr-pay Yasr Pay
sahary-pay Sahara Pay

Your app passes the chosen alias as gatewayAlias (the package does not show a gateway picker).

Themed UI #

Your app chooses gatewayAlias (there is no in-package gateway picker):

final result = await MyPayCheckout.present(
  context: context,
  sessionId: session.sessionId,
  sessionToken: session.sessionToken,
  environment: MyPayEnvironment.sandbox,
  gatewayAlias: 'sadad',
  locale: const Locale('ar'),
  theme: const MyPayCheckoutTheme(
    primaryColor: Color(0xFF0B6E4F),
    showMyPayBadge: true, // package MyPay mark + “Powered by MyPay”
  ),
);

if (result.isSuccess) {
  await merchantApi.refreshOrder(orderId); // still confirm via webhook
}

Headless client #

final client = MyPayCheckoutClient(
  sessionId: session.sessionId,
  sessionToken: session.sessionToken,
  environment: MyPayEnvironment.production,
);

final gateways = await client.listGateways();
await client.selectGateway('sadad');
await client.start(mobile: '0912345678', birthYear: '1990');
await client.confirmOtp('1234');

Banking card (gateway alias moamalat): always use payWithMoamalatSdk (or the themed UI). The package shows a native card form and completes the banking-card steps through the MyPay session. Do not build a custom form that posts card data (PAN/CVV) to your API or to MyPay. 3DS uses an in-app WebView only when required.

Branding in this package #

  • MyPay mark: bundled; shown when showMyPayBadge: true.
  • Gateway marks: bundled and shown for the selected gatewayAlias.
  • Keep your merchant brand in your own app UI. Do not copy these assets into the host app unless you build a fully custom (headless) UI.

Platform notes #

  • Android host should use FlutterFragmentActivity.
  • iOS deployment target 15.0+.
  • Banking card entry uses the package Flutter form (works on iOS Simulator).
  • Masrafi Pay, Yasr Pay, and Sahara Pay (masrafi-pay, yasr-pay, sahary-pay) themed UI uses identity / purchase-code entry only (no in-app QR camera).

Sandbox #

  • Banking card end-to-end checklist: doc/SANDBOX_MOAMALAT.md
  • Sandbox cards and OTP: Test Data

Docs #

License #

MIT — see LICENSE.

5
likes
0
points
1.04k
downloads

Documentation

Documentation

Publisher

verified publishermypay.ly

Weekly Downloads

Libyan Payments for MyPay — native in-app Flutter checkout (OTP, Masrafi/Yasr/Sahara Pay, banking card). Session credentials only; never embed client secrets.

Homepage

Topics

#payment #mypay #libya #checkout #flutter

License

unknown (license)

Dependencies

flutter, flutter_inappwebview, http, pin_code_fields, plugin_platform_interface, url_launcher

More

Packages that depend on libyan_payments_for_mypay

Packages that implement libyan_payments_for_mypay