Stripe iOS SDK

repository·master·Indexed 25 days ago

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

A comprehensive suite of tools for integrating Stripe payments into iOS applications. It offers high-level prebuilt UI components like PaymentSheet for streamlined payment lifecycles, as well as low-level API bindings via the StripePayments module for custom implementations. The SDK includes specialized modules for Apple Pay, Identity verification, Financial Connections, and Connect, while ensuring PCI compliance and SCA-ready 3D Secure authentication.

Tokens
11.5K
Snippets
14
Records
83
Agent score
32%

What's inside stripe-ios

  1. Overview of Stripe Crypto Onramp iOS SDK

    master

    The StripeCryptoOnramp SDK allows developers to build a headless crypto onramp flow within an iOS application. It provides a CryptoOnrampCoordinator to orchestrate the entire process—including Link authentication, KYC (Know Your Customer) and identity verification, payment method collection, and checkout—while allowing the developer to maintain control over the application's UI and navigation.

    Note: This SDK is currently in private preview. Access must be requested via the Stripe documentation.

  2. What is StripePaymentSheet

    master
    PaymentSheet is a prebuilt, embeddable native UI component for iOS. It streamlines the payment process by combining several steps—collecting payment details, collecting billing details, and confirming the payment—into a single sheet that displays on top of your application. It supports over 10 different payment methods with a single integration.
  3. Overview of Stripe iOS SDK

    master

    The Stripe iOS SDK provides tools to build payment experiences in iOS applications. It offers two primary ways to integrate:

    1. Native UI Components: Prebuilt, customizable UI screens like PaymentSheet that handle the entire payment flow (collecting payment details, billing details, and confirmation) in a single sheet.
    2. Low-level APIs: The StripePayments module provides bindings for the Stripe Payments API, allowing developers to build fully custom UIs while using utilities like STPCardValidator for input validation.

    Key Features:

    • Simplified Security: Sensitive data is sent directly to Stripe, helping maintain PCI compliance.
    • Apple Pay: Seamless integration via the StripeApplePay module, including support for App Clips.
    • SCA-ready: Automatic native 3D Secure authentication for compliance with Strong Customer Authentication regulations.
    • Identity Verification: Use the StripeIdentity module to securely capture ID documents and selfies.
    • Localization: Supports a wide range of languages including English, Chinese, Spanish, French, Japanese, and many more.
  4. Supported Stripe Connect embedded components

    master

    The Stripe Connect iOS SDK provides embedded components that allow you to grant users access to Stripe products directly within your app. The following components are currently supported:

    • Account onboarding: Displays a localized onboarding form that performs data validation.
    • Payments: Allows users to view payment details and manage disputes.
    • Payouts: Displays payouts and enables users to perform payouts.
  5. What is PaymentSheet

    master

    PaymentSheet is a pre-built UI component that handles the entire payment lifecycle in a single sheet displayed on top of your application. It combines collecting payment information, gathering billing details, and confirming the payment.

    Key benefits include:

    • Support for 10+ payment methods.
    • Built-in card scanning.
    • Support for Light and Dark modes.
    • Helps maintain PCI compliance by handling sensitive data within the Stripe UI.
  6. Objective-C Control Flow and Syntax Best Practices

    master

    Follow these patterns for control flow to ensure readability and debuggability:

    • Braces: Always wrap conditional bodies with curly braces.
    • Else placement: Place else if and else on the same line as the preceding closing brace.
    • Returns: Each return statement must be on its own line. Do not use single-line returns like if (condition) return YES;.
    • Ternary Operators: Use sparingly and only for simple conditions.
    • Switch Statements: For enums, include an entry for every value and avoid using default.
    if (condition) {
        // A
    } else if (condition) {
        // B
    } else {
        // C
    }
  7. Check Stripe iOS SDK requirements and compatibility

    master

    The Stripe iOS SDK has the following platform requirements:

    • iOS: 15 or above (For support for iOS 13 and 14, use version 25.17.0).
    • macOS (Catalyst): macOS 12 or later.
    • Xcode: Supports all Apple-supported Xcode versions.
  8. Important Usage Note: Digital Products vs. Physical Goods

    master

    When choosing how to process payments, follow Apple's guidelines:

    • Digital Products/Services: If you are selling items consumed within the app (e.g., subscriptions, in-game currency, premium content), you must use Apple's in-app purchase APIs.
    • Other Scenarios: For all other scenarios (e.g., physical goods or services), you can use the Stripe iOS SDK to process payments.
  9. How iOSSnapshotTestCase works

    master
    A snapshot test case captures a configured UIView or CALayer using the renderInContext: method to create an image snapshot. It then compares this snapshot against a "reference image" stored in your repository. If the images do not match, the test fails, allowing you to visualize UI regressions through image diffs rather than just inspecting rectangle assertions.