Swiftpack.co - Package - stripe/stripe-ios

Stripe iOS SDK

Travis CocoaPods Carthage compatible License Platform

The Stripe iOS SDK makes it quick and easy to build an excellent payment experience in your iOS app. We provide powerful and customizable UI screens and elements that can be used out-of-the-box to collect your users' payment details. We also expose the low-level APIs that power those UIs so that you can build fully custom experiences.

Get started with our 📚 integration guides and example projects, or 📘 browse the SDK reference.

Updating to a newer version of the SDK? See our migration guide and changelog.

Table of contents

Features

Simplified Security: We make it simple for you to collect sensitive data such as credit card numbers and remain PCI compliant. This means the sensitive data is sent directly to Stripe instead of passing through your server. For more information, see our Integration Security Guide.

Apple Pay: We provide a seamless integration with Apple Pay.

SCA-Ready: The SDK automatically performs native 3D Secure authentication if needed to comply with Strong Customer Authentication regulation in Europe.

Stripe API: We provide low-level APIs that correspond to objects and methods in the Stripe API. You can build your own entirely custom UI on top of this layer, while still taking advantage of utilities like STPCardValidator to validate your user’s input.

Native UI: We provide native screens and elements to collect payment and shipping details. For example, STPPaymentCardTextField is a UIView that collects and validates card details:

You can use these individually, or take all of the prebuilt UI in one flow by following the Basic Integration guide.

From left to right: STPAddCardViewController, STPPaymentOptionsViewController, STPShippingAddressViewController

Card scanning: We support card scanning on iOS 13 and higher. See our Card scanning section.

Releases

We support Cocoapods and Swift Package Manager. If you link the library manually, use a version from our releases page.

If you're reading this on GitHub.com, please make sure you are looking at the tagged version that corresponds to the release you have installed. Otherwise, the instructions and example code may be mismatched with your copy. You can read the latest tagged version of this README and browse the associated code on GitHub using this link.

Requirements

The Stripe iOS SDK requires Xcode 12.2 or later and is compatible with apps targeting iOS 11 or above. We support Catalyst on macOS 10.15 or later.

If you need to compile your app using Xcode 11.7, please use v20.1.1. For iOS 10 support, please use v19.4.0. If you need to support iOS 9, use v17.0.2.

Getting Started

Integration

Get started with our 📚 integration guides and example projects, or 📘 browse the SDK reference for fine-grained documentation of all the classes and methods in the SDK.

Examples

There are 3 example apps included in the repository:

  • UI Examples.
    • This example lets you quickly try out the SDK's prebuilt UI components using a mock backend—just build and run!
  • Basic Integration
    • This example demonstrates how to build a payment flow using our prebuilt UI component integration (STPPaymentContext).
  • Non-Card Payment Examples
    • This example demonstrates how to use STPAPIClient to accept various non-card payment methods.

Check out stripe-samples for more, including:

Card scanning (Beta)

To add card scanning capabilities to our prebuilt UI components, set the cardScanningEnabled option on your STPPaymentConfiguration. You'll also need to set NSCameraUsageDescription in your application's plist, and provide a reason for accessing the camera (e.g. "To scan cards"). Card scanning is supported on devices with iOS 13 or higher.

Demo this in our Basic Integration example app. When you run the example app on a device, you'll see a "Scan Card" button when adding a new card.

This feature is currently in beta. Please file bugs on our GitHub issues page.

Contributing

We welcome contributions of any kind including new features, bug fixes, and documentation improvements. Please first open an issue describing what you want to build if it is a major change so that we can discuss how to move forward. Otherwise, go ahead and open a pull request for minor changes such as typo fixes and one liners.

Running Tests

  1. Install Carthage (if you have homebrew installed, brew install carthage)
  2. From the root of the repo, install test dependencies by running carthage bootstrap --platform ios --configuration Release --no-use-binaries (If you're using Xcode 12, you'll need to run setup-carthage-for-xcode-12.sh instead. This will be removed once Carthage adds support for Xcode 12.)
  3. Open Stripe.xcworkspace
  4. Choose the "StripeiOS" scheme with the iPhone 8, iOS 13.7 simulator (required for snapshot tests to pass)
  5. Run Product -> Test

Migrating from Older Versions

See MIGRATING.md

Github

link
Stars: 1328

Dependencies

Used By

Total: 0

Releases

Version 21.0.1 -

  • Fixes an issue with some initializers not being exposed publicly following the conversion to Swift.
  • Updates GrabPay integration to support synchronous updates.

-

Version 20.1.1 -

  • Fixes an issue when using Cocoapods 1.10 and Xcode 12. #1683
  • Fixes a warning when using Swift Package Manager. #1675

Version 20.1.0 -

  • Adds support for OXXO. #1592
  • Applies a workaround for various bugs in Swift Package Manager. #1671 Please see #1673 for additional notes when using Xcode 12.0.
  • Card scanning now works when the device's orientation is unknown. #1659
  • The expiration date field's Simplified Chinese localization has been corrected. (Thanks cythb!) #1654

Version 20.0.0 -

  • Card scanning is now built into STPAddCardViewController. Card.io support has been removed. #1629
  • Shrunk the SDK from 1.3MB when compressed & thinned to 0.7MB, allowing for easier App Clips integration. #1643
  • Swift Package Manager, Apple Silicon, and Catalyst are now fully supported on Xcode 12. #1644
  • Adds support for 19-digit cards. #1608
  • Adds GrabPay and Sofort as PaymentMethod. #1627
  • Drops support for iOS 10. #1643

Version 19.4.0 -

  • pkPaymentErrorForStripeError no longer returns PKPaymentUnknownErrors. Instead, it returns the original NSError back, resulting in dismissal of the Apple Pay sheet. This means ApplePayContext dismisses the Apple Pay sheet for all errors that aren't specifically PKPaymentError types.
  • metadata fields are no longer populated on retrieved Stripe API objects and must be fetched on your server using your secret key. If this is causing issues with your deployed app versions please reach out to Stripe Support. These fields have been marked as deprecated and will be removed in a future SDK version. * metadata fields are no longer populated on retrieved Stripe API objects and must be fetched on your server using your secret key. If this is causing issues with your deployed app versions please reach out to Stripe Support. These fields have been marked as deprecated and will be removed in a future SDK version.

Version 19.3.0 -

19.3.0 2020-05-28

  • Adds giropay PaymentMethod bindings #1569
  • Adds Przelewy24 (P24) PaymentMethod bindings #1556
  • Adds Bancontact PaymentMethod bindings #1565
  • Adds EPS PaymentMethod bindings #1578
  • Replaces es-AR localization with es-419 for full Latin American Spanish support and updates multiple localizations #1549 #1570
  • Fixes missing custom number placeholder in STPPaymentCardTextField #1576
  • Adds tabbing on external keyboard support to STPAUBECSFormView and correctly types it as a UIView instead of UIControl [#1580](https://github.com/stripe/stripe-ios/pull/1580

Version 19.2.0 -

  • Adds ability to attach shipping details when confirming PaymentIntents #1558
  • STPApplePayContext now provides shipping details in the applePayContext:didCreatePaymentMethod:paymentInformation:completion: delegate method and automatically attaches shipping details to PaymentIntents (unless manual confirmation)#1561
  • Adds support for the BECS Direct Debit payment method for Stripe users in Australia #1547

v19.1.1 -

  • Add advancedFraudSignalsEnabled property #1560

Version 19.1.0 -

  • Relaxes need for dob for full name connect account (STPConnectAccountIndividualParams). #1539
  • Adds Chinese (Traditional) and Chinese (Hong Kong) localizations #1536
  • Adds STPApplePayContext, a helper class for Apple Pay. #1499
  • Improves accessibility #1513, #1504
  • Adds support for the Bacs Direct Debit payment method #1487
  • Adds support for 16 digit Diners Club cards #1498

Version 17.0.3 -

  • Fixes an issue building with Xcode 11.4 #1526

Version 14.0.1 -

  • Fixes an issue building with Xcode 11.4 #1526

Version 19.0.1 -

  • Fixes an issue building with Xcode 11.4 #1526

v19.0.0 -

  • Deprecates the STPAPIClient initWithConfiguration: method. Set the configuration property on the STPAPIClient instance instead. #1474
  • Deprecates publishableKey and stripeAccount properties of STPPaymentConfiguration. See MIGRATING.md for more details. #1474
  • Adds explicit STPAPIClient properties on all SDK components that make API requests. These default to [STPAPIClient sharedClient]. This is a breaking change for some users of stripeAccount. See MIGRATING.md for more details. #1469
  • The user's postal code is now collected by default in countries that support postal codes. We always recommend collecting a postal code to increase card acceptance rates and reduce fraud. See MIGRATING.md for more details. #1479

Version 18.4.0 -

  • Adds support for Klarna Pay on Sources API #1444
  • Compresses images using pngcrush to reduce SDK size #1471
  • Adds support for CVC recollection in PaymentIntent confirm #1473
  • Fixes a race condition when setting defaultPaymentMethod on STPPaymentOptionsViewController #1476

Version 18.3.0 -

  • STPAddCardViewControllerDelegate methods previously removed in v16.0.0 are now marked as deprecated, to help migrating users #1439
  • Fixes an issue where canceling 3DS authentication could leave PaymentIntents in an inaccurate requires_action state #1443
  • Fixes text color for large titles #1446
  • Re-adds support for pre-selecting the last selected payment method in STPPaymentContext and STPPaymentOptionsViewController. #1445
  • Fix crash when adding/removing postal code cells #1450

v18.2.0 -

  • Adds support for creating tokens with the last 4 digits of an SSN #1432
  • Renames Standard Integration to Basic Integration

Version 18.1.0 -

  • Adds localizations for English (Great Britain), Korean, Russian, and Turkish #1373
  • Adds support for SEPA Debit as a PaymentMethod #1415
  • Adds support for custom SEPA Debit Mandate params with PaymentMethod #1420
  • Improves postal code UI for users with mismatched regions #1302
  • Fixes a potential crash when presenting the add card view controller #1426
  • Adds offline status checking to FPX payment flows #1422
  • Adds support for push provisions for Issuing users #1396

Version 18.0.0 -

  • Adds support for building on macOS 10.15 with Catalyst. Use the .xcframework file attached to the release in GitHub. Cocoapods support is coming soon. #1364
  • Errors from the Payment Intents API are now localized by default. See MIGRATING.md for details.
  • Adds support for FPX in Standard Integration. #1390
  • Simplified Apple Pay integration when using 3DS2. #1386
  • Improved autocomplete behavior for some STPPaymentHandler blocks. #1403
  • Fixed spurious keyboardWillAppear messages triggered by STPPaymentTextCard. #1393
  • Fixed an issue with non-numeric placeholders in STPPaymentTextCard. #1394
  • Dropped support for iOS 9. Please continue to use 17.0.2 if you need to support iOS 9.

Version 17.0.2 -

17.0.2 2019-09-24

  • Fixes an error that could prevent a 3D Secure 2 challenge dialog from appearing in certain situations.
  • Improved VoiceOver support. #1384
  • Updated Apple Pay and Mastercard branding. #1374
  • Updated the Standard Integration example app to use automatic confirmation. #1363
  • Added support for collecting email addresses and phone numbers from Apple Pay. #1372
  • Introduced support for FPX payments. (Invite-only Beta) #1375

Version 17.0.1 -

17.0.1 2019-09-09

  • Cancellation during the 3DS2 flow will no longer cause an unexpected error. #1353
  • Large Title UIViewControllers will no longer have a transparent background in iOS 13. #1362
  • Adds an availableCountries option to STPPaymentConfiguration, allowing one to limit the list of countries in the address entry view. #1327
  • Fixes a crash when using card.io. #1357
  • Fixes an issue with birthdates when creating a Connect account. #1361
  • Updates example code to Swift 5. #1354
  • The default value of [STPTheme translucentNavigationBar] is now YES. #1367

Version 17.0.0 -

17.0.0 2019-09-04

  • Adds support for iOS 13, including Dark Mode and some minor bug fixes. #1307
  • Updates API version from 2015-10-12 to 2019-05-16 #1254
    • Adds STPSourceRedirectStatusNotRequired to STPSourceRedirectStatus. Previously, optional redirects were marked as STPSourceRedirectStatusSucceeded.
    • Adds STPSourceCard3DSecureStatusRecommended to STPSourceCard3DSecureStatus.
    • Removes STPLegalEntityParams. Initialize an STPConnectAccountParams with an individual or company dictionary instead. See https://stripe.com/docs/api/tokens/create_account#create_account_token-account
  • Adds initial support for WeChat Pay. #1326
  • Changes the STPPaymentContextDelegate paymentContext:didCreatePaymentResult:completion: completion block type to STPPaymentStatusBlock, to let you inform the context that the user canceled.
  • The user's billing address will now be included when creating a PaymentIntent from an Apple Pay token. #1334

Version 16.0.7 -

  • Fixes STPThreeDSUICustomization not initializing defaults correctly. #1303
  • Fixes STPPaymentHandler treating post-authentication errors as authentication errors #1291
  • Removes preferredStatusBarStyle from STPThreeDSUICustomization, see STPThreeDSNavigationBarCustomization.barStyle instead #1308

Version 16.0.6 -

  • Adds a method to STPAuthenticationContext allowing you to configure the SFSafariViewController presented for web-based authentication.
  • Adds STPAddress initializer that takes STPPaymentMethodBillingDetails. #1278
  • Adds convenience method to populate STPUserInformation with STPPaymentMethodBillingDetails. #1278
  • STPShippingAddressViewController prefills billing address for PaymentMethods too now, not just Card. #1278
  • Update libStripe3DS2.a to avoid a conflict with Firebase. #1293

Version 16.0.5 -

  • Fixed an compatibility issue when building with certain Cocoapods configurations. #1288

Version 16.0.4 -

16.0.4 2019-08-08

  • Improved compatibility with other OpenSSL-using libraries
  • Fixed compatibility with Xcode 10.1
  • Fixed an issue where STPPaymentContext could be left in a bad state when cancelled

Version 16.0.3 -

16.0.3 2019-08-01

  • Changes to code obfuscation, resolving an issue with App Store review #1269
  • Adds Apple Pay support to STPPaymentHandler #1264

Version 16.0.2 -

  • Adds API to let users set a default payment option for Standard Integration #1252
  • Removes querying the Advertising Identifier (IDFA).
  • Adds customizable UIStatusBarStyle to STDSUICustomization.

Version 16.0.1 -

16.0.1 2019-07-25

  • Migrates Stripe3DS2.framework to libStripe3DS2.a, resolving an issue with App Store validation. #1246
  • Fixes a crash in STPPaymentHandler. #1244

Version 16.0.0 -

16.0.0 2019-07-18

  • Migrates STPPaymentCardTextField.cardParams property type from STPCardParams to STPPaymentMethodCardParams * Migrates STPPaymentCardTextField.cardParams property type from STPCardParams to STPPaymentMethodCardParams
  • STPAddCardViewController: * STPAddCardViewController:
    • Migrates addCardViewController:didCreateSource:completion: and addCardViewController:didCreateToken:completion: to addCardViewController:didCreatePaymentMethod:completion * Migrates addCardViewController:didCreateSource:completion: and addCardViewController:didCreateToken:completion: to addCardViewController:didCreatePaymentMethod:completion
    • Removes managedAccountCurrency property - there’s no equivalent parameter necessary for PaymentMethods. * Removes managedAccountCurrency property - there’s no equivalent parameter necessary for PaymentMethods.
  • STPPaymentOptionViewController now shows, adds, removes PaymentMethods instead of Source/Tokens. * STPPaymentOptionViewController now shows, adds, removes PaymentMethods instead of Source/Tokens.
  • STPCustomerContext, STPBackendAPIAdapter: * STPCustomerContext, STPBackendAPIAdapter:
    • Removes selectDefaultCustomerSource:completion: - Users must explicitly select their Payment Method of choice. * Removes selectDefaultCustomerSource:completion: - Users must explicitly select their Payment Method of choice.
    • Migrates detachSourceFromCustomer:completion:, attachSourceToCustomer:completion to detachPaymentMethodFromCustomer:completion:, attachPaymentMethodToCustomer:completion: * Migrates detachSourceFromCustomer:completion:, attachSourceToCustomer:completion to detachPaymentMethodFromCustomer:completion:, attachPaymentMethodToCustomer:completion:
    • Adds listPaymentMethodsForCustomerWithCompletion: - the Customer object doesn’t contain attached Payment Methods; you must fetch it from the Payment Methods API. * Adds listPaymentMethodsForCustomerWithCompletion: - the Customer object doesn’t contain attached Payment Methods; you must fetch it from the Payment Methods API.
  • STPPaymentContext now uses the new Payment Method APIs listed above instead of Source/Token, and returns the reworked STPPaymentResult containing a PaymentMethod. * STPPaymentContext now uses the new Payment Method APIs listed above instead of Source/Token, and returns the reworked STPPaymentResult containing a PaymentMethod.
  • Migrates STPPaymentResult.source to paymentMethod of type STPPaymentMethod * Migrates STPPaymentResult.source to paymentMethod of type STPPaymentMethod
  • Deprecates STPPaymentIntentAction* types, replaced by STPIntentAction*. #1208 * Deprecates STPPaymentIntentAction* types, replaced by STPIntentAction*. #1208
    • Deprecates STPPaymentIntentAction, replaced by STPIntentAction * Deprecates STPPaymentIntentAction, replaced by STPIntentAction
    • Deprecates STPPaymentIntentActionType, replaced by STPIntentActionType * Deprecates STPPaymentIntentActionType, replaced by STPIntentActionType
    • Deprecates STPPaymentIntentActionRedirectToURL, replaced by STPIntentActionTypeRedirectToURL * Deprecates STPPaymentIntentActionRedirectToURL, replaced by STPIntentActionTypeRedirectToURL
  • Adds support for SetupIntents. See https://stripe.com/docs/payments/cards/saving-cards#saving-card-without-payment
  • Adds support for 3DS2 authentication. See https://stripe.com/docs/mobile/ios/authentication