STPAddress
public class STPAddress : NSObject
extension STPAddress: STPAPIResponseDecodable
extension STPAddress: STPFormEncodable
extension STPAddress: NSCopying
STPAddress Contains an address as represented by the Stripe API.
-
The user’s full name (e.g. “Jane Doe”)
Declaration
Swift
@objc public var name: String?
-
The first line of the user’s street address (e.g. “123 Fake St”)
Declaration
Swift
@objc public var line1: String?
-
The apartment, floor number, etc of the user’s street address (e.g. “Apartment 1A”)
Declaration
Swift
@objc public var line2: String?
-
The city in which the user resides (e.g. “San Francisco”)
Declaration
Swift
@objc public var city: String?
-
The state in which the user resides (e.g. “CA”)
Declaration
Swift
@objc public var state: String?
-
The postal code in which the user resides (e.g. “90210”)
Declaration
Swift
@objc public var postalCode: String?
-
The ISO country code of the address (e.g. “US”)
Declaration
Swift
@objc public var country: String?
-
The phone number of the address (e.g. “8885551212”)
Declaration
Swift
@objc public var phone: String?
-
The email of the address (e.g. “jane@doe.com”)
Declaration
Swift
@objc public var email: String?
-
Declaration
Swift
@objc public var additionalAPIParameters: [AnyHashable : Any]
-
When creating a charge on your backend, you can attach shipping information to prevent fraud on a physical good. You can use this method to turn your user’s shipping address and selected shipping method into a hash suitable for attaching to a charge. You should pass this to your backend, and use it as the
shipping
parameter when creating a charge.Declaration
Swift
@objc(shippingInfoForChargeWithAddress:shippingMethod:) public class func shippingInfoForCharge( with address: STPAddress?, shippingMethod method: PKShippingMethod? ) -> [AnyHashable: Any]?
Parameters
address
The user’s shipping address. If nil, this method will return nil.
method
The user’s selected shipping method. May be nil.
-
Initializes an empty STPAddress.
Declaration
Swift
@objc public override init()
-
Initializes a new STPAddress with data from STPPaymentMethodBillingDetails.
Declaration
Swift
@objc public init(paymentMethodBillingDetails billingDetails: STPPaymentMethodBillingDetails)
Parameters
billingDetails
The STPPaymentMethodBillingDetails instance you want to populate the STPAddress from.
Return Value
A new STPAddress instance with data copied from the passed in billing details.
-
Initializes a new STPAddress with data from an PassKit contact.
Declaration
Swift
@objc(initWithPKContact:) public init(pkContact contact: PKContact)
Parameters
contact
The PassKit contact you want to populate the STPAddress from.
Return Value
A new STPAddress instance with data copied from the passed in contact.
-
Generates a PassKit contact representation of this STPAddress.
Declaration
Swift
@objc(PKContactValue) public func pkContactValue() -> PKContact
Return Value
A new PassKit contact with data copied from this STPAddress instance.
-
Initializes a new STPAddress with a contact from the Contacts framework.
Declaration
Swift
@objc(initWithCNContact:) public init(cnContact contact: CNContact)
Parameters
contact
The CNContact you want to populate the STPAddress from.
Return Value
A new STPAddress instance with data copied from the passed in contact.
-
Checks if this STPAddress has the level of valid address information required by the passed in setting.
Declaration
Swift
@objc public func containsRequiredFields(_ requiredFields: STPBillingAddressFields) -> Bool
Parameters
requiredFields
The required level of billing address information to check against.
Return Value
YES if this address contains at least the necessary information, NO otherwise.
-
Checks if this STPAddress has any content (possibly invalid) in any of the desired billing address fields. Where
containsRequiredFields:
validates that this STPAddress contains valid data in all of the required fields, this method checks for the existence of any data. For example, ifdesiredFields
isSTPBillingAddressFieldsZip
, this will check if the postalCode is empty. Note: WhendesiredFields == STPBillingAddressFieldsNone
, this method always returns NO. @parameter desiredFields The billing address information the caller is interested in.Declaration
Swift
@objc(containsContentForBillingAddressFields:) public func containsContent(for desiredFields: STPBillingAddressFields) -> Bool
Return Value
YES if there is any data in this STPAddress that’s relevant for those fields.
-
Checks if this STPAddress has the level of valid address information required by the passed in setting. Note: When
requiredFields == nil
, this method always returns YES.Declaration
Swift
@objc public func containsRequiredShippingAddressFields(_ requiredFields: Set<STPContactField>?) -> Bool
Parameters
requiredFields
The required shipping address information to check against.
Return Value
YES if this address contains at least the necessary information, NO otherwise.
-
Checks if this STPAddress has any content (possibly invalid) in any of the desired shipping address fields. Where
containsRequiredShippingAddressFields:
validates that this STPAddress contains valid data in all of the required fields, this method checks for the existence of any data. Note: WhendesiredFields == nil
, this method always returns NO. @parameter desiredFields The shipping address information the caller is interested in.Declaration
Swift
@objc public func containsContent(forShippingAddressFields desiredFields: Set<STPContactField>?) -> Bool
Return Value
YES if there is any data in this STPAddress that’s relevant for those fields.
-
Converts an STPBillingAddressFields enum value into the closest equivalent representation of PKContactField options
Declaration
Swift
@objc(applePayContactFieldsFromBillingAddressFields:) public class func applePayContactFields(from billingAddressFields: STPBillingAddressFields) -> Set<PKContactField>
Parameters
billingAddressFields
Stripe billing address fields enum value to convert.
Return Value
The closest representation of the billing address requirement as a PKContactField value.
-
Converts a set of STPContactField values into the closest equivalent representation of PKContactField options
Declaration
Swift
@objc public class func pkContactFields( fromStripeContactFields contactFields: Set<STPContactField>? ) -> Set<PKContactField>?
Parameters
contactFields
Stripe contact fields values to convert.
Return Value
The closest representation of the contact fields as a PKContactField value.
-
Declaration
Swift
@objc public private(set) var allResponseFields: [AnyHashable : Any] { get }
-
Declaration
Swift
@objc public class func decodedObject(fromAPIResponse response: [AnyHashable : Any]?) -> `Self`?
-
Declaration
Swift
@objc public class func rootObjectName() -> String?
-
Declaration
Swift
@objc public class func propertyNamesToFormFieldNamesMapping() -> [String : String]