paymaya_flutter 0.1.0 copy "paymaya_flutter: ^0.1.0" to clipboard
paymaya_flutter: ^0.1.0 copied to clipboard

discontinued

Unofficial PayMaya SDK for flutter. A mirror of https://github.com/PayMaya/PayMaya-JS-SDK-v2

paymaya_flutter #

Unofficial PayMaya SDK for Flutter.

BLOCKERS #

The plan for this package was to make it accessible to all platforms. But since PayMaya heavily relies on WebViews, The only possible way for this is to use WebView related packages such as webview_flutter, web_browser or Platform Channels.

Issues for WebView #

WEB

PayMaya does not allow iframes to be loaded becasue the X-FRAME-OPTIONS was set to deny. So the only solution is to make a redirect url that closes the window. that way, you will have control thru your own logic.

Example:

    /// returns payment link.
    final redirectUrl = await payMayaSDK.createCheckout(checkout);
    /// For Mobile:
    /// From the webview of your page. 
    final bool result = await Navigator.push(context, YourWebView());
    /// For Web:
    /// Opens a new window to process payment.
    if(await canLaunch(redirectUrl)){
        await launch(redirectUrl);
    }

Usage #

PayMayaSDK #

init()

Run this method first before invoking other methods.

final payMayaSDK = PayMayaSDK.init('pk-Mn124x69sda', isSandBox: true);

createCheckout

// inside of Future function
final checkout = PaymayaCheckout(
    totalAmount: PaymayaAmount(
        value: 700,
        currency: 'PHP', // Default currency
    ),
    items: [PaymayaItems(...)],
    redirectUrl: PaymayaRedirectUrls(
        success:'https://yourwebsite.com/success?id=65593',
        failure:'https://yourwebsite.com/failure?id=65593',
        cancel:'https://yourwebsite.com/cancel?id=65593',
    ),
    requestReferenceNumber: '512396',
);
  /// returns payment link.
  final redirectUrl = await payMayaSDK.createCheckout(checkout);

TODOS:

  • Webhooks. This is useful for flutter web to monitor the redirect callback url
  • Custom Widget without using WebViews
  • Wallet Link Widget
  • Instructions for newly registered PayMaya Managers
  • Support paymaya for non-flutter apps.
2
likes
110
pub points
21%
popularity

Publisher

unverified uploader

Unofficial PayMaya SDK for flutter. A mirror of https://github.com/PayMaya/PayMaya-JS-SDK-v2

Repository (GitHub)
View/report issues

Documentation

API reference

License

MIT (LICENSE)

Dependencies

flutter, flutter_web_plugins, http

More

Packages that depend on paymaya_flutter