swervpay_widget 0.0.3 copy "swervpay_widget: ^0.0.3" to clipboard
swervpay_widget: ^0.0.3 copied to clipboard

Official Swervpay Widget for Flutter https://docs.swervpay.co/sdks/widget.

Flutter Widget for Swervpay

pub package License: MIT


Explore the docs »

X (Twitter) · Linkedin · Changelog

Installation #

$ flutter pub add swervpay_widget

Configuration #

Create a new instance of Swervpay with your secret_key and business_id:

import "package:swervpay_widget/swervpay_widget.dart";

Navigator.of(context).push(
    CupertinoPageRoute(
        builder: (c) => SwervpayView(
            sandbox: true,
            publicKey: const String.fromEnvironment('SWERV_PUBLIC_KEY', defaultValue: 'pk_dev_123'),
            businessId: const String.fromEnvironment('SWERV_BUSINESS_ID', defaultValue: 'bsn_123'),
            //checkoutId: 'hbnbbbbbb',
            data: SwervpayCheckoutDataModel(
                reference: DateTime.now().toString(),
                amount: 10000,
                description: 'description',
                currency: 'NGN',
            ),
            onSuccess: (response) {
                print(response);
            },
            onClose: () => print('closed'),
            onLoad: () => print('loaded'),
        ),
    ),
);


// OR

await SwervpayWidget.launchWidget(
    context,
    sandbox: true,
    key: const String.fromEnvironment('SWERV_PUBLIC_KEY', defaultValue: 'pk_dev_123'),
    businessId: const String.fromEnvironment('SWERV_BUSINESS_ID', defaultValue: 'bsn_123'),
    //checkoutId: 'hbnbbbbbb',
    data: SwervpayCheckoutDataModel(
        reference: DateTime.now().toString(),
        amount: 100,
        description: 'description',
        currency: 'NGN',
    ),
    onSuccess: (response) {
        print(response);
    },
    onClose: () => print('closed'),
    onLoad: () => print('loaded'),
);

Replace <SWERV_PUBLIC_KEY> and <SWERV_BUSINESS_ID> with your actual secret key and business ID.

Documentation #

See docs for widget here

2
likes
150
pub points
25%
popularity

Publisher

verified publishermujhtech.xyz

Official Swervpay Widget for Flutter https://docs.swervpay.co/sdks/widget.

Homepage
Repository (GitHub)
View/report issues

Documentation

Documentation
API reference

License

MIT (license)

Dependencies

flutter, webview_flutter

More

Packages that depend on swervpay_widget