2

I am currently working on Telr Gateway. I have downloaded the Swift 4.2 version Telr SDK and checked the sample test.

My question is: Should I send XML Request or directly I can send like which is mentioned in sample?

jscs
  • 63,694
  • 13
  • 151
  • 195
Rohith Singh
  • 75
  • 2
  • 12
  • Guys., anyone please help me in Telr Payment Gateway.imported frameworks related to telr in sample file its working fine., the same while importing into project which contains Workspace, its not working . I checked in TelrSDK module there is no code copied.., If anyone having idea about this, please help me.. – Rohith Singh Feb 11 '19 at 06:03
  • Hi as you have mentioned you moved to an API integration procedure , I am also following the same, but facing an error of "Invalid request". As I have added question here , https://stackoverflow.com/questions/63841493/code01-code-messageinvalid-request-message-in-telr-payment-gateway-in-io – ki1234 Oct 03 '20 at 04:55

1 Answers1

3
  1. Drag and drop the TelrSDK.framework into Frameworks group.
  2. Then go to your project's Target and add Telr framework in Embedded frameworks and Linked frameworks.
  3. Now clean and build the project.

Sample Payment Request.

Import the TelrSDK Framework. Then create a payment request object and assign the request to telrController's paymentRequest property. Then push or present the telr view controller. After entering the card details, you'll get the response in the view controller with StoryboardID called ResultController which inherits the TelrResponseController.

private func openTelrPaymentGateway() {
    paymentRequest = preparePaymentRequest()
    let telrVC = storyboard?.instantiateViewController(withIdentifier: "TelrController") as! TelrController
    telrVC.title = "Telr"
    telrVC.paymentRequest = paymentRequest!
    navigationController?.pushViewController(telrVC, animated: true)
}

private func preparePaymentRequest() -> PaymentRequest{

    let paymentReq = PaymentRequest()
    paymentReq.key = "YOUR KEY"
    paymentReq.store = "YOUR STORE ID"
    paymentReq.appId = "123456789"
    paymentReq.appName = "YOUR APP NAME"
    paymentReq.appUser = "123456"
    paymentReq.appVersion = "0.0.1"
    paymentReq.transTest = "1"
    paymentReq.transType = "auth"
    paymentReq.transClass = "paypage"
    paymentReq.transCartid = String(arc4random())
    paymentReq.transDesc = "Test API"
    paymentReq.transCurrency = "AED"
    paymentReq.transAmount = "\(totalAmount)"
    paymentReq.transLanguage = "en"
    paymentReq.billingEmail = EMAIL
    paymentReq.billingFName = "Hany"
    paymentReq.billingLName = "Sakr"
    paymentReq.billingTitle = "Mr"
    paymentReq.city = "Dubai"
    paymentReq.country = "AE"
    paymentReq.region = "Dubai"
    paymentReq.address = "line 1"
    paymentReq.billingPhone="8785643"
    return paymentReq

}

Once the request is processed, you'll get the response from TelrResponseController class.

class PaymentGatewayVC: TelrResponseController {

    override func viewDidLoad() {
    super.viewDidLoad()

      print(message!)
      print(trace!)
      print(status!)
      print(avs!)
      print(code!)
      print(ca_valid!)
      print(cardCode!)
      print(cardLast4!)
      print(cvv!)
      print(tranRef!)

    }

}

Hope this helps you.

Vinoth Vino
  • 9,166
  • 3
  • 66
  • 70
  • 1
    Thanks Vinoth., I tried this procedure first but TelrSDK class code not copied properly.,so I moved to API integration procedure and worked successfully.. anyway I will try your procedure once again.. Thanks Much for update.. – Rohith Singh Feb 18 '19 at 04:55
  • If would be helpful for others if you guyz give sample. I am also working on TELR SDK SWIFT but i did't find any way to add card details in request. – Taimoor Suleman Apr 13 '19 at 16:22