Skip to content

bankopen/open-payment-iOS-framework

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

30 Commits
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Open Layer Payment pod

Version License Platform

Integrate OPEN Payment Gateway with your iOS app and start collecting payments from your customers.

Pre-requisites

  1. XCode 13 or newer
  2. Cocoapods

Create a Payment Token

A payment token represents an order or a purchase. The first step to open up a Layer payment page on your website or checkout page is to create a payment_token

A payment_token can be created by referring to create payment token API. This API should be always called from your server. You will receive payment_token as a response from create payment token API.

Installation

OpenPayment is available through CocoaPods. To install it, simply add the following line to your Podfile:

pod 'OpenPayment'

then run

pod install

Initializing OpenPayment:

You can see below code, these are minimum and mandatory calls to enable payment processing. If any of it is missed then an error will be generated.

For example, consider parameters as follows.

let openPaymentBuilderObj = OpenPaymentBuilder()
    openPaymentBuilderObj.setAccessKey("accessToken")
    openPaymentBuilderObj.setEnvironment(.Sandbox)
    openPaymentBuilderObj.setPaymentToken("paymentToken") 
    openPaymentBuilderObj.setErrorColor("colorhexcode") // Optional
    openPaymentBuilderObj.setLogoUrl("Your LogoURL") // Optional
    openPaymentBuilderObj.setBgColor("colorhexcode") // Optional

let openPaymentOBj = openPaymentBuilderObj.buildObject()
    openPaymentOBj.setBaseViewController(self)

Calls and Descriptions:

Method Mandatory Description
setAccessKey() Access key is a unique key which you can generate from your Open dashboard.
setEnvironment() Following ENUM can be passed to this method. .SANDBOX .LIVE
setPaymentToken() To create the token using Create Payment Token API.
setErrorColor() Error color (icons/ error lines / error messages) of Layer will be changed to this . Example: #83025c
setLogoUrl() Logo is changed to image source passed.
setBgColor() Main color of Layer will be changed to this . Example: #f8c5c5

Implement Delegate:

To start the payment, first set OpenPayment delegate to get payment status

openPaymentOBj.delegate = self

Proceed to Payment:

To start the payment, just call startPayment() method of OpenPayment and after that transaction will get started.

openPaymentOBj.startPayment()

Description:

onPaymentCompleted() - This method is invoked when a transaction is completed. It may either captured, failed , pending and cancelled

onPaymentError(): - Integration errors.

Getting Transaction Details

To get details of transactions, we have a callback method onPaymentCompleted() with a parameter of TransactionDetails.

To get details, below method of TransactionDetails are useful :

transactionDetails.paymentId transactionDetails.paymentTokenId transactionDetails.status

Call the webhook URL to get the complete response of the transactions.

🛠 Info.plist Configuration

To support UPI and other payment apps, add the following entry to your app's Info.plist:

<key>LSApplicationQueriesSchemes</key>
<array>
    <string>gpay</string>
    <string>paytmmp</string>
    <string>phonepe</string>
    <string>bhim</string>
    <string>amazonpay</string>
    <string>payzapp</string>
    <string>icici</string>
    <string>axisbank</string>
    <string>sbi</string>
    <string>kotak</string>
    <string>federal</string>
    <string>yesbank</string>
    <string>idfcbank</string>
    <string>indus</string>
    <string>pnb</string>
    <string>ikwik</string>
    <string>axispay</string>
    <string>idfcup</string>
    <string>kotak811</string>
    <string>cred</string>
</array>

License

OpenPayment is available under the MIT license.

About

No description, website, or topics provided.

Resources

License

Stars

Watchers

Forks

Packages

No packages published

Contributors 4

  •  
  •  
  •  
  •