All Projects → braintree → Braintree Android Drop In

braintree / Braintree Android Drop In

Licence: mit
Braintree Drop-In SDK for Android

Programming Languages

java
68154 projects - #9 most used programming language

Projects that are alternatives of or similar to Braintree Android Drop In

Braintree android
Braintree SDK for Android
Stars: ✭ 343 (+339.74%)
Mutual labels:  payments, braintree, sdk
Braintree node
Braintree Node.js library
Stars: ✭ 271 (+247.44%)
Mutual labels:  payments, braintree
In App Payments Flutter Plugin
Flutter Plugin for Square In-App Payments SDK
Stars: ✭ 256 (+228.21%)
Mutual labels:  payments, sdk
Braintree ruby
Braintree Ruby library
Stars: ✭ 407 (+421.79%)
Mutual labels:  payments, braintree
Hanzo.js
🚀 Hanzo JavaScript SDK. Develop cutting-edge decentralized applications.
Stars: ✭ 128 (+64.1%)
Mutual labels:  payments, sdk
Braintree java
Braintree Java library
Stars: ✭ 129 (+65.38%)
Mutual labels:  payments, braintree
Braintree Web
A suite of tools for integrating Braintree in the browser
Stars: ✭ 357 (+357.69%)
Mutual labels:  payments, braintree
Worldpay Within Sdk
Worldpay Within SDK to allow payments within IoT. Written in Go.
Stars: ✭ 12 (-84.62%)
Mutual labels:  payments, sdk
Bitgosdk Php
BitGo SDK written in PHP
Stars: ✭ 22 (-71.79%)
Mutual labels:  payments, sdk
Django Payments
Universal payment handling for Django.
Stars: ✭ 575 (+637.18%)
Mutual labels:  payments, braintree
Sdk Dotnet
.Net SDK for Authorize.Net API
Stars: ✭ 124 (+58.97%)
Mutual labels:  payments, sdk
Connect Java Sdk
Java client library for the Square Connect v2 API
Stars: ✭ 36 (-53.85%)
Mutual labels:  payments, sdk
Braintree dotnet
Braintree .NET library
Stars: ✭ 109 (+39.74%)
Mutual labels:  payments, braintree
Braintree python
Braintree Python library
Stars: ✭ 217 (+178.21%)
Mutual labels:  payments, braintree
Braintree php
Braintree PHP library
Stars: ✭ 491 (+529.49%)
Mutual labels:  payments, braintree
Checkout Sdk Node
Checkout.com SDK for Node.js. Documentation here:
Stars: ✭ 28 (-64.1%)
Mutual labels:  payments, sdk
Nestjs Braintree
A module for braintree reoccurring payments and transactions 💳
Stars: ✭ 62 (-20.51%)
Mutual labels:  payments, braintree
Streaming Ios
This repository contains a simple project with a number of iOS examples that can be used for testing and reference.
Stars: ✭ 74 (-5.13%)
Mutual labels:  sdk
Line Bot Sdk Python
LINE Messaging API SDK for Python
Stars: ✭ 1,198 (+1435.9%)
Mutual labels:  sdk
Unityrtc
基于webrtc的unity多人游戏实时语音(A Unity Demo for Impl Real-time Game Voice Among Mutiplayers Based On WEBRTC)
Stars: ✭ 74 (-5.13%)
Mutual labels:  sdk

Braintree Android Drop-In

Build Status

Braintree Android Drop-In is a readymade UI that allows you to accept card and alternative payments in your Android app.

Screenshot of Drop-In

Adding it to your project

Add the dependency in your build.gradle:

dependencies {
  implementation 'com.braintreepayments.api:drop-in:5.2.0'
}

To use the latest build from the master branch use:

dependencies {
  implementation 'com.braintreepayments.api:drop-in:5.2.1-SNAPSHOT'
}

Usage

Create a DropInRequest and use the Intent to start Drop-In:

DropInRequest dropInRequest = new DropInRequest()
    .clientToken(mClientToken);
startActivityForResult(dropInRequest.getIntent(context), DROP_IN_REQUEST);

Handle the response:

@Override
public void onActivityResult(int requestCode, int resultCode, Intent data) {
    super.onActivityResult(requestCode, resultCode, data);

    if (requestCode == DROP_IN_REQUEST) {
        if (resultCode == RESULT_OK) {
            DropInResult result = data.getParcelableExtra(DropInResult.EXTRA_DROP_IN_RESULT);
            String paymentMethodNonce = result.getPaymentMethodNonce().getNonce();
            // send paymentMethodNonce to your server
        } else if (resultCode == RESULT_CANCELED) {
            // canceled
        } else {
            // an error occurred, checked the returned exception
            Exception exception = (Exception) data.getSerializableExtra(DropInActivity.EXTRA_ERROR);
        }
    }
}

3D Secure + Drop-in

The new Drop-In supports 3D-Secure verification. Assuming you have 3D-Secure configured for your account, enable it in your client with DropInRequest.requestThreeDSecureVerification(true) and set an amount. Then, create a ThreeDSecureRequest() object, setting ThreeDSecurePostalAddress and ThreeDSecureAdditionalInformation fields where possible; the more fields that are set, the less likely a user will be presented with a challenge. For more information, check our 3D Secure Migration Guide. Make sure to attach this object to the BTDropInRequest before use.

ThreeDSecurePostalAddress billingAddress = new ThreeDSecurePostalAddress()
    .givenName("Jill")
    .surname("Doe")
    .phoneNumber("5551234567")
    .streetAddress("555 Smith St")
    .extendedAddress("#2")
    .locality("Chicago")
    .region("IL")
    .postalCode("12345")
    .countryCodeAlpha2("US");

ThreeDSecureRequest threeDSecureRequest = new ThreeDSecureRequest()
    .amount("1.00")
    .versionRequested(ThreeDSecureRequest.VERSION_2)
    .email("[email protected]")
    .mobilePhoneNumber("3125551234")
    .billingAddress(billingAddress)
    .additionalInformation(additionalInformation);


// Optional additional information.
// For best results, provide as many of these elements as possible.
ThreeDSecureAdditionalInformation additionalInformation = new ThreeDSecureAdditionalInformation()
    .accountId("account-id");

DropInRequest dropInRequest = new DropInRequest()
    .clientToken(mAuthorization)
    .requestThreeDSecureVerification(true)
    .threeDSecureRequest(threedSecureRequest);

Fetch last used payment method

If your user already has an existing payment method, you may not need to show Drop-In. You can check if they have an existing payment method using DropInResult#fetchDropInResult. Note that a payment method will only be returned when using a client token created with a customer_id.

DropInResult.fetchDropInResult(activity, clientToken, new DropInResult.DropInResultListener() {
    @Override
    public void onError(Exception exception) {
        // an error occurred
    }

    @Override
    public void onResult(DropInResult result) {
        if (result.getPaymentMethodType() != null) {
            // use the icon and name to show in your UI
            int icon = result.getPaymentMethodType().getDrawable();
            int name = result.getPaymentMethodType().getLocalizedName();

            if (result.getPaymentMethodType() == PaymentMethodType.GOOGLE_PAY) {
                // The last payment method the user used was GooglePayment. The GooglePayment
                // flow will need to be performed by the user again at the time of checkout
                // using GooglePayment#requestPayment(...). No PaymentMethodNonce will be
                // present in result.getPaymentMethodNonce(), this is only an indication that
                // the user last used GooglePayment.
            } else {
                // show the payment method in your UI and charge the user at the
                // time of checkout using the nonce: paymentMethod.getNonce()
                PaymentMethodNonce paymentMethod = result.getPaymentMethodNonce();
            }
        } else {
            // there was no existing payment method
        }
    }
});

Help

Feedback

Here are a few ways to get in touch:

License

Braintree Android Drop-In 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].