MCP Integration


Follow below integration steps if integrating Multi-Currency Payments(MCP)


Kindly connect with your Key Account Manager at PayU to get the below credentials -

  1. Merchant Access Key

  2. Merchant Secret Key

Pass Merchant Access Key

Pass Merchant Access Key in Additional Params in Payment Params as mentioned here.

paymentParam.additionalParam[PaymentParamConstant.merchantAccessKey] = <Merchant-Access-Key>       

Generate Hash For MCP

For MCP payments, SDK requires Lookup API Hash which is a Dynamic Hash. SDK will call generateHash() method as explained here

Lookup API Hash is calculated with the HmacSHA1 signature. It requires a Merchant Secret key in calculating the hash. Below example, code demonstrates the calculation of Lookup API Hash.

func generateHash(for param: DictOfString, onCompletion: @escaping PayUHashGenerationCompletion) {
        let commandName = (param[HashConstant.hashName] ?? "")
        let hashStringWithoutSalt = (param[HashConstant.hashString] ?? "")
        // get hash for "commandName" from server
        // After fetching hash set its value in below variable "hashValue"
        var hashValue = ""
        if commandName == HashConstant.mcpLookup {
        //To create HMACSHA1 Signature 
        // Signature = HMAC-SHA1(data, key);
        //Data = hashStringWithoutSalt
        //Key = Mechent Secret Key shared with the merchant at the time of on-boarding 
            hashValue = <HMACSHA1 signature from your server>
        } else {
            hashValue = <HMACSHA512 hash from your server>
        onCompletion([commandName : hashValue])

Last updated