https://github.com/vamsii777/razorpay-kit
A Swift on Server SDK for the Razorpay API
https://github.com/vamsii777/razorpay-kit
payment-gateway razorpay razorpay-swift server-side-swift swift
Last synced: 3 months ago
JSON representation
A Swift on Server SDK for the Razorpay API
- Host: GitHub
- URL: https://github.com/vamsii777/razorpay-kit
- Owner: vamsii777
- License: mit
- Created: 2024-02-15T12:53:02.000Z (over 1 year ago)
- Default Branch: main
- Last Pushed: 2025-03-09T11:23:40.000Z (3 months ago)
- Last Synced: 2025-03-09T12:23:50.445Z (3 months ago)
- Topics: payment-gateway, razorpay, razorpay-swift, server-side-swift, swift
- Language: Swift
- Homepage: https://swiftpackageindex.com/vamsii777/razorpay-kit
- Size: 106 KB
- Stars: 0
- Watchers: 1
- Forks: 0
- Open Issues: 1
-
Metadata Files:
- Readme: README.md
- Contributing: CONTRIBUTING.md
- License: LICENSE
- Code of conduct: CODE_OF_CONDUCT.md
Awesome Lists containing this project
README
# RazorpayKit
[](https://swiftpackageindex.com/vamsii777/razorpay-kit)
[](https://swiftpackageindex.com/vamsii777/razorpay-kit)RazorpayKit is a Swift library for integrating with Razorpay's payment gateway. It supports managing orders, payments, subscriptions, webhooks and more.
## Installation
### Swift Package Manager
You can add RazorpayKit to your project via Swift Package Manager (SPM) by adding the following dependency to your `Package.swift` file:
```swift
dependencies: [
.package(url: "https://github.com/vamsii777/razorpay-kit.git", from: "0.0.11")
]
```## Using the API
Initialize the `RazorpayClient` with your Razorpay API key, secret, and environment. This client will be your gateway to interacting with the Razorpay API.
```swift
let httpClient = HTTPClient(...)
let razorpay = RazorpayClient(httpClient: httpClient, key: "rzp_test_12345", secret: "your_secret")
```And now you have access to the APIs via `razorpay`.
The APIs you have available correspond to what's implemented.
For example to use the `orders` API, the razorpayClient has a property to access that API via routes.
#### Creating an Order
```swift
let orderData = [
"amount": 50000, // Specify amount in the smallest currency unit.
"currency": "INR",
"receipt": "order_rcptid_11"
]let order = try await razorpayClient.order.create(data: orderData)
print("Created Order: \(order)")
```#### Fetching a Payment
```swift
let paymentId = "pay_29QQoUBi66xm2f"
let payment = try await razorpayClient.payment.fetch(paymentID: paymentId)
print("Fetched Payment: \(payment)")
```#### Managing Subscriptions
```swift
let subscriptionId = "sub_00000000000001"
let subscription = try await razorpayClient.subscription.fetch(subscriptionID: subscriptionId)
print("Fetched Subscription: \(subscription)")
```## What's Implemented
### Core Resources
* [x] **Accounts**
* [x] **Addons**
* [x] **Cards**
* [x] **Customers**
* [x] **Fund Accounts**
* [x] **IIN (Issuer Identification Number)**
* [x] **Invoices**
* [x] **Items**
* [x] **Orders**
* [x] **Payments**
* [x] **Payment Links**
* [x] **Products**
* [x] **QR Codes**
* [x] **Refunds**
* [x] **Settlements**
* [x] **Stakeholders**
* [x] **Subscriptions**
* [x] **Tokens**
* [x] **Transfers**
* [x] **Virtual Accounts**
* [x] **Webhooks**### Additional Features
* [x] **Authentication**: Securely authenticate using your Razorpay key and secret.
* [x] **Headers Management**: Customize request headers for special use cases such as idempotent requests.
* [x] **Asynchronous API Calls**: Support for Swift's modern async/await pattern for clean and simple asynchronous API calls.## LICENSE
RazorpayKit is available under the MIT license. See the [LICENSE](LICENSE) file for more info.