Scan & Go

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

  • If shopper details are available

private fun startSkipExperienceWithShopperDetails() {
    val shopper = SkipSDKUser(
        firstName = "John",
        lastName = "Doe",
        phoneNumber = "+12345678910",
        email = "johndoe@email.com"
    )
    
    val config = SkipSDKConfig(
        launchType = SkipSDKLaunchType.store(
            storeId = "Insert your store Id here",
            retailerID = "Insert your retailer Id here",
            shoppingTripType = SkipSDKShoppingTripType.scan_and_go,
        ),
        walletType = SkipSDKWalletType.skip_wallet,
        shopperType = SkipSDKShopperType.skip_shopper,
        introType = SkipIntroType.simple("Scan & Go"),
        environment = SkipSDKEnvironment.sandbox,
        skipSDKUser = shopper,
        skipSDKCallbacks = this
    )

    SkipUISDK.launchSkip(
        context = this,
        config = config
    )
}
  • If loyalty number is available

private fun startSkipExperienceWithShopperDetailsAndLoyaltyNumber() {
    val shopper = SkipSDKUser(
        firstName = "John",
        lastName = "Doe",
        phoneNumber = "+12345678910",
        email = "johndoe@email.com"
    )
    
    val config = SkipSDKConfig(
        launchType = SkipSDKLaunchType.store(
            storeId = "Insert your store Id here",
            retailerID = "Insert your retailer Id here",
            shoppingTripType = SkipSDKShoppingTripType.scan_and_go,
        ),
        loyalty = SkipSDKLoyaltyInfo.memberId("Insert the member Id here"),
        walletType = SkipSDKWalletType.skip_wallet,
        shopperType = SkipSDKShopperType.skip_shopper,
        introType = SkipIntroType.simple("Scan & Go"),
        environment = SkipSDKEnvironment.sandbox,
        skipSDKUser = shopper,
        skipSDKCallbacks = this
    )

    SkipUISDK.launchSkip(
        context = this,
        config = config
    )
}
  • If shopper details are NOT available

private fun startSkipExperienceWithoutShopperDetails() {
    
    val config = SkipSDKConfig(
        launchType = SkipSDKLaunchType.store(
            storeId = "Insert your store Id here",
            retailerID = "Insert your retailer Id here",
            shoppingTripType = SkipSDKShoppingTripType.scan_and_go,
        ),
        walletType = SkipSDKWalletType.skip_wallet,
        shopperType = SkipSDKShopperType.skip_shopper,
        introType = SkipIntroType.simple("Scan & Go"),
        environment = SkipSDKEnvironment.sandbox,
    )
        
    SkipUISDK.launchSkip(
        context = this,
        config = config
    )
}

Anonymous Shopper Example

private fun startAnonymousSkipExperience() {
   //Populate the providedPayments with all the payment methods you'd like to display in Skip
    val providedPayments: ArrayList<SkipSDKPaymentMethod> = ArrayList()

    val config = SkipSDKConfig(
        launchType = SkipSDKLaunchType.store(
            storeId = "Insert your store Id here",
            retailerID = "Insert your retailer Id here",
            shoppingTripType = SkipSDKShoppingTripType.scan_and_go,
        ),
        walletType = SkipSDKWalletType.provided_wallet,
        shopperType = SkipSDKShopperType.anonymous,
        paymentMethods = providedPayments,
        introType = SkipIntroType.simple("Scan & Go"),
        environment = SkipSDKEnvironment.sandbox
    )

    SkipUISDK.launchSkip(
        context = this,
        config = config
    )
}

override fun skipWillClose(shopperCheckedOut: Boolean) {
    //Use this information if it's interesting to your use case
}

override fun addNewPaymentMethodCalledFromSkipExperience() {
   // 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 SkipUISDK.updatePaymentMethods(paymentMethods = Updated list of payment methods)

   SkipUISDK.updatePaymentMethods(paymentMethods = listOf(Updated list of payment methods))
}

override fun startSkipCart(storeID: Int, completionHandler: (SkipSDKStartCartResponse) -> Unit) {
   //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(rootView: RootView, paymentMethod: SkipSDKPaymentMethod) {
    //If the payment method requires user input, you can collect that information here and then call SkipUISDK.inputCollectedForPaymentMethod() 

    SkipUISDK.inputCollectedForPaymentMethod()
}