diff --git a/.swiftpm/xcode/package.xcworkspace/contents.xcworkspacedata b/.swiftpm/xcode/package.xcworkspace/contents.xcworkspacedata
new file mode 100644
index 0000000..919434a
--- /dev/null
+++ b/.swiftpm/xcode/package.xcworkspace/contents.xcworkspacedata
@@ -0,0 +1,7 @@
+
+
+
+
+
diff --git a/.swiftpm/xcode/package.xcworkspace/xcuserdata/ramprasad.a.xcuserdatad/UserInterfaceState.xcuserstate b/.swiftpm/xcode/package.xcworkspace/xcuserdata/ramprasad.a.xcuserdatad/UserInterfaceState.xcuserstate
new file mode 100644
index 0000000..2bce893
Binary files /dev/null and b/.swiftpm/xcode/package.xcworkspace/xcuserdata/ramprasad.a.xcuserdatad/UserInterfaceState.xcuserstate differ
diff --git a/.swiftpm/xcode/xcuserdata/ramprasad.a.xcuserdatad/xcschemes/xcschememanagement.plist b/.swiftpm/xcode/xcuserdata/ramprasad.a.xcuserdatad/xcschemes/xcschememanagement.plist
new file mode 100644
index 0000000..52102c4
--- /dev/null
+++ b/.swiftpm/xcode/xcuserdata/ramprasad.a.xcuserdatad/xcschemes/xcschememanagement.plist
@@ -0,0 +1,27 @@
+
+
+
+
+ SchemeUserState
+
+ RazorpayCheckout.xcscheme_^#shared#^_
+
+ orderHint
+ 0
+
+ checkout-swift-Package.xcscheme_^#shared#^_
+
+ orderHint
+ 1
+
+
+ SuppressBuildableAutocreation
+
+ checkout-swift
+
+ primary
+
+
+
+
+
diff --git a/LICENSE b/LICENSE
new file mode 100755
index 0000000..adc67a0
--- /dev/null
+++ b/LICENSE
@@ -0,0 +1,19 @@
+Copyright (c) 2016 Razorpay Software Pvt. Ltd.
+
+Permission is hereby granted, free of charge, to any person obtaining a copy
+of this software and associated documentation files (the "Software"), to deal
+in the Software without restriction, including without limitation the rights
+to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+copies of the Software, and to permit persons to whom the Software is
+furnished to do so, subject to the following conditions:
+
+The above copyright notice and this permission notice shall be included in
+all copies or substantial portions of the Software.
+
+THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
+THE SOFTWARE.
diff --git a/Package.swift b/Package.swift
new file mode 100644
index 0000000..2b49e60
--- /dev/null
+++ b/Package.swift
@@ -0,0 +1,32 @@
+// swift-tools-version: 5.9
+// The swift-tools-version declares the minimum version of Swift required to build this package.
+
+import PackageDescription
+
+let packageVersion = "1.3.4"
+
+let package = Package(
+ name: "RazorpayCheckout",
+ platforms: [
+ .iOS(.v13)
+ ],
+ products: [
+ // Products define the executables and libraries a package produces, making them visible to other packages.
+ .library(
+ name: "RazorpayCheckout",
+ targets: ["RazorpayCheckout", "Razorpay"]
+ ),
+ ],
+ targets: [
+ .target(
+ name: "RazorpayCheckout",
+ path: "RazorpayCheckout/Sources/RazorpayCheckoutCore"
+ ),
+ .binaryTarget(
+ name: "Razorpay",
+ url: "https://github.com/razorpay/razorpay-pod/releases/download/\(packageVersion)/Razorpay.xcframework.zip",
+ checksum: "7a9aee4f56d1ff0bbedc19451b0c01f26640cb9b4b043502b6e8b3d1e1e3bbbe"
+ ),
+ ],
+ swiftLanguageVersions: [.v5]
+)
diff --git a/RazorpayCheckout/.gitignore b/RazorpayCheckout/.gitignore
new file mode 100644
index 0000000..0023a53
--- /dev/null
+++ b/RazorpayCheckout/.gitignore
@@ -0,0 +1,8 @@
+.DS_Store
+/.build
+/Packages
+xcuserdata/
+DerivedData/
+.swiftpm/configuration/registries.json
+.swiftpm/xcode/package.xcworkspace/contents.xcworkspacedata
+.netrc
diff --git a/RazorpayCheckout/.swiftpm/xcode/package.xcworkspace/xcshareddata/IDEWorkspaceChecks.plist b/RazorpayCheckout/.swiftpm/xcode/package.xcworkspace/xcshareddata/IDEWorkspaceChecks.plist
new file mode 100644
index 0000000..18d9810
--- /dev/null
+++ b/RazorpayCheckout/.swiftpm/xcode/package.xcworkspace/xcshareddata/IDEWorkspaceChecks.plist
@@ -0,0 +1,8 @@
+
+
+
+
+ IDEDidComputeMac32BitWarning
+
+
+
diff --git a/RazorpayCheckout/Sources/RazorpayCheckoutCore/RazorpayCheckout.swift b/RazorpayCheckout/Sources/RazorpayCheckoutCore/RazorpayCheckout.swift
new file mode 100644
index 0000000..305c3a0
--- /dev/null
+++ b/RazorpayCheckout/Sources/RazorpayCheckoutCore/RazorpayCheckout.swift
@@ -0,0 +1,81 @@
+import Razorpay
+
+enum CheckoutErrors: Error {
+ case keyMissing
+}
+
+extension CheckoutErrors: CustomStringConvertible {
+
+ var description: String {
+ switch self {
+ case .keyMissing: return "Merchant Key is mandatory"
+ }
+ }
+}
+
+public protocol RazorpaySwiftProtocol {
+
+}
+
+public protocol PaymentCompletionDelegate: RazorpaySwiftProtocol {
+ func onPaymentError(_ code: Int32, description str: String)
+ func onPaymentSuccess(_ payment_id : String)
+}
+
+public protocol PaymentCompletionWithDataDelegate: RazorpaySwiftProtocol {
+ func onPaymentError(_ code: Int32, description str: String, andData response: [AnyHashable : Any]?)
+ func onPaymentSuccess(_ payment_id: String, andData response: [AnyHashable : Any]?)
+}
+
+public final class RazorpaySwift {
+
+ private var razorpay: RazorpayCheckout?
+ private var key: String?
+ private var delegate: RazorpaySwiftProtocol?
+ private static let shared: RazorpaySwift = RazorpaySwift()
+
+ private init() {}
+
+ public static func initWithKey(key: String, andDelegate delegate: PaymentCompletionDelegate) -> RazorpaySwift {
+ RazorpaySwift.shared.key = key
+ RazorpaySwift.shared.delegate = delegate
+ return RazorpaySwift.shared
+ }
+
+ public static func initWithKey(key: String, andDelegateWithData delegate: PaymentCompletionWithDataDelegate) -> RazorpaySwift {
+ RazorpaySwift.shared.key = key
+ RazorpaySwift.shared.delegate = delegate
+ return RazorpaySwift.shared
+ }
+
+ public func open(withPayload payload: [AnyHashable: Any]) throws {
+ guard let key = self.key else {
+ throw CheckoutErrors.keyMissing
+ }
+ if self.razorpay == nil {
+ self.razorpay = RazorpayCheckout.initWithKey(key, andDelegate: self)
+ }
+
+ self.razorpay?.open(payload)
+ }
+}
+
+extension RazorpaySwift: RazorpayPaymentCompletionProtocol {
+ public func onPaymentError(_ code: Int32, description str: String) {
+ (self.delegate as? PaymentCompletionDelegate)?.onPaymentError(code, description: str)
+ }
+
+ public func onPaymentSuccess(_ payment_id: String) {
+ (self.delegate as? PaymentCompletionDelegate)?.onPaymentSuccess(payment_id)
+ }
+}
+
+extension RazorpaySwift: RazorpayPaymentCompletionProtocolWithData {
+ public func onPaymentError(_ code: Int32, description str: String, andData response: [AnyHashable : Any]?) {
+ (self.delegate as? PaymentCompletionWithDataDelegate)?.onPaymentError(code, description: str, andData: response)
+ }
+
+ public func onPaymentSuccess(_ payment_id: String, andData response: [AnyHashable : Any]?) {
+ (self.delegate as? PaymentCompletionWithDataDelegate)?.onPaymentSuccess(payment_id, andData: response)
+ }
+}
diff --git a/RazorpayCheckout/Tests/RazorpayCheckoutTests/RazorpayCheckoutTests.swift b/RazorpayCheckout/Tests/RazorpayCheckoutTests/RazorpayCheckoutTests.swift
new file mode 100644
index 0000000..19294dc
--- /dev/null
+++ b/RazorpayCheckout/Tests/RazorpayCheckoutTests/RazorpayCheckoutTests.swift
@@ -0,0 +1,12 @@
+import XCTest
+@testable import RazorpayCheckout
+
+final class RazorpayCheckoutTests: XCTestCase {
+ func testExample() throws {
+ // XCTest Documentation
+ // https://developer.apple.com/documentation/xctest
+
+ // Defining Test Cases and Test Methods
+ // https://developer.apple.com/documentation/xctest/defining_test_cases_and_test_methods
+ }
+}