Usage - bonkey/zalando-commerce-ios GitHub Wiki
Note: Use zCommerceUI: ZalandoCommerceUI instance configured previously to interact with SDK
Present checkout
Start checkout somewhere in your view controller, e.g. when a user tap on a buy button:
import ZalandoCommerceAPI
import ZalandoCommerceUI
class ViewController: UIViewController {
var zCommerceUI: ZalandoCommerceUI?
@IBAction func buyButtonTapped(sender: AnyObject) {
zCommerceUI?.presentCheckoutView(sku: "N1242A0WI-K13")
}
}
Get customer information
import ZalandoCommerceAPI
import ZalandoCommerceUI
class ViewController: UIViewController {
var zCommerceUI: ZalandoCommerceUI?
@IBAction private func getCustomerTapped(sender: UIButton) {
zCommerceUI?.api.customer { result in
switch result {
case .failure(let error):
print("Error: \(error)")
case .success(let customer):
print(customer)
}
}
}
}