STPShippingAddressViewController
@interface STPShippingAddressViewController : STPCoreTableViewController
This view controller contains a shipping address collection form. It renders a right bar button item that submits the form, so it must be shown inside a UINavigationController. Depending on your configuration’s shippingType, the view controller may present a shipping method selection form after the user enters an address.
-
A convenience initializer; equivalent to calling
initWithConfiguration:[STPPaymentConfiguration sharedConfiguration] theme:[STPTheme defaultTheme] currency:nil shippingAddress:nil selectedShippingMethod:nil prefilledInformation:nil.Declaration
Objective-C
- (nonnull instancetype)init;Swift
init() -
Initializes a new
STPShippingAddressViewControllerwith the given payment context and sets the payment context as its delegate.Declaration
Objective-C
- (nonnull instancetype)initWithPaymentContext: (nonnull STPPaymentContext *)paymentContext;Swift
init(paymentContext: STPPaymentContext)Parameters
paymentContextThe payment context to use.
-
Initializes a new
STPShippingAddressCardViewControllerwith the provided parameters.Declaration
Objective-C
- (nonnull instancetype) initWithConfiguration:(nonnull STPPaymentConfiguration *)configuration theme:(nonnull STPTheme *)theme currency:(nullable NSString *)currency shippingAddress:(nullable STPAddress *)shippingAddress selectedShippingMethod:(nullable PKShippingMethod *)selectedShippingMethod prefilledInformation:(nullable STPUserInformation *)prefilledInformation;Swift
init(configuration: STPPaymentConfiguration, theme: STPTheme, currency: String?, shippingAddress: STPAddress?, selectedShippingMethod: PKShippingMethod?, prefilledInformation: STPUserInformation?)Parameters
configurationThe configuration to use (this determines the required shipping address fields and shipping type). - see: STPPaymentConfiguration
themeThe theme to use to inform the view controller’s visual appearance. - see: STPTheme
currencyThe currency to use when displaying amounts for shipping methods. The default is USD.
shippingAddressIf set, the shipping address view controller will be pre-filled with this address. - see: STPAddress
selectedShippingMethodIf set, the shipping methods view controller will use this method as the selected shipping method. If
selectedShippingMethodis nil, the first shipping method in the array of methods returned by your delegate will be selected.prefilledInformationIf set, the shipping address view controller will be pre-filled with this information. - see: STPUserInformation
-
The view controller’s delegate. This must be set before showing the view controller in order for it to work properly. - see: STPShippingAddressViewControllerDelegate
Declaration
Objective-C
@property (readwrite, nonatomic) id<STPShippingAddressViewControllerDelegate> _Nullable delegate;Swift
weak var delegate: STPShippingAddressViewControllerDelegate? { get set } -
If you’re pushing
STPShippingAddressViewControlleronto an existingUINavigationController‘s stack, you should use this method to dismiss it, since it may have pushed an additional shipping method view controller onto the navigation controller’s stack.Declaration
Objective-C
- (void)dismissWithCompletion:(nullable STPVoidBlock)completion;Swift
func dismiss(completion: STPVoidBlock? = nil)Parameters
completionThe callback to run after the view controller is dismissed. You may specify nil for this parameter.
View on GitHub
STPShippingAddressViewController Class Reference