Checkout
@objc(PPCheckout)
@objcMembers
final class Checkout
extension Checkout : CVarArg, CustomDebugStringConvertible, CustomStringConvertible, Equatable, Hashable, NSObjectProtocol, StaticIdentifiable
The main interface where you can change or start behavior of the Checkout paysheet.
-
A
See moreFirebaseCallbacks
implementation that has empty callbacks by default, allowing for custom callbacks to be passed in. It also serves as a default implementation of the protocol, to be extended as needed.Declaration
Swift
struct CustomizableFirebaseCallbacks
extension Checkout.CustomizableFirebaseCallbacks : FirebaseCallbacks
-
This
addShippingAddress()
function call takes a(Result<UserCheckoutResult, RequestError>) -> Void
closure which is invoked when the data or error from the response completes.Declaration
Swift
static func addShippingAddress(givenName: String, familyName: String, portableAddress: PortableAddress, completion: ((Result<UserCheckoutResult, RequestError>) -> Void)? = nil)
Parameters
givenName
Name given or chosen
familyName
Familiar name
portableAddress
Object conforming to the
PortableAddress
protocolcompletion
a closure to listen for an operate on the returned results
-
Use this method to update the selected shipping address in
State
and fire a change notification.Declaration
Swift
static func changeShipping(newShippingAddress: ShippingAddress? = nil, newShippingMethod: ShippingMethod? = nil)
-
Undocumented
Declaration
Swift
@available(*, deprecated, message: "Use the new Checkout.changeShipping function") static func changeShippingAddress(to address: ShippingAddress)
-
Logs out the current user, this will force the user to authenticate on the next session.
Note
- This function cannot be called during an active session. Attempting to call this function during an active session will not logout the user.
Declaration
Swift
static func logoutUser()
-
Undocumented
Declaration
Swift
@objc(setConfig:) static func set(config: CheckoutConfig)
-
Allows you to set the createOrder callback to be passed into the config object. This will be called when creating order/requesting order ID from merchant.
Note
- This function cannot be called before
Checkout.set(config:)
or during an active session. Attempting to call this function beforeCheckout.set(config:)
or during an active session will result in the callback not being set. - Calling this function will override the createOrder callback of the config set with
Checkout.set(config:)
Declaration
Swift
static func setCreateOrderCallback(_ createOrder: @escaping CheckoutConfig.CreateOrderCallback)
- This function cannot be called before
-
Set the currency code used to check PaymentButton’s eligibility. Funding eligibility request for buttons will be made again if currency code changes.
Declaration
Swift
@objc(setCurrencyCode:) static func setCurrencyCode(_ currency: CurrencyCode)
Parameters
currency
the currency code
-
Allows you to set the onApprove callback to be passed into the config object. This will be called when the transaction has been approved.
Note
- This function cannot be called before
Checkout.set(config:)
or during an active session. Attempting to call this function beforeCheckout.set(config:)
or during an active session will result in the callback not being set. - Calling this function will override the onApprove callback of the config set with
Checkout.set(config:)
Declaration
Swift
static func setOnApproveCallback(_ onApprove: @escaping CheckoutConfig.ApprovalCallback)
- This function cannot be called before
-
Allows you to set the onCancel callback to be passed into the config object. This will be called when the user has cancelled the transaction.
Note
- This function cannot be called before
Checkout.set(config:)
or during an active session. Attempting to call this function beforeCheckout.set(config:)
or during an active session will result in the callback not being set. - Calling this function will override the onCancel callback of the config set with
Checkout.set(config:)
Declaration
Swift
static func setOnCancelCallback(_ onCancel: @escaping CheckoutConfig.CancelCallback)
- This function cannot be called before
-
Allows you to set the onError callback to be passed into the config object. This will be called when an error cannot be recovered from, and the transaction has been cancelled.
Note
- This function cannot be called before
Checkout.set(config:)
or during an active session. Attempting to call this function beforeCheckout.set(config:)
or during an active session will result in the callback not being set. - Calling this function will override the onError callback of the config set with
Checkout.set(config:)
Declaration
Swift
static func setOnErrorCallback(_ onError: @escaping CheckoutConfig.ErrorCallback)
- This function cannot be called before
-
Allows you to set the onShippingChange callback to be passed into the config object. This will be called when the shipping address is changed.
Note
- This function cannot be called before
Checkout.set(config:)
or during an active session. Attempting to call this function beforeCheckout.set(config:)
or during an active session will result in the callback not being set. - Calling this function will override the onShippingChange callback of the config set with
Checkout.set(config:)
Declaration
Swift
static func setOnShippingChangeCallback(_ onShippingChange: @escaping CheckoutConfig.ShippingChangeCallback)
- This function cannot be called before
-
Determines if the SDK displays an alert before dismissing the paysheet
Declaration
Swift
static var showsExitAlert: Bool
-
Undocumented
Declaration
Swift
@available(*, deprecated, message: "The exit survey has been removed. Setting a value to this variable will have no effect.") static var showsExitSurvey: Bool
-
This function invokes the UI experience for display and must be called from main thread. The hosting app may call this but doing so before
set(config:)
results in an undefined experience likely resulting in error.Note
Callbacks provided in this function will be used only for this checkout session, and won’t override the callbacks you set previously with
Checkout.set___Callback()
, or withCheckoutConfig.init()
. If callbacks are not provided in this function, the callbacks you set previously will be used.Declaration
Swift
@objc(startWithPresentingViewController:createOrder:onApprove:onShippingChange:onCancel:onError:) static func start(presentingViewController: UIViewController? = nil, createOrder: CheckoutConfig.CreateOrderCallback? = nil, onApprove: CheckoutConfig.ApprovalCallback? = nil, onShippingChange: CheckoutConfig.ShippingChangeCallback? = nil, onCancel: CheckoutConfig.CancelCallback? = nil, onError: CheckoutConfig.ErrorCallback? = nil)
Parameters
presentingViewController
The UIViewController to be used to present the SDK’s experience. If not provided, Checkout.config.presentingViewController will be used if available, otherwise, the top most view controller currently being presented will be used.
createOrder
Called when creating order
onApprove
Called when the transaction has been approved
onCancel
Called when the transaction has been canceled
onError
Called when an error cannot be recovered from, and the transaction has been cancelled
-
Pay mode used for a checkout session (Continue, Pay Now)
Declaration
Swift
static var userAction: UserAction { get }
-
The current version of the Checkout SDK
Declaration
Swift
@objc(sdkVersion) static var version: String { get }