STPPaymentConfiguration

public class STPPaymentConfiguration : NSObject, NSCopying

An STPPaymentConfiguration represents all the options you can set or change around a payment. You provide an STPPaymentConfiguration object to your STPPaymentContext when making a charge. The configuration generally has settings that will not change from payment to payment and thus is reusable, while the context is specific to a single particular payment instance.

  • This is a convenience singleton configuration that uses the default values for every property

    Declaration

    Swift

    @objc(sharedConfiguration)
    public static var shared: STPPaymentConfiguration
  • The user is allowed to pay with Apple Pay if it’s configured and available on their device.

    Declaration

    Swift

    @objc
    public var applePayEnabled: Bool { get set }
  • The user is allowed to pay with FPX.

    Declaration

    Swift

    @objc
    public var fpxEnabled: Bool
  • The billing address fields the user must fill out when prompted for their payment details. These fields will all be present on the returned PaymentMethod from Stripe. The default value is STPBillingAddressFieldsPostalCode.

    Declaration

    Swift

    @objc
    public var requiredBillingAddressFields: STPBillingAddressFields
  • The shipping address fields the user must fill out when prompted for their shipping info. Set to nil if shipping address is not required. The default value is nil.

    Declaration

    Swift

    @objc
    public var requiredShippingAddressFields: Set<STPContactField>?
  • Whether the user should be prompted to verify prefilled shipping information. The default value is YES.

    Declaration

    Swift

    @objc
    public var verifyPrefilledShippingAddress: Bool
  • The type of shipping for this purchase. This property sets the labels displayed when the user is prompted for shipping info, and whether they should also be asked to select a shipping method. The default value is STPShippingTypeShipping.

    Declaration

    Swift

    @objc
    public var shippingType: STPShippingType
  • The set of countries supported when entering an address. This property accepts a set of ISO 2-character country codes. The default value is all known countries. Setting this property will limit the available countries to your selected set.

    Declaration

    Swift

    @objc
    public var availableCountries: Set<String>
  • The name of your company, for displaying to the user during payment flows. For example, when using Apple Pay, the payment sheet’s final line item will read “PAY {companyName}”. The default value is the name of your iOS application which is derived from the kCFBundleNameKey of Bundle.main.

    Declaration

    Swift

    @objc
    public var companyName: String
  • The Apple Merchant Identifier to use during Apple Pay transactions. To create one of these, see our guide at https://stripe.com/docs/mobile/apple-pay . You must set this to a valid identifier in order to automatically enable Apple Pay.

    Declaration

    Swift

    @objc
    public var appleMerchantIdentifier: String?
  • Determines whether or not the user is able to delete payment options This is only relevant to the STPPaymentOptionsViewController which, if enabled, will allow the user to delete payment options by tapping the “Edit” button in the navigation bar or by swiping left on a payment option and tapping “Delete”. Currently, the user is not allowed to delete the selected payment option but this may change in the future. Default value is YES but will only work if STPPaymentOptionsViewController is initialized with a STPCustomerContext either through the STPPaymentContext or directly as an init parameter.

    Declaration

    Swift

    @objc
    public var canDeletePaymentOptions: Bool
  • Determines whether STPAddCardViewController allows the user to scan cards using the camera on devices running iOS 13 or later. To use this feature, you must also set the NSCameraUsageDescription value in your app’s Info.plist. @note This feature is currently in beta. Please file bugs at https://github.com/stripe/stripe-ios/issues The default value is currently NO. This will be changed in a future update.

    Declaration

    Swift

    @objc
    public var cardScanningEnabled: Bool

Deprecated

  • An enum value representing which payment options you will accept from your user in addition to credit cards.

    Declaration

    Swift

    @available(*, deprecated, message: "additionalPaymentOptions has been removed. Set applePayEnabled and fpxEnabled on STPPaymentConfiguration instead.")
    @objc
    public var additionalPaymentOptions: Int
  • If you used STPPaymentConfiguration.shared.publishableKey, use STPAPIClient.shared.publishableKey instead. The SDK uses STPAPIClient.shared to make API requests by default. Your Stripe publishable key

    Declaration

    Swift

    @available(*, deprecated, message: "If you used STPPaymentConfiguration.shared.publishableKey, use STPAPIClient.shared.publishableKey instead. If you passed a STPPaymentConfiguration instance to an SDK component, create an STPAPIClient, set publishableKey on it, and set the SDK component's APIClient property.")
    @objc
    public var publishableKey: String? { get set }
  • If you used STPPaymentConfiguration.shared.stripeAccount, use STPAPIClient.shared.stripeAccount instead. The SDK uses STPAPIClient.shared to make API requests by default. In order to perform API requests on behalf of a connected account, e.g. to create charges for a connected account, set this property to the ID of the account for which this request is being made.

    Declaration

    Swift

    @available(*, deprecated, message: "If you used STPPaymentConfiguration.shared.stripeAccount, use STPAPIClient.shared.stripeAccount instead. If you passed a STPPaymentConfiguration instance to an SDK component, create an STPAPIClient, set stripeAccount on it, and set the SDK component's APIClient property.")
    @objc
    public var stripeAccount: String? { get set }