All Projects → braintree → Android Card Form

braintree / Android Card Form

Licence: mit
A ready-made card form layout that can be included in your Android app, making it easy to accept credit and debit cards.

Programming Languages

java
68154 projects - #9 most used programming language

Projects that are alternatives of or similar to Android Card Form

Checkout Sdk Node
Checkout.com SDK for Node.js. Documentation here:
Stars: ✭ 28 (-90.97%)
Mutual labels:  payments, credit-card
Payment
💰 A jQuery-free general purpose library for building credit card forms, validating inputs and formatting numbers.
Stars: ✭ 467 (+50.65%)
Mutual labels:  payments, credit-card
Creditcardview
💳 CreditCardView is an Android library that allows developers to create the UI which replicates an actual Credit Card.
Stars: ✭ 744 (+140%)
Mutual labels:  view, credit-card
credit-card-view
A fully customizable Android view that can display credit card's informations
Stars: ✭ 25 (-91.94%)
Mutual labels:  view, credit-card
terms-dictionary
Simple definitions of terms, acronyms, abbreviations, companies, and projects related to financial services and Moov.
Stars: ✭ 48 (-84.52%)
Mutual labels:  credit-card, payments
Card
💳 make your credit card form better in one line of code
Stars: ✭ 11,365 (+3566.13%)
Mutual labels:  payments, credit-card
Braintree android
Braintree SDK for Android
Stars: ✭ 343 (+10.65%)
Mutual labels:  payments, credit-card
Offset
Offset payment engine
Stars: ✭ 152 (-50.97%)
Mutual labels:  payments, credit-card
creditcardnumber
Java library that can provide details of a bank issued credit card number
Stars: ✭ 43 (-86.13%)
Mutual labels:  credit-card, payments
card-validator
Card validation helpers for payment forms.
Stars: ✭ 22 (-92.9%)
Mutual labels:  credit-card, payments
Silver
Automated billing and payments for Django with a REST API
Stars: ✭ 265 (-14.52%)
Mutual labels:  payments
Shapeofview
Give a custom shape to any android view, Material Design 2 ready
Stars: ✭ 2,977 (+860.32%)
Mutual labels:  view
Rskcollectionviewretractablefirstitemlayout
A light-weight UICollectionViewFlowLayout subclass that allows the first item to be retractable.
Stars: ✭ 281 (-9.35%)
Mutual labels:  view
Uumarqueeview
[iOS]Customizable marquee view. #Marquee,MarqueeView,跑马灯,滚屏,上翻,左滑,多行,自定义
Stars: ✭ 295 (-4.84%)
Mutual labels:  view
Incrementproductview
Interesting concept of products incrementation
Stars: ✭ 262 (-15.48%)
Mutual labels:  view
Pagarme Php
💙 Pagar.me's PHP API
Stars: ✭ 276 (-10.97%)
Mutual labels:  payments
Uilibrary
平时项目开发中写的自定义Drawable、View和Shape
Stars: ✭ 260 (-16.13%)
Mutual labels:  view
In App Payments Flutter Plugin
Flutter Plugin for Square In-App Payments SDK
Stars: ✭ 256 (-17.42%)
Mutual labels:  payments
Creditcard.js
A simple credit cards validation library in JavaScript
Stars: ✭ 259 (-16.45%)
Mutual labels:  credit-card
Laravel Stripe Webhooks
Handle Stripe webhooks in a Laravel application
Stars: ✭ 300 (-3.23%)
Mutual labels:  payments

Card Form

Build Status

Card Form is a ready made card form layout that can be included in your app making it easy to accept credit and debit cards.

Adding It To Your Project

Add the dependency in your build.gradle:

dependencies {
    implementation 'com.braintreepayments:card-form:5.1.0'
}

Usage

Card Form is a LinearLayout that you can add to your layout:

<com.braintreepayments.cardform.view.CardForm
    android:id="@+id/card_form"
    android:layout_width="match_parent"
    android:layout_height="match_parent" />

To initialize the view and change which fields are required for the user to enter, use the required field methods and CardForm#setup(AppCompatActivity activity).

CardForm cardForm = (CardForm) findViewById(R.id.card_form);
cardForm.cardRequired(true)
        .expirationRequired(true)
        .cvvRequired(true)
        .cardholderName(CardForm.FIELD_REQUIRED)
        .postalCodeRequired(true)
        .mobileNumberRequired(true)
        .mobileNumberExplanation("SMS is required on this number")
        .actionLabel("Purchase")
        .setup(activity);

To access the values in the form, there are getters for each field:

cardForm.getCardNumber();
cardForm.getExpirationMonth();
cardForm.getExpirationYear();
cardForm.getCvv();
cardForm.getCardholderName();
cardForm.getPostalCode();
cardForm.getCountryCode();
cardForm.getMobileNumber();

To check if CardForm is valid call CardForm#isValid(). To validate each required field and show the user which fields are incorrect, call CardForm#validate().

To set custom error messages on a field call CardForm#setCardNumberError(String) on the given field.

Additionally CardForm has 4 available listeners:

  • CardForm#setOnCardFormValidListener called when the form changes state from valid to invalid or invalid to valid.
  • CardForm#setOnCardFormSubmitListener called when the form should be submitted.
  • CardForm#setOnFormFieldFocusedListener called when a field in the form is focused.
  • CardForm#setOnCardTypeChangedListener called when the CardType in the form changes.

Example

Styling

The card form uses the Android Design Support Library for styling and floating labels. All card form inputs use the colorAccent theme attribute, when present, to set their focused color. For more information on the colorAccent attribute, see Using the Material Theme. Additional styling, such as the error color (textErrorColor) can be set in your theme and will be picked up by the card form.

The included sample app has examples with a light theme and dark theme.

Note: Any Activity using the card form must use a style that is a Theme.AppCompat theme or descendant (defines android.support.v7.appcompat.R.attr.colorPrimary). This is a requirement of the Android Design Support Library. If this is a problem in your usage of the card form, please file an issue and we will look further into workarounds for this.

Releases

License

Card Form is open source and available under the MIT license. See the LICENSE file for more info.

Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].