PayUUPICoreKit Intent Flow
This document provides step-by-step instructions for integrating the PayUUPICore SDK into your iOS application for Intent transactions.
Integration Steps
1. Add SDK Dependency
Using CocoaPods
//Add the following to your Podfile:
use_frameworks!
pod 'PayUIndia-UPICore'Then run:
pod installUsing Swift Package Manager - Xcode
Steps:
- Go to File → Add Package Dependencies
- Enter the repository URL:
https://github.com/payu-intrepos/payu-upi-ios-sdk - Select version 11.2.1 or latest
Using Swift Package Manager - Package.swift
.package(
name: "PayUIndia-UPIKit",
url: "https://github.com/payu-intrepos/payu-upi-ios-sdk",
from: "11.2.1"
)2. Configure Supported UPI Apps
<!-- Add the following schemes to your Info.plist to allow the SDK to detect installed UPI apps -->
<key>LSApplicationQueriesSchemes</key>
<array>
<string>tez</string>
<string>phonepe</string>
<string>paytm</string>
<string>paytmmp</string>
<string>bhim</string>
<string>credpay</string>
<string>mobikwik</string>
<string>navipay</string>
<string>super</string>
<string>popclubapp</string>
<string>amazonpay</string>
<string>myairtel</string>
<string>payzapp</string>
<string>upi</string>
<string>freecharge</string>
<string>in.fampay.app</string>
<string>kiwi</string>
<string>jupiter</string>
<string>omnicard</string>
<string>slice-upi</string>
<string>imobile</string>
<string>icici</string>
<string>axismobile</string>
<string>yono</string>
<string>slicepay</string>
<string>indusmobile</string>
<string>shriramone</string>
<string>bobupi</string>
<string>indusmobile</string>
<string>whatsapp</string>
<string>kmb</string>
<string>fi</string>
<string>idfcfirstbank</string>
</array>Note: These schemes allow the SDK to detect installed UPI apps on the user's device. Some schemes may not be actively used but are included for compatibility and future updates.
3. Initialize SDK
// Initialize the SDK before starting the payment
PayUUPICore.shared.environment = .production // or .test
PayUUPICore.shared.logLevel = .error // .verbose for debugging4. Fetch Installed UPI Apps
// Fetch supported apps installed on the device
let handler = PayUUPIHybridIntentHandler()
let supportedApps = handler.getSupportedIntentApps(isForSI: <BOOL>)
// returns array of PayUSupportedIntentAppEach app object contains:
app.nameapp.scheme
Display apps in your UI:
- Google Pay
- PhonePe
- Paytm
- BHIM
- Amazon Pay
After user selection:
let selectedApp = <USER_SELECTED_APP> // PayUSupportedIntentApp5. Start UPI Payment
func startUPIPayment(from viewController: UIViewController, selectedApp: PayUUPIApp) {
PayUUPICore.shared.paymentCompletion = { response in
// Handle payment response
// Remove loader or dismiss presented screen
self.dismiss(animated: true)
}
let handler = PayUUPIHybridIntentHandler()
let paymentParams = createPaymentParams()
handler.initiateIntentPayment(
withApp: selectedApp,
paymentParams: paymentParams,
fromVC: viewController
)
}6. Create Payment Parameters
func createPaymentParams() -> PayUPaymentParam {
let paymentParam = PayUPaymentParam(
key: "<MERCHANT_KEY>",
transactionId: "<TRANSACTION_ID>",
amount: "<AMOUNT>",
productInfo: "<PRODUCT_INFO>",
firstName: "<CUSTOMER_NAME>",
email: "<CUSTOMER_EMAIL>",
phone: "<CUSTOMER_PHONE>",
surl: "<SUCCESS_URL>",
furl: "<FAILURE_URL>",
environment: .production
)
paymentParam.additionalParam[PaymentParamConstant.udf1] = "<UDF1>"
paymentParam.additionalParam[PaymentParamConstant.udf2] = "<UDF2>"
paymentParam.additionalParam[PaymentParamConstant.udf3] = "<UDF3>"
paymentParam.additionalParam[PaymentParamConstant.udf4] = "<UDF4>"
paymentParam.additionalParam[PaymentParamConstant.udf5] = "<UDF5>"
paymentParam.hashes = generateHashes(for: paymentParam)
return paymentParam
}7. Recurring (SI) Payment Parameters (Optional)
// For UPI Autopay / Subscription payments
let siParams = PayUSIParams(
billingAmount: "<BILLING_AMOUNT>",
paymentStartDate: "<START_DATE>", // "dd/MM/yyyy"
paymentEndDate: "<END_DATE>", // "dd/MM/yyyy"
billingCycle: "<BILLING_CYCLE>", // once or daily or weekly or monthly or yearly or adhoc
billingInterval: NSNumber(value: <BILLING_INTERVAL>)
)
siParams.remarks = "<REMARKS>"
siParams.isFreeTrial = "<BOOL>"
siParams.billingLimit = "<BILLING_LIMIT>" // "ON"
siParams.billingRule = "<BILLING_RULE>" // "MAX"
siParams.billingDate = "<BILLING_DATE>"
paymentParam.siParam = siParamsNote: Refer to PayU documentation for valid values of:
billingCyclebillingIntervalbillingLimitbillingRule
8. TPV Payment Parameters (Optional)
// For UPI TPV payments
let beneficiary = PayUBeneficiaryParams(
beneficiaryName: "<BENEFICIARY_NAME>",
beneficiaryAccountNumber: "<ACCOUNT_NUMBER>",
beneficiaryIFSC: "<IFSC_CODE>",
beneficiaryAccountType: <ACCOUNT_TYPE>, // .savings or .current
verficationMode: <VERIFICATION_MODE> // Optional – debitCard or netBanking or aadhaar
)
paymentParam.payuBeneficieryDetails = [beneficiary]Note: Refer to PayU documentation for valid values of:
beneficiaryAccountTypeverficationMode
9. Hash Generation
⚠️ Important: Hash must be generated on the backend using your merchant salt.
Normal Transaction Hash
sha512(key|txnid|amount|productinfo|firstname|email|udf1|udf2|udf3|udf4|udf5||||||salt)SI Transaction Hash
For subscription payments, siDetails must be included.
SHA512(key|txnid|amount|productinfo|firstname|email|udf1|udf2|udf3|udf4|udf5||||||siDetails|salt)SI Details JSON String:
"{\"billingAmount\":\"<BILLING_AMOUNT>\",\"billingCurrency\":\"<CURRENCY>\",\"billingCycle\":\"<BILLING_CYCLE>\",\"billingInterval\":\"<BILLING_INTERVAL>\",\"paymentStartDate\":\"<PAYMENT_START_DATE>\",\"paymentEndDate\":\"<PAYMENT_END_DATE>\",\"billingLimit\":\"<BILLING_LIMIT>\",\"billingRule\":\"<BILLING_RULE>\"}"TPV Transaction Hash
For TPV payments, tpvDetails must be included.
sha512(key|txnid|amount|productinfo|firstname|email|udf1|udf2|udf3|udf4|udf5||||||tpvDetails|salt)TPV Details JSON String:
"{\"beneficiaryAccountNumber\":\"<BENEFICIARY_ACC_NUM>\",\"ifscCode\":\"<IFSC>\"}"TPV-SI Transaction Hash
For TPV-SI payments, both tpvDetails and siDetails must be included.
key|txnid|amount|productinfo|firstname|email|udf1|udf2|udf3|udf4|udf5||||||tpvDetails|siDetails|saltNote: The SI and TPV details must exactly match the values provided in the payment request, without any added spaces or line breaks.
10. Payment Response
// Payment result is returned through:
PayUUPICore.shared.paymentCompletionUse this callback to:
- Handle success / failure
- Dismiss loaders
- Update UI
- Verify transaction from backend
Supported Intent Apps
| APPs | Intent | Mandate |
|---|---|---|
| gpay | Supported | Supported |
| phonepe | Supported | Supported |
| paytm | Supported | Supported |
| bhim | Supported | Supported |
| cred | Supported | Not Supported |
| amazonPay | Supported | Not Supported |
| navi | Supported | Supported |
| popclub | Supported | Not Supported |
| mobikwik | Supported | Not Supported |
| superMoney | Supported | Supported |
| airtel | Supported | Not Supported |
| payzapp | Supported | Not Supported |
| freecharge | Supported | Supported |
Additional Resources
For Collect transactions, and for complete details on integration steps and parameter definitions, please refer to the official documentation:
PayU iOS UPI SDK Documentation
Updated about 2 hours ago
