如何生成“checksumGenerationURL”和“checksumValidationURL”在iOS PayTm集成? [英] How to generate "checksumGenerationURL" and "checksumValidationURL" in iOS PayTm integration?

查看:104
本文介绍了如何生成“checksumGenerationURL”和“checksumValidationURL”在iOS PayTm集成?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我想在我的应用中集成Paytm SDK 。我有 MerchantId和商家密钥
但我没有那些网址。如何生成这些URL?

I want to integrate Paytm SDK in my app. I have MerchantId and Merchant key. But i don't have those Urls. How to generate those URLS?

推荐答案

我将PayTM sdk集成到swift应用程序中并且工作正常。

I integrated PayTM sdk into swift application and its working fine .

我被困15天的问题是网址生成:

The issue where i got stuck about 15 days is the URL Generation :

checkSumGenerationURL checkSumValidationURL

之前我使用的是PayTM提供的网址,但由于这个原因每次尝试付款都会失败。

Earlier i was using PayTM provided url but due to this it gets failed every time trying to payment .

所以这是最终解决方案:
我和我的服务器团队坐在一起,然后决定在我们自己的服务器上处理它,然后尝试它。

so here is the final solution : I sit with my server team and then decided to handle it in our own server then after try it .

效果很好。

So here is final set of parameters you need to pass : 
//Step 1: Create a default merchant config object
    PGMerchantConfiguration *mc = [PGMerchantConfiguration defaultConfiguration];

    //Step 2: If you have your own checksum generation and validation url set this here. Otherwise use the default Paytm urls
    mc.checksumGenerationURL = @"generate checksum url by handling in own server";
    mc.checksumValidationURL =   @"generate checksum url by handling in own server";


    //Step 3: Create the order with whatever params you want to add. But make sure that you include the merchant mandatory params
    NSMutableDictionary *orderDict = [NSMutableDictionary new];
    //Merchant configuration in the order object
    orderDict[@"MID"] = @"abc1111"; 
    orderDict[@"CHANNEL_ID"] = @"WAP";
    orderDict[@"INDUSTRY_TYPE_ID"] = @"Education";
    orderDict[@"WEBSITE"] = @"companyname";
    //Order configuration in the order object
    orderDict[@"TXN_AMOUNT"] = @"100";
    orderDict[@"ORDER_ID"] = [Feepayment generateOrderIDWithPrefix:@"111"];
    orderDict[@"REQUEST_TYPE"] = @"DEFAULT";
    orderDict[@"CUST_ID"] = @"abc7777";

这是iOS Swift2.2中的校验和生成方法(应用程序端)

Here is checksumgeneration method in iOS Swift2.2 (app side)

//调用此方法
createCheckSumString(hashValue)

//Call this method createCheckSumString(hashValue)

其中hasValue是你在其中添加了所有PAYTM参数的参数,其中字符串类型。

Where hasValue is the paramater in which you added all your PAYTM parameter , its a string type .

这是方法:

func createCheckSumString(input: String) -> String {
    let cstr = input.cStringUsingEncoding(NSUTF8StringEncoding)
    var data = NSData(bytes: cstr, length: input.length)
    var digest = [UInt8](count: CC_SHA512_DIGEST_LENGTH, repeatedValue: 0)
    // This is an iOS5-specific method.
    // It takes in the data, how much data, and then output format, which in this case is an int array.
    CC_SHA512(data.bytes, Int(data.length), digest)
    var output = String(capacity: CC_SHA512_DIGEST_LENGTH * 2)
    // Parse through the CC_SHA256 results (stored inside of digest[]).
    for i in 0..<CC_SHA512_DIGEST_LENGTH {
        output += String(format: "%02x", digest[i])
    }
    return output
}

注意 - 导入CommonDigest(在目标c中我们这样添加 #include< CommonCrypto / CommonDigest.h> 以便 CC_SHA512_DIGEST_LENGTH 工作
随意分享评论。

NOTE- import CommonDigest ( In objective c this way we add so #include <CommonCrypto/CommonDigest.h> so that CC_SHA512_DIGEST_LENGTH works Feel free to share comments.

这篇关于如何生成“checksumGenerationURL”和“checksumValidationURL”在iOS PayTm集成?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆