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 STPShippingAddressViewController with 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

    paymentContext

    The payment context to use.

  • Initializes a new STPShippingAddressCardViewController with 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

    configuration

    The configuration to use (this determines the required shipping address fields and shipping type). - see: STPPaymentConfiguration

    theme

    The theme to use to inform the view controller’s visual appearance. - see: STPTheme

    currency

    The currency to use when displaying amounts for shipping methods. The default is USD.

    shippingAddress

    If set, the shipping address view controller will be pre-filled with this address. - see: STPAddress

    selectedShippingMethod

    If set, the shipping methods view controller will use this method as the selected shipping method. If selectedShippingMethod is nil, the first shipping method in the array of methods returned by your delegate will be selected.

    prefilledInformation

    If 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 STPShippingAddressViewController onto an existing UINavigationController‘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

    completion

    The callback to run after the view controller is dismissed. You may specify nil for this parameter.

  • Use one of the initializers declared in this interface.

    Declaration

    Objective-C

    - (nonnull instancetype)initWithTheme:(nonnull STPTheme *)theme;
  • Use one of the initializers declared in this interface.

    Declaration

    Objective-C

    - (nonnull instancetype)initWithNibName:(nullable NSString *)nibNameOrNil
                                     bundle:(nullable NSBundle *)nibBundleOrNil;
  • Use one of the initializers declared in this interface.

    Declaration

    Objective-C

    - (nullable instancetype)initWithCoder:(nonnull NSCoder *)aDecoder;