First you will need a checkoutKey which can be obtained via PointCheckout's API.
You can import the framework using import PointCheckoutSdk
Create an object of PointCheckoutClient:
let client = PointCheckoutClient(environment: PointCheckoutClientEnvironment.TEST)
| Parameter | Default | Description |
| Environment | nil | Specifies the environment of the app, use PointCheckoutClientEnvironment.TEST for testing purposes. |
Create a single instance of PointCheckoutClient and re-use that instance each time you want to checkout.
To submit a payment call the pay function of the PointCheckoutClient:
let client = PointCheckoutClient(environment: PointCheckoutEnvironment.TEST)
client.pay(controller: viewController, checkoutKey: strCheckoutKey, delegate: callback)| Parameter | Description |
| controller | A UIViewController calling the pay function |
| checkoutKey | The checkoutKey String value |
| delegate | Delegate that will be called on payment update or cancellation |
Calling the pay method will open a modal and the user will be able to login and complete the payment.
Use PointCheckoutPaymentDelegate to listen for payment updates.
import UIKit
import PointCheckoutSdk
class ViewController: UIViewController, PaymentDelegate{
override func viewDidLoad() {
super.viewDidLoad()
}
func onPaymentUpdate(){
print("UPDATE CALLBACK")
}
func onPaymentCancel(){
print("CANCEL CALLBACK")
}
}