switch nsError.code { caseSKError.clientInvalid.rawValue, SKError.paymentNotAllowed.rawValue: showAlert(text: "You are not allowed to make payment.") caseSKError.paymentCancelled.rawValue: showAlert(text: "Payment has been cancelled.") caseSKError.unknown.rawValue, SKError.paymentInvalid.rawValue: fallthrough default: showAlert(text: "Something went wrong making payment.") } }