STPShippingAddressViewController

public class STPShippingAddressViewController : STPCoreTableViewController
extension STPShippingAddressViewController :
STPAddressViewModelDelegate, UITableViewDelegate, UITableViewDataSource,
STPShippingMethodsViewControllerDelegate

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 init(configuration: STPPaymentConfiguration.shared theme: STPTheme.defaultTheme currency:"" shippingAddress:nil selectedShippingMethod:nil prefilledInformation:nil).

    Declaration

    Swift

    @objc
    public convenience init()
  • Initializes a new STPShippingAddressViewController with the given payment context and sets the payment context as its delegate.

    Declaration

    Swift

    @objc(initWithPaymentContext:)
    public convenience init(paymentContext: STPPaymentContext)

    Parameters

    paymentContext

    The payment context to use.

  • Initializes a new STPShippingAddressCardViewController with the provided parameters.

    Declaration

    Swift

    @objc(initWithConfiguration:theme:currency:shippingAddress:selectedShippingMethod:prefilledInformation:)
    public 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). - seealso: STPPaymentConfiguration

    theme

    The theme to use to inform the view controller’s visual appearance. - seealso: 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. - seealso: 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. - seealso: STPUserInformation

  • The view controller’s delegate. This must be set before showing the view controller in order for it to work properly. - seealso: STPShippingAddressViewControllerDelegate

    Declaration

    Swift

    @objc
    public weak var delegate: STPShippingAddressViewControllerDelegate?
  • 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

    Swift

    @objc(dismissWithCompletion:)
    public func dismiss(withCompletion completion: STPVoidBlock?)

    Parameters

    completion

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