Stripe Android SDK

repository·master·Indexed 23 days ago

https://github.com/stripe/stripe-android

A set of tools for integrating secure, compliant, and localized payment experiences into Android applications. The SDK includes prebuilt UIs like PaymentSheet, low-level APIs for custom implementations, and specialized components such as the Crypto Onramp SDK (private preview), Financial Connections SDK (Beta) for linking financial accounts, and IdentityVerificationSheet for identity document collection. It also provides support for Google Pay integration and a modified hCaptcha SDK.

Tokens
18.3K
Snippets
40
Records
92
Agent score
81%

What's inside stripe-android

  1. Overview of Stripe Financial Connections Android SDK

    master

    The Stripe Financial Connections Android SDK (Beta) allows users to securely link external financial accounts to your business within an Android application.

    Key features include:

    • Prebuilt UI: Use FinancialConnectionsSheet to handle the entire user flow for linking accounts.
    • Data Access: Retrieve tokenized account/routing numbers for ACH verification, real-time balance data, account ownership information, and transaction history.
    • Use Cases: Facilitate instant bank account verification, fraud mitigation, expense tracking, and improved underwriting for credit services.
  2. Overview of Stripe Android SDK features

    master

    The Stripe Android SDK provides tools for building payment experiences in Android apps, ranging from high-level prebuilt UIs to low-level API access.

    Key Features

    • Native UI: Includes PaymentSheet, a prebuilt UI that handles the entire payment flow (collecting details and confirming payment) in a single sheet.
    • Simplified Security: Collects credit card numbers directly to Stripe, helping you maintain PCI compliance.
    • SCA-Ready: Automatically handles native 3D Secure authentication for Strong Customer Authentication (SCA) compliance in Europe.
    • Google Pay: Full compatibility with Google Pay.
    • Low-level APIs: Provides APIs that map to Stripe API objects and methods for building fully custom payment experiences.
    • Digital Goods Support: Supports processing payments for digital goods and services like subscriptions or in-app currency.
    • Localization: Supports a wide range of languages including English, Spanish, French, Chinese, Japanese, and many others.
  3. Overview of the Stripe hCaptcha SDK

    master
    The Stripe hCaptcha SDK is a modified version of the original hCaptcha Android SDK. It is specifically optimized for use within the Stripe Android SDK to ensure Stripe maintains direct control over the library, preventing lifecycle-related issues. Additionally, this version has been translated to Kotlin for better integration with modern Android development.
  4. Overview of Stripe Crypto Onramp Android SDK

    master

    The Stripe Crypto Onramp Android SDK allows you to build a headless crypto onramp flow within your Android application. It enables customers to securely purchase and exchange cryptocurrencies while giving your app control over the majority of the UI and navigation.

    An OnrampCoordinator manages the complex orchestration of the flow, including:

    • Link authentication
    • Know Your Customer (KYC) and identity verification
    • Payment method collection
    • Checkout handling
    IMPORTANT

    This SDK is currently in private preview. You must request access via the Stripe docs.

  5. Use IdentityVerificationSheet for identity verification

    master
    The IdentityVerificationSheet is a prebuilt UI component that provides a single, unified flow for collecting identity documents, selfies, and ID numbers. It displays as a sheet on top of your existing application. This component handles the secure collection of personally identifiable information (PII) and sends it directly to Stripe, ensuring sensitive data does not pass through your server.
  6. Features of the Crypto Onramp SDK

    master

    The SDK provides several key capabilities for managing a crypto onramp flow:

    Headless Coordinator

    Use OnrampCoordinator to orchestrate the flow with minimal Stripe-provided UI.

    • hasLinkAccount(email:): Check if an email has a Link account.
    • registerLinkUser(info:): Register new users.
    • authorize(linkAuthIntentId:): Authorize a Link auth intent.
    • authenticateUserWithToken(linkAuthTokenClientSecret:): Support seamless sign-in for returning users.

    KYC and Identity Verification

    • attachKycInfo(info:): Submit KYC information.
    • verifyKycInfo(updatedAddress:): Confirm KYC information.
    • verifyIdentity(): Present identification document verification.

    Wallets and Payment Methods

    • registerWalletAddress(walletAddress:network:): Register crypto wallet addresses.
    • collectPaymentMethod(type:): Collect payment methods via Link (card, bank account) or Apple Pay.
    • createCryptoPaymentToken(): Create crypto payment tokens.

    Checkout Handling

    • performCheckout(onrampSessionId:checkoutHandler:): Complete purchases for an onramp session.

    Theming

    Minimal Stripe-provided UI components can be customized using LinkAppearance to adjust colors, button properties, and light/dark interface styles.

  7. Compare Stripe Identity Native SDK vs. Web Redirect flows

    master

    The Stripe Identity Example App allows you to switch between two primary integration methods:

    1. Native Android SDK Flow

    Uses the IdentityVerificationSheet to provide a native Android experience. This flow requires the following parameters from your backend:

    • id: The ID of the VerificationSession.
    • ephemeral_key_secret: An ephemeral key secret used to authorize the native session.

    2. Web Redirect Flow

    Opens the url provided by the VerificationSession in a Custom Tab. The user completes the identity verification process within the browser environment.

  8. Install the Stripe WeChatPay module

    master

    To use WeChat Pay as a payment method for PaymentIntent, you must add the main Stripe Android SDK, the WeChatPay module, and the specific WeChat Pay SDK to your app/build.gradle file. Ensure that the Stripe dependencies use the same $stripe_sdk_version and that you use WeChat Pay SDK version 6.7.0.

    Note: This module uses reflection to invoke the WeChat Pay SDK, so you must declare the dependency even though you won't write direct code for it.

    dependencies {
      // Stripe dependencies, make sure they have the same $stripe_sdk_version
      implementation 'com.stripe:stripe-android:$stripe_sdk_version' // Main Stripe SDK
      implementation 'com.stripe:stripe-wechatpay:$stripe_sdk_version' // WeChat Pay module
      // WeChat Pay SDK, make sure 6.7.0 is used
      implementation 'com.tencent.mm.opensdk:wechat-sdk-android-without-mta:6.7.0'
    }
  9. Run the Stripe Identity Example App

    master

    To explore Stripe Identity integration, you can run the provided example application. This app demonstrates both the native Android SDK flow and the web redirect flow.

    Prerequisites

    Installation Steps

    1. Clone the stripe-android repository.
    2. Open the identity-example project in Android Studio.
    3. Build and run the project.