CheckoutAPIClient
public class CheckoutAPIClient
Checkout API Client used to call the api endpoint of Checkout API available with your public key
-
Create an instance with the specified public key and environment
Declaration
Swift
public init(publicKey: String, environment: Environment = .sandbox)
Parameters
publicKey
Checkout public key
environment
Sandbox or Live (default to sandbox)
Return Value
The new
CheckoutAPIClient
instance
-
Get the list of card providers The list will contains card schemes as well as alternative payments
Declaration
Swift
public func getCardProviders(successHandler: @escaping ([CardProvider]) -> Void, errorHandler: @escaping (Error) -> Void)
Parameters
successHandler
Callback to execute if the request is successful
errorHandler
Callback to execute if the request failed
-
Create a card token
Declaration
Swift
public func createCardToken(card: CardTokenRequest, successHandler: @escaping (TokenResponse) -> Void, errorHandler: @escaping (ErrorResponse) -> Void)
Parameters
card
Card used to create the token
successHandler
Callback to execute if the request is successful
errorHandler
Callback to execute if the request failed
-
Create a card token
Declaration
Swift
public func createCardToken(card: CkoCardTokenRequest, successHandler: @escaping (CkoCardTokenResponse) -> Void, errorHandler: @escaping (ErrorResponse) -> Void)
Parameters
card
Card used to create the token
successHandler
Callback to execute if the request is successful
errorHandler
Callback to execute if the request failed
-
Create a card token with Apple Pay
Declaration
Swift
public func createApplePayToken(paymentData: Data, successHandler: @escaping (ApplePayToken) -> Void, errorHandler: @escaping (ApplePayErrorResponse) -> Void)
Parameters
paymentData
Apple Pay payment data used to create a card token
successHandler
Callback to execute if the request is successful
erroHandler
Callback to execute if the request failed