iOS Standard SDK


In a iOS Standard SDK merchant needs to post the intial request to Paymentz hosted checkout page where customer will provide card/account details. Once the payment is verified customer is redirected back to the iOS application along with the payment result.


The initial request must contain all the required information:

  • - authentication credentials
  • - type and amount of transaction
  • - merchantTransactionId

The mobile standard checkout request has to be sent to our endpoint i.e. /transaction/Checkout using POST method.


In our API Specifications you can find a full list of parameters that can be sent in the initial request.


Workflow


1. Post an Initial Payment

Merchant needs to post the intial request to Paymentz hosted checkout page.

2. Redirect to Paymentz hosted page

Customer will provide his/her card/account details on Paymentz hosted checkout page.

3. Return to the iOS application

After payment confirmation, the payment result will be returned as a Object to the iOS app.


Configuration of the StandardCheckoutKit.framework file


Import Library to your project and follow the steps to config the framework:

  • - Download the library from here.
  • - Unzip the library.
  • - Open your project in Xcode and Drag the "StandardCheckoutKit.framework" file from unzipped folder to your project.
  • - In target of your project under "Frameworks, Libraries and Embeded Content" click on (+) to add this framework.
  • - After adding framework, Change "Do not Embed" to "Embed & Sign".
  • - Clean and build the Project.
  • - For test environment use hostname as: https://test.paymentz.com/
  • - For live environment use hostname as: https://live.paymentz.com/

1. Post an Initial Payment

To start the process, merchant has to POST request to our endpoint i.e. /transaction/Checkout


Sample Request

Mode:

Brand:
Language:
import StandardCheckoutKit
class ViewController: UIViewController, StandardCheckoutDelegate {

	 override func viewDidLoad() {
	 super.viewDidLoad()
	 }
	 @IBAction func pay(_ sender: UIButton) {
	 	 let secureKey = "bzI93aEQeYDeE50Pa929NiDk3us8XTbU"

	 	 let requestParameters = RequestParameters()
	 	 requestParameters.MemberId = "10558"
	 	 requestParameters.ToType = "paymentz"
	 	 requestParameters.OrderDescription = "Testing order"
	 	 requestParameters.Country = "IN"
	 	 requestParameters.City = "Mumbai"
	 	 requestParameters.State = "MH"
	 	 requestParameters.PostCode = "400064"
	 	 requestParameters.Street = "Malad"
	 	 requestParameters.Telnocc = "091"
	 	 requestParameters.Phone = "9854785236"
	 	 requestParameters.Email = "john.d@xyz.com"
	 	 requestParameters.PaymentBrand = PaymentBrand.VISA
	 	 requestParameters.PaymentMode = PaymentMode.CC
	 	 requestParameters.Currency = "INR"
	 	 requestParameters.TerminalId = "1106"
	 	 requestParameters.HostUrl = "https://test.paymentz.com/transaction/Checkout"

	 	 let standardCheckout = StandardCheckout(viewController: self)
	 	 standardCheckout.initPayment(requestParameters: requestParameters, checkoutDelegate: self, secureKey: secureKey)
	 }
}

2. Redirect to Paymentz hosted page

The account holder will be redirected to Paymentz hosted page, where the account holder can fill the card/account details.


3. Return to the iOS application

Once the payment has been processed, the flow will be redirected to the iOS application along with the payment result parameters. These parameters will be accessible via the get methods from the PaymentzResult class. Please check the example below.

You can also check the payment confirmation with our Backoffice Inquiry API.


Sample code for reading the response

Language:
// Delegate methods is where you will receive the payment result
func onSuccess(standardCheckoutResult: StandardCheckoutResult) {
	 let resultViewController = UIStoryboard.init(name: 'Main', bundle: nil).instantiateViewController(withIdentifier: 'ResultViewController') as! ResultViewController
	 let json = standardCheckoutResult.json
	 resultViewController.standardCheckoutResult = '(json)'
	 let resultNavigationController: UINavigationController = UINavigationController(rootViewController: resultViewController)
	 self.present(resultNavigationController, animated: true, completion: nil)
}
func onFail(title: String, message: String) {
	  let alert = UIAlertController(title: title, message: message, preferredStyle: UIAlertController.Style.alert)
	 alert.addAction(UIAlertAction(title: 'OK', style: UIAlertActionStyle.default, handler: nil))
	 self.present(alert, animated: true, completion: nil)
}

Payment Modes and Brands

Find below the list of payment modes and brands for standard checkout.

Show all modes and brands

Mode Brand