Deposits One Click Checkout SDK

pub package

The Deposits One-Click Checkout SDK allows allows merchants to quickly enroll, onboard, and checkout customers. We provide powerful and customizable UI screens that can be used out-of-the-box to collect payments from your users with or without a deposit account

deposits-one-click-checkout-flutter_cover

Features

Simplified Security: We make it simple for you to collect sensitive data such as credit card numbers, ACH details and remain PCI compliant. This means the sensitive data is sent directly to Deposits instead of passing through your server.

Payment methods: Accepting card and ACH payments helps your business expand its global reach and improve checkout conversion.

Native UI: We provide native screens and elements to securely collect payment details on Android and iOS.

Installation

pubspec.yaml :


dependencies:

flutter:

sdk: flutter

deposits_oneclick_checkout: <Latest version>

Terminal :


flutter pub add deposits_one_click_checkout

Requirements

Android

This plugin requires several changes to be able to work on Android devices. Please make sure you follow all these steps:

  1. Use Android 5.0 (API level 21) and above

  2. Rebuild the app, as the above changes don't update with hot reload

iOS

Compatible with apps targeting iOS 10 or above.

Web

We do not support the web via this plugin for now you can use our JS SDK instead, you can check an example of how to use the JS SDK here

Usage

The library provides a UI componet for accepting card payments.

Example


// main.dart(import this)

import  'package:deposits_oneclick_checkout/app/modules/deposits_oneclick_checkout_button.dart';

  
  

void  main() async {

WidgetsFlutterBinding.ensureInitialized();

runApp(PaymentScreen());

}

  

// payment_screen.dart

class  PaymentScreen  extends  StatelessWidget {

  

@override

Widget  build(BuildContext context) {

return  Scaffold(

appBar: AppBar(),

body: Column(

crossAxisAlignment: CrossAxisAlignment.start,

mainAxisAlignment: MainAxisAlignment.center,

children: <Widget>[

const  Text(

'Fill the form below.',

),

Container(

child: TextFormField(

readOnly: isEmailExist,

controller: userEmailController,

validator: (val) {

if (val == null || val.trim().isEmpty) {

return  'Please enter your email address';

}

// Check if the entered email has the right format

if (!RegExp(r'\S+@\S+\.\S+').hasMatch(val)) {

return  'Please enter a valid email address';

}

// Return null if the entered email is valid

return  null;

},

keyboardType: TextInputType.emailAddress,

textInputAction: TextInputAction.next,

decoration: const  InputDecoration(

hintText: "Enter Email",

border: OutlineInputBorder(),

enabledBorder: OutlineInputBorder(

borderSide: BorderSide(color: Color(0xFFC0C4C9)),

),

disabledBorder: OutlineInputBorder(

borderSide: BorderSide(color: Color(0xFFC0C4C9)),

),

focusedBorder: OutlineInputBorder(

borderSide: BorderSide(color: Color(0xFFC0C4C9)),

),

),

),

margin: const  EdgeInsets.only(

top: (30.0)

)

),

Container(

child: TextFormField(

validator: (val) => val!.isEmpty ? 'Amount is required!' : null,

keyboardType: const  TextInputType.numberWithOptions(decimal: true),

inputFormatters: [

CurrencyTextInputFormatter(

decimalDigits: 2,

symbol: '\$ ',

)

],

textInputAction: TextInputAction.done,

controller: amountController,

decoration: const  InputDecoration(

hintText: "Enter Amount",

border: OutlineInputBorder(),

enabledBorder: OutlineInputBorder(

borderSide: BorderSide(color: Color(0xFFC0C4C9)),

),

disabledBorder: OutlineInputBorder(

borderSide: BorderSide(color: Color(0xFFC0C4C9)),

),

focusedBorder: OutlineInputBorder(

borderSide: BorderSide(color: Color(0xFFC0C4C9)),

),

),

),

margin: const  EdgeInsets.only(top: (10.0))

),

Container(

child: FlatButton(

minWidth: MediaQuery.of(context).size.width,

height: 56,

color: Colors.blue, //Color(0xFF0DB9E9),

child: const  Text(

'Checkout',

style: TextStyle(color: Colors.white, fontSize: 16)

),

onPressed: () async {

if (formKey.currentState!.validate()) {

depositsCheckout(

context,

ButtonConfig(
buttonColor: '0xFF0DB9E9'.
textColor: Colors.white,

amount: double.parse(amountController.text.toString()

.replaceAll('\$', '')

.toString()),

),

initialScreen: MyHomePage(

title: 'One Click-Checkout Demo',

),

userEmail: userEmailController.text.toString(),

subClientApiKey: 'money-by-deposits-user',

envMode: true,

chargeFundsResponse: (response) {

// manage process after the transaction is completed

},

);

}

},

),

margin: const  EdgeInsets.only(top: (30.0))

)

],

)

);

}

}

Deposit One Click Checkout SDK initialization

To initialize Deposit One Click Checkout SDK in your Flutter app, use the pay base class.

pay offers context, buttonConfig, initialScreen, envMode, chargeFundsResponse and userEmail, subClientApiKey. Only userEmail, subClientApiKey, envMode, chargeFundsResponse and buttonConfig (which has the following params : amount required,buttonColor required hexadecimal string , textStyle, height, minwidth , etc as customizable widgets ) is required. envMode is either true or false as a bool and chargeFundsResponse is a callback function to manage or run other processes after payment has been made abd you can check if it was successful or not. You have to change your subClientApiKey as the envMode changes and you can get the Key from the test or live console and the URL to the console is listed in the next section

Dart API

deposits

The library offers several methods to handle deposits checkout related actions:


void  depositsCheckout();

class  ButtonConfig()

The example app offers examples on how to use these methods.

Run the example app

  • Navigate to the example folder cd example

  • Install the dependencies

  • flutter pub get

  • Set up env vars for the flutter app and a local backend.

  • Get your test API keys

  • Get your live API keys

  • Start the example

  • Terminal 1: flutter run

Contributing

Only members of the deposits team can contribute to this. You can create an issue if you find a bug or have any challenge using this SDK.

Libraries

app/modules/address/add_address/add_address
app/modules/address/add_address/add_address_binding
app/modules/address/add_address/add_address_controller
app/modules/payment/add_bank/add_bank
app/modules/payment/add_bank/add_bank_binding
app/modules/payment/add_bank/add_bank_controller
app/model/add_bank/add_bank_response
app/modules/payment/add_new_card/add_new_card
app/modules/payment/add_new_card/add_new_card_binding
app/modules/payment/add_new_card/add_new_card_controller
app/modules/address/address/address
app/modules/address/address/address_binding
app/modules/address/address/address_controller
app/model/all_accounts/all_accounts_response
app/common/values/app_colors
app/common/values/app_images
app/common/values/app_spacing
app/common/values/app_text_style
app/model/auth_user/auth_user_response
app/model/get_funding_source/bank_account
app/model/get_funding_source/card
app/common/utils/card_input_formatter
app/model/charge_funds_source/charge_funds_response
app/model/countries_selection_model/city_model
app/modules/confirm_otp/confirm_otp
app/modules/confirm_otp/confirm_otp_binding
app/modules/confirm_otp/confirm_otp_controller
app/common/values/constants
app/model/countries_selection_model/country_model
app/model/mailing_address/create_address_response
app/widgets/custom_appbar_widget
app/widgets/custom_back_button
app/widgets/custom_close_button
app/widgets/custom_country_state_picker
app/widgets/custom_dropdown_textfield
app/widgets/custom_elevated_button
app/widgets/custom_horizontal_line
app/widgets/custom_image_loader
app/widgets/custom_inkwell_widget
app/widgets/custom_internet_retry
app/widgets/custom_listtile_widget
app/widgets/custom_rich_text_widget
app/widgets/custom_row_text_widget
app/widgets/custom_svg_image_loader
app/widgets/custom_text
app/widgets/custom_text_button
app/widgets/custom_text_field_widget
app/widgets/custom_text_tag
app/model/mailing_address/delete_address_response
app/model/charge_funds_source/delete_funds_response
deposits_oneclick_checkout_button
app/modules/deposits_oneclick_checkout_button
app/common/global/deposits_oneclick_checkout_controller
app/common/values/dimens
app/services/dio_client
app/modules/address/edit_address/edit_address
app/modules/address/edit_address/edit_address_binding
app/modules/address/edit_address/edit_address_controller
app/modules/user_profile/edit_profile/edit_profile
app/modules/user_profile/edit_profile/edit_profile_binding
app/modules/user_profile/edit_profile/edit_profile_controller
app/common/utils/exports
app/common/utils/extensions
app/services/fingerprintjs
app/model/mailing_address/get_address_response
app/model/get_funding_source/get_funding_response
app/model/mailing_address/get_single_address_response
app/model/get_funding_source/issuer
app/modules/linked/linked/linked
app/modules/linked/linked/linked_binding
app/modules/linked/linked/linked_controller
app/modules/linked/linked_details/linked_details
app/modules/linked/linked_details/linked_details_binding
app/modules/linked/linked_details/linked_details_controller
app/model/linked/linked_response
app/services/logging
app/modules/login/login
app/modules/login/login_binding
app/modules/login/login_controller
app/modules/manage_deposit_id/manage_deposit_id
app/modules/manage_deposit_id/manage_deposit_id_binding
app/modules/manage_deposit_id/manage_deposit_id_controller
app/model/me/me_response
app/model/get_funding_source/meta_data_json
app/common/utils/number_formatter
app/modules/pay_with_bank_card/pay_with_bank_card
app/modules/pay_with_bank_card/pay_with_bank_card_binding
app/modules/pay_with_bank_card/pay_with_bank_card_controller
app/modules/pay_with_card/pay_with_card
app/modules/pay_with_card/pay_with_card_binding
app/modules/pay_with_card/pay_with_card_controller
app/modules/payment/payment/payment
app/modules/payment/payment/payment_binding
app/common/utils/payment_card
app/modules/payment/payment/payment_controller
app/modules/google_search/place_service
app/modules/google_search/places_response
app/modules/user_profile/profile/profile
app/modules/user_profile/profile/profile_binding
app/modules/user_profile/profile/profile_controller
app/model/resend_otp/resend_otp
app/model/linked/revoke_access_response
app/model/mailing_address/set_default_address_response
app/model/countries_selection_model/state_model
app/common/storage/storage
app/common/values/strings
app/modules/successful/successful
app/modules/successful/successful_controller
app/common/values/theme
app/model/tokenize_card/tokenise_card
app/model/mailing_address/update_address_response
app/model/update_profile/update_profile_response
app/common/utils/utils
app/common/utils/validators
app/model/verify_user/verify_user_response