twocheckout_flutter 0.0.1-dev.1 copy "twocheckout_flutter: ^0.0.1-dev.1" to clipboard
twocheckout_flutter: ^0.0.1-dev.1 copied to clipboard

A wrapper flutter plugin for implementation of 2checkout-android-sdk

2Checkout Flutter #

pub package license

The 2Checkout Flutter SDK wrapper for 2checkout-android-sdk allows you to build delightful payment experiences in your native Android (for iOS work is in progress). We provide powerful and customizable UI screens, widget, and method channels for native functions access that can be used out-of-the-box to collect your users' payment details.

Alt Text

Features #

  • Simplified Security: We make it simple for you to collect sensitive data such as credit card numbers and remain PCI compliant. This means the sensitive data is sent directly to 2Checkout (Now Verifone) instead of passing through your server. For more information, see our Integration Security Guide.
  • Payment methods: Accepting more payment methods helps your business expand its global reach and improve checkout conversion.
  • SCA-Ready: The SDK automatically performs native 3D Secure authentication if needed to comply with Strong Customer Authentication.
  • Native UI: We provide native screens and elements to securely collect payment details on Android and iOS.
  • Pre-built payments UI: Learn how to integrate Payment Sheet, the new pre-built payments UI for mobile apps. This pre-built UI lets you accept cards and Paypal out of the box.

If you're selling digital products or services within your app, (e.g. subscriptions, in-game currencies, game levels, access to premium content, or unlocking a full version), you must use the app store's in-app purchase APIs. See Apple's and Google's guidelines for more information. For all other scenarios you can use this SDK to process payments via 2checkout.

Installation #

To install the 2Checkout Flutter plugin, use the following Dart package command:

dart pub add twocheckout_flutter

Requirements #

Android Requirements #

To ensure proper functionality on Android devices, please make sure to follow these steps:

  1. Use Android 4.0 (API level 19) and above.
  2. Utilize Kotlin version 1.7.0 and above.
  3. Ensure you are using an up-to-date Android Gradle build tools version.
  4. Use an up-to-date Gradle version accordingly.
  5. Remember to rebuild the app after making the above changes, as these changes may not take effect with hot reload.

If you encounter difficulties while setting up the package on Android, join the discussion for support.

Usage #

Card Payments #

You can handle card payments using two methods: PayPal integration and Card Form.

Financial Connections #

The latest SDK also supports financial connections. Refer to the documentation to learn more about setting it up.

Dart API #

The library offers several methods for handling 2Checkout-related actions:

Callback to show a dialogue with title and detail.

void onShowDialogue(String title, String detail);

Callback to dismiss a displayed dialogue.

void onDismissDialogue();

Callback to show a loading spinner or progress bar.

void onShowProgressBar();

Callback to hide a loading spinner or progress bar (optional).

void onHideProgressBar();

Callback to show a payment confirmation screen.

void onShowPaymentDoneScreen();

Response Return from Api call

void onApiCallResponse();

Initialization of 2Checkout SDK #

_twoCheckoutFlutterPlugin.setTwoCheckoutCredentials(
"secretKey", "merchant_key");

Customization of native code on the Flutter side makes it easier for Flutter developers to perform actions such as displaying alert dialogues, dismissing/loading spinners, and navigating to customized pages. you just need to implement TwoCheckoutFlutterEvents class to override your required methods

  @override
void onHideProgressBar() {
  dismissProgressBar();
}

@override
void onShowDialogue(String title, String detail) {
  showMyDialog(title,detail);
}

@override
void onShowPaymentDoneScreen() {
  Navigator.push(
    context,
    MaterialPageRoute(
      builder: (BuildContext context) => const PaymentFlowDoneScreen(
        label: 'Customer label',
        amount: '10 USD',
        ref: 'ref',
      ),
    ),
  );
}

@override
void onShowProgressBar() {
  progressDialogue(context);
}

@override
void onDismissDialogue() {
  // TODO: implement onDismissDialogue
}

Running the Example App #

To run the example app, follow these steps:

  1. Navigate to the example folder: cd example.
  2. Install the dependencies: flutter pub get.
  3. Set up environment variables for the Flutter app and a local backend.
  4. Obtain your secret and Merchant key from the 2Checkout dashboard.
  5. Set the keys in the function called _twoCheckoutFlutterPlugin.setTwoCheckoutCredentials("secretKey", "merchant_key").

Here is the list of test cards on the official 2Checkout platform.

  1. Run Flutter: flutter run.

Contributing #

You can help us make this project better by contributing. Feel free to open a new issue or submit a pull request.

Author #

DevCrew I/O

Connect with Us:

devcrew.io mycompany DevCrew-io

5
likes
0
pub points
53%
popularity

Publisher

verified publisherdevcrew.io

A wrapper flutter plugin for implementation of 2checkout-android-sdk

Homepage
Repository (GitHub)
View/report issues

Documentation

Documentation

License

unknown (license)

Dependencies

flutter, plugin_platform_interface

More

Packages that depend on twocheckout_flutter