SDK Integration
  • Getting Started
  • Onboarding Requirements
  • Hash Generation
  • Test Merchant list
  • Android
    • Android SDK Offering
    • PayUCheckoutPro
      • Integration
      • Build the Payment Params
        • Additional Params
      • Hash Generation
      • Set up the payment hashes
      • Initiate the Payment
      • Customized Integration
        • Set Webview Properties
        • SDK Configuration
        • Additional Offerings
      • Offers Integration
      • Convenience Fee Integration
      • Custom Note Integration
      • MCP Integration
    • Core
      • Supported Payment Types
      • TPV Integration
      • Merchant Web Services
        • Getting Enabled Payment Options
        • GetCheckoutDetails API
        • Lookup API
    • Custom Browser
      • Integration
        • CustomBrowser Config
        • CustomBrowserCallback
        • Supporting below Lollipop Versions
        • Third-Party Payments Support
      • Sample App
      • Change Logs
    • Native OTP Assist
      • Integration
      • Customization
      • Change Logs
    • UPI
      • Integration
      • TPV Integration in UPI
      • Sample App
      • Change Logs
    • Google Payâ„¢
      • Integration
      • Sample App
    • PhonePe
      • Integration
      • Sample App
      • Change Logs
    • OlaMoney
    • PayU OTP Parser
      • Integration
    • FAQ Android
  • iOS
    • PayUCheckoutPro
      • Integration
      • Advanced Integration
      • Set up the payment hashes
      • Convenience Fee Integration
      • MCP Integration
      • Custom Note Integration
    • Core
      • POD Integration
      • Seamless
      • Web Services
      • Objective C-Non-Seamless
      • Standing Instructions
      • TPV Integration
      • Sample App
    • Custom Browser
      • Sample App
    • OlaMoney
    • Native OTP Assist
      • Integration
      • Customization
    • UPI
      • Integration
      • Sample App
    • PayUParams
      • PayUSIParams
      • PayUBeneficiaryParams
  • Releasing to Apple
  • React-Native
    • PayUCheckoutPro
      • Integration
      • Set up the payment hashes
      • Advanced Integration
      • Change Logs
    • Core
    • Non-Seamless Wrapper
    • TPV (beta)
      • Integration
  • FAQ iOS
Powered by GitBook
On this page
  • Passing static hashes
  • Passing dynamic hashes
  • Getting Hash Data to calculate hash
  • Passing generated hash to SDK

Was this helpful?

  1. iOS
  2. PayUCheckoutPro

Set up the payment hashes

(Mandatory Step)

PreviousAdvanced IntegrationNextConvenience Fee Integration

Last updated 4 years ago

Was this helpful?

For details on static and dynamic hashes check .

Passing static hashes

For passing static hashes during integration, use below code:

paymentParam.additionalParam[HashConstant.paymentRelatedDetailForMobileSDK] = <#T##String#>
paymentParam.additionalParam[HashConstant.vasForMobileSDK] = <#T##String#>
paymentParam.additionalParam[HashConstant.getEmiAmountAccordingToInterest] = <#T##String#>
paymentParam.additionalParam[HashConstant.eligibleBinsForEMI] = <#T##String#>
paymentParam.additionalParam[HashConstant.deleteUserCard] = <#T##String#>
paymentParam.additionalParam[HashConstant.payment] = <#T##String#>
    paymentParam.additionalParam = [[NSDictionary alloc] initWithObjectsAndKeys:
                                    <#(NSString)#>, HashConstant.paymentRelatedDetailForMobileSDK,
                                    <#(NSString)#>, HashConstant.vasForMobileSDK,
                                    <#(NSString)#>, HashConstant.getEmiAmountAccordingToInterest,
                                    <#(NSString)#>, HashConstant.eligibleBinsForEMI,
                                    <#(NSString)#>, HashConstant.deleteUserCard,
                                    <#(NSString)#>, HashConstant.payment,
                                    nil];

Passing dynamic hashes

For passing dynamic hashes, merchant will receive a call on the method generateHash of PayUCheckoutProListener.

In the method parameter you will receive a dictionary or hashMap, extract the value of hashString from that. Pass that value to server, now server will append salt at the end and generate sha512 hash over it. Server will give that hash back to your app and app will give that hash to us via callback mechanism.

For passing dynamic hashes during integration, use below code:

/// Use this function to provide hashes
/// - Parameters:
///   - param: Dictionary that contains key as HashConstant.hashName & HashConstant.hashString
///   - onCompletion: Once you fetch the hash from server, pass that hash with key as param[HashConstant.hashName]
func generateHash(for param: DictOfString, onCompletion: @escaping PayUHashGenerationCompletion) {
    // Send this string to your backend and append the salt at the end and send the sha512 back to us, do not calculate the hash at your client side, for security is reasons, hash has to be calculated at the server side
    let hashStringWithoutSalt = param[HashConstant.hashString] ?? ""
    // Or you can send below string hashName to your backend and send the sha512 back to us, do not calculate the hash at your client side, for security is reasons, hash has to be calculated at the server side
    let hashName = param[HashConstant.hashName] ?? ""

    // Set the hash in below string which is fetched from your server
    let hashFetchedFromServer = <#T##String#>
    
    onCompletion([hashName : hashFetchedFromServer])
}
/// Use this function to provide hashes
/// @param param NSDictionary that contains key as HashConstant.hashName & HashConstant.hashString
/// @param onCompletion Once you fetch the hash from server, pass that hash with key as param[HashConstant.hashName]
- (void)generateHashFor:(NSDictionary<NSString *, NSString *> * _Nonnull)param onCompletion:(void (^ _Nonnull)(NSDictionary<NSString *, NSString *> * _Nonnull))onCompletion {
    // Send below string hashStringWithoutSalt to your backend and append the salt at the end and send the sha512 back to us, do not calculate the hash at your client side, for security is reasons, hash has to be calculated at the server side
    NSString *hashStringWithoutSalt = [param objectForKey:HashConstant.hashString];
    // Or you can send below string hashName to your backend and send the sha512 back to us, do not calculate the hash at your client side, for security is reasons, hash has to be calculated at the server side
    NSString * hashName = [param objectForKey:HashConstant.hashName];
    
    // Set the hash in below string which is fetched from your server
    NSString *hashFetchedFromServer = <#(NSString)#>;
    
    NSDictionary *hashResponseDict = [NSDictionary dictionaryWithObjectsAndKeys:hashFetchedFromServer, hashName, nil];
    onCompletion(hashResponseDict);
}

Here,

param -> Dictionary that contains key as HashConstant.hashName & HashConstant.hashString

onCompletion -> Once you fetch the hash from server, pass that hash with key as param[HashConstant.hashName]

Getting Hash Data to calculate hash

Checkout Pro SDK will give a callback in generateHash() method whenever any hash is needed by it. Merchant need to calculate that hash and pass back to the SDK. Below is the process of doing so:

To extract hash string and hash name from dictionary received in generateHash() method, use below keys -

HashConstant.hashString -> This will contain complete hash string excluding salt. Merchant can append their salt at end of hash string to calculate the hash.

HashConstant.hashName -> This will contain hash name.

Passing generated hash to SDK

Prepare a dictionary, where key should be param[HashConstant.hashName] and value should be generated hash value and pass this dictionary in onCompletion() .

here