Requirements

  1. You must be a client of ePay.
  2. You must obtain integration data:
TerminalIDMerchant payment terminal ID
ClientIDMerchant ID
ClientSecretMerchant Secret Key
  1. The deployment target of your project should be iOS 11 or higher.

Test data

ClientIDtest
ClientSecretyF587AV9Ms94qN2QShFzVR3vFnWkhjbAK3sG
TerminalID67e34d63-102f-4bd1-898e-370781d0074d

Setup

1. Import SDK

  1. Download EpaySDK.framework from the linkIOS framework
  2. Unzip the archive
  3. Add EpaySDK.framework to your project

3.1 In the Embed Frameworks target of your application, you need to import and add the EpaySDK.framework library.

Untitled

Untitled (1)

Untitled (2)

Untitled (3)

2. Setup Auth Configs

Create an instance of authentication configs. You can store the instance in constants or create it during direct initialization of the Payment Page or Transfer Page

Import the EpaySDK module.

import EpaySDK

Create an AuthConfig instance

let config = AuthConfig(
 merchantId: <The store's TerminalID identifier received from epay>,
 merchantName: <Store Name>,
 clientId: <Client identifier ClientID received from epay>,
 clientSecret: <clientSecret secret key received from epay>
)

3. Response handling from EpaySDK.

Add an observer to handle the response from EpaySDK.

NotificationCenter.default.addObserver(
		self,
		selector: #selector(handleSdkResponse),
		name: Notification.Name("sdk_response"),
		object: nil)

Note: The notification type must be sdk_response, but you can change the name of the handler method handleSdkResponse

4. Response handling

Create a function to handle the notification for the result of the payment/transfer processing (function handleSdkResponse from the previous step).

Response format:

isSuccessful: Bool,
paymentReference: String,
errorCode: Int,
errorMessage: String

Example handler:

@objc func handleSdkResponse(_ notification: Notification) {
  navigationController?.popToViewController(self, animated: true) // 1
  let isSuccessful = notification.userInfo?["isSuccessful"] as? Bool // 2
  if isSuccessful == true { // 3
     let reference = notification.userInfo?["paymentReference"] as? String
  } else { // 4
     let errorCode = notification.userInfo?["errorCode"] as? Int
     let errorMessage = notification.userInfo?["errorMessage"] as? String
  }       

Where the steps are:

  1. Exit from SDK
  2. Determine the payment status
  3. If successful, get the payment reference
  4. Otherwise, get the error code and message

5. Setting up payment or transfer

Next, to make a direct operation, you need to prepare a payment model and launch the type of operation you need. Learn more on the Payment Pages and Transfer Pages pages.