Installation
Install the SDK using your preferred dependency manager:- CocoaPods
- Swift Package Manager
Add the pod to your
Podfile, then run pod install:Podfile
Integration steps
1
Create an order on your server
Before opening checkout, create an order from your backend using the Razorpay API and return the
order_id to your app. See the web integration guide for a server-side example — the order creation API is the same across all platforms.2
Initialize the SDK and open checkout
Import the Razorpay SDK, conform your view controller to The
RazorpayPaymentCompletionProtocol, and open checkout when the customer is ready to pay.ViewController.swift
amount is specified in the smallest currency unit (for example, paise for INR or cents for USD). Pass the order_id you received from your server.3
Verify the payment signature on your server
After
onPaymentSuccess is called, send the payment_id along with the order_id and razorpay_signature to your server for verification. Use the same signature verification logic described in the web integration guide.Your Key ID is safe to include in your iOS app binary. Never include your Key Secret in client-side code — it must remain on your server only.