Developer Docs
Search
⌃K

iOS SDK

Seel iOS SDK provides a way to integrate Seel Return Assurance(RA) into your iOS app.

Overview

Integrating RA into an iOS client includes adding the RA widget to the product detail page and checkout page, setting up RA event listeners, creating a quote when shopper opts in RA, and creating an order after shopper has made a purchase.

Set up Seel on iOS

1. Install the latest version of CocoaPods if you haven't. 2. If you don't have an existing Podfile, run the following command to create one:
pod init
3. Add this line to your Podfile:
pod 'SeelSDK'
4. Run the following command:
pod install
5. Don't forget to use the .xcworkspace file to open your project in Xcode, instead of the .xcodeproj file, from here on out. 6. In the future, to update to the latest version of the SDK, run:
pod update SeelSDK

Add RA marketing banner to product detail page

Add RA marketing banner to the product detail page. Marketing banner will be hidden when RA is ineligible for a product.
let controller = SeelRAPDPViewController.start()
present(controller, animated: true, completion: nil)

Add RA widget to checkout page

Add RA widget to the checkout page. Shoppers can easily opt in and out RA at checkout by switching the toggle on the widget.
let controller = SeelRAViewController.start()
present(controller, animated: true, completion: nil)

Create quote

Partner can call createQuote() when shopper lands on the checkout page, and pass additional info to create a quote by using this function. This is an optional step for partner. However, we strongly recommend that partner call createQuote() function to pass extra information to get more accurate underwriting result.
Create quote may trigger onUnchecked() when the cart is ineligible for RA, i.e. shipping address is invalid or not supported
var quoteInfo = {
"items":[{ // all items in the cart
"product_url": "url", // required
"quantity": 1, // required
"price": 34.33, // required
"title": "title_1", // required
"description": "description_1", // required
"extra_info": {} // optional
}],
"shipping_address": { // optional
"address_1": "123 Main St",
"address_2": "Apt 1001",
"city": "San Francisco",
"state": "CA",
"zipcode": "94105",
"country": "US"
},
"extra_info": { //optional
}
}
self.createQuote(quoteInfo)

Opt in and opt out of RA

On the checkout page, shopper or partner can opt in or opt out of RA.
  • If RA widget is displayed to shoppers on the checkout page and it's shoppers who decide whether to add RA to the order, then partner must set up RA event listeners.
  • If it's partner who decides to opt in/ out RA, then partner should trigger RA events manually

Set up RA event listeners

Partner must add a listener function to update the order total when shopper opts in/out RA.
Partner needs to add RA price to the item subtotal and applies sales tax accordingly when opts in RA.
extension SeelRAViewController: SeelRAEventListener {
func onChecked() {
// Implemenation required: add RA to the order
print("onChecked")
}
func onUnchecked() {
// Implemenation required: remove RA from the order
print("onUnchecked")
}
}

triggerEvent

When it's merchant who decides to add/ remove RA to a checkout. Partner can trigger checked/ unchecked events manually to let Seel know if RA is added or not.
self.triggerCheckedEvent() // trigger RA checked event
self.triggerUnCheckedEvent() // trigger RA unchecked event

Place order

placeOrder() should be called when shopper successfully places an order, even when RA is unchecked.
var order_info = {
"order_id": "order_1234", // required
"sales_tax_rate": 0.087, // required
"customer": {
"email": "[email protected]", // required
"first_name": "John", // optional
"last_name": "Doe" // optional
},
"extra_info": {} // optional
}
self.placeOrder(order_info)