Now that you've got the configuration nailed down, it's time to launch the Skip experience. Below you will find examples of a few common scenarios and how to launch those scenarios.
Skip Shopper with Skip Wallet
private func startSkipExperienceWithShopperDetails() {
let user = SkipSDKUser()
user.firstName = "John"
user.lastName = "Doe"
user.email = "johndoe@email.com"
user.phoneNumber = "+12345678910"
let config = SkipSDK.Config(
launchType: .store(
id: Your store Id Here,
retailerID: Your retailer Id Here,
shoppingTripType: SkipSDKShoppingTripType.scanAndGo
),
introType: .simple,
walletType: .skipWallet,
loyaltyInfo: LoyaltyType.memberID(Your Member Id Here)
shopperType: .skipShopper,
skipSDKUser: user,
environment: .sandbox
)
SkipSDK.launchSkip(from: self, withConfig: config)
}
private func startSkipExperienceWithShopperDetailsAndLoyaltyNumber() {
let user = SkipSDKUser()
user.firstName = "John"
user.lastName = "Doe"
user.email = "johndoe@email.com"
user.phoneNumber = "+12345678910"
let config = SkipSDK.Config(
launchType: .store(
id: Your store Id Here,
retailerID: Your retailer Id Here,
shoppingTripType: SkipSDKShoppingTripType.scanAndGo
),
introType: .simple,
walletType: .skipWallet,
loyaltyInfo: LoyaltyType.memberID(Your Member Id Here)
shopperType: .skipShopper,
skipSDKUser: user,
environment: .sandbox
)
SkipSDK.launchSkip(from: self, withConfig: config)
}
private func startSkipExperienceWithoutShopperDetails() {
let config = SkipSDK.Config(
launchType: .store(
id: Your store Id Here,
retailerID: Your retailer Id Here,
shoppingTripType: SkipSDKShoppingTripType.scanAndGo
),
loyaltyInfo: LoyaltyType.memberID(Your Member Id Here)
introType: .simple,
walletType: .skipWallet,
shopperType: .skipShopper,
environment: .sandbox
)
SkipSDK.launchSkip(from: self, withConfig: config)
}
Anonymous Shopper Example
private fun startAnonymousSkipExperience() {
let config = SkipSDK.Config(
launchType: .store(
id: Your store Id Here,
retailerID: Your retailer Id Here,
shoppingTripType: SkipSDKShoppingTripType.scanAndGo
),
introType: .simple,
walletType: .providedWallet,
shopperType: .anonymous,
environment: .sandbox
)
SkipSDK.launchSkip(from: self, withConfig: config)
}
override fun skipWillClose(shopperCheckedOut: Bool) {
//Use this information if it's interesting to your use case
}
override fun addNewPaymentMethodCalledFromSkipExperience(topViewController: UIViewController) {
// From here you can show the customer your flow for updating and/or adding payment method(s).
// Once the customer is done, you'll want to call SkipSDK.updatePaymentMethods(paymentMethods = Updated list of payment methods)
SkipSDK.updatePaymentMethods(paymentMethods = [Updated list of payment methods])
}
override fun startSkipCart(storeID: Int, completionHandler: @escaping SkipSDKCartHandler) {
//Call to your server to start an anonymous cart for the provided storeID. Your server will then reach out to our server to start the cart.
// The response from the server should be returned in the completionHandler.
val response = ExampleApi().startShoppingCart(StartCartRequestBody(storeID))
completionHandler(SkipSDKStartCartResponse(token = response.token, cartID = response.cartId, confetti = response.confetti))
}
override fun tenderSkipCart(cartID: Int, paymentMethod: SkipSDKPaymentMethod?, total: String) {
//Call to your server to tender the cart for the given cartID.
ExampleApi().tenderShoppingCart(ExampleTenderCartRequestBody(cartID))
}
override fun collectRequiredUserInputForPaymentMethod(topViewController: UIViewController, paymentMethod: SkipSDKPaymentMethod) {
//If the payment method requires user input, you can collect that information here and then call SkipSDK.inputCollectedForPaymentMethod()
SkipSDK.inputCollectedForPaymentMethod()
}