Updated 25 August 2021
In this blog, we will know about the implementation of the telr payment gateway.
And you will receive the payment from the customer using this payment gateway
1 |
pod 'TelrSDK', :path => '../' |
1 2 |
import TelrSDK class ViewController: UIViewController { |
1 |
var paymentRequest:PaymentRequest? |
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 |
private func preparePaymentRequest() -> PaymentRequest{ let paymentReq = PaymentRequest() paymentReq.key = KEY paymentReq.store = "12" paymentReq.appId = "20153" paymentReq.appName = "TelrSDK" paymentReq.appUser = "123456" paymentReq.appVersion = "0.0.1" paymentReq.transTest = "1"//1 for test mode"//0 for live mode paymentReq.transType = "paypage" paymentReq.transClass = "ecom" paymentReq.transCartid = "123" paymentReq.transDesc = "Test API" paymentReq.transCurrency = "inr" paymentReq.transAmount = "120" paymentReq.billingPhone = "1234" paymentReq.billingFName = "test" paymentReq.billingLName = "test" paymentReq.billingTitle = "Mr" paymentReq.city = "test" paymentReq.country = "test" paymentReq.region = "test" paymentReq.address = "test" paymentReq.zip = "test" paymentReq.language = "en" return paymentReq } |
and delegate where you want. the delegate will use to fetch the response of the payment
1 2 3 4 5 6 |
paymentRequest = preparePaymentRequest() let telrController = TelrController() telrController.delegate = self telrController.customBackButton = customBackButton telrController.paymentRequest = paymentRequest! self.navigationController?.pushViewController(telrController, animated: true) |
For payment cancel
1 2 3 4 |
func didPaymentCancel() { print("didPaymentCancel") self.showAlert(message: "didPaymentCancel", type: "Cancel") } |
For payment success
in this method you can fatch all the detail which you have provided to initialize the payment gateway like address, card last 4 digit etc
1 2 3 4 |
func didPaymentSuccess(response: TelrResponseModel) { // in the response you can find all data } |
For payment failer
1 2 3 4 5 |
//Mark:- This method call when user click on cancel button and if payment get failed func didPaymentFail(messge: String) { print("didPaymentFail") self.showAlert(message: "didPaymentFail \(messge)", type: "Fail") } |
Now you can execute the above code and you can receive payment through Terl payment gateway
Thanks for reading 🙂
Hope this blog helped you with a better understanding of Telr payment method.
For more technical blogs please visit here.
Wants to know more about telr payment gateway please visit here.
If you have more details or questions, you can reply to the received confirmation email.
Back to Home
Be the first to comment.