STPCustomer
Objective-C
@interface STPCustomer : NSObject <STPAPIResponseDecodable>
Swift
class STPCustomer : NSObject, STPAPIResponseDecodable
An STPCustomer
represents a deserialized Customer object from the Stripe API.
You shouldn’t need to instantiate an STPCustomer
– you should instead use
STPCustomerContext
to manage retrieving and updating a customer.
-
Initialize a customer object with the provided values.
Declaration
Objective-C
+ (nonnull instancetype) customerWithStripeID:(nonnull NSString *)stripeID defaultSource:(nullable id<STPSourceProtocol>)defaultSource sources:(nonnull NSArray<id<STPSourceProtocol>> *)sources;
Swift
convenience init(stripeID: String, defaultSource: STPSourceProtocol?, sources: [STPSourceProtocol])
Parameters
stripeID
The ID of the customer, e.g.
cus_abc
defaultSource
The default source of the customer, such as an
STPCard
object. Can be nil.sources
All of the customer’s payment sources. This might be an empty array.
Return Value
an instance of STPCustomer
-
The Stripe ID of the customer, e.g.
cus_1234
Declaration
Objective-C
@property (nonatomic, copy, readonly) NSString *_Nonnull stripeID;
Swift
var stripeID: String { get }
-
The default source used to charge the customer.
Declaration
Objective-C
@property (nonatomic, readonly, nullable) id<STPSourceProtocol> defaultSource;
Swift
var defaultSource: STPSourceProtocol? { get }
-
The available payment sources the customer has (this may be an empty array).
Declaration
Objective-C
@property (nonatomic, readonly) NSArray<id<STPSourceProtocol>> *_Nonnull sources;
Swift
var sources: [STPSourceProtocol] { get }
-
The customer’s shipping address.
Declaration
Objective-C
@property (nonatomic, readonly, nullable) STPAddress *shippingAddress;
Swift
var shippingAddress: STPAddress? { get }