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?

- 7,635
- 9
- 44
- 82

- 1,149
- 2
- 15
- 23
-
1along with question post your code here , wil try to update what needs to be done – Shobhakar Tiwari Apr 15 '16 at 17:52
2 Answers
I integrated PayTM sdk into swift application and its working fine .
The issue where i got stuck about 15 days is the URL Generation :
checkSumGenerationURL
and checkSumValidationURL
.
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 .
It works great .
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";
Here is checksumgeneration method in iOS Swift2.2 (app side)
//Call this method createCheckSumString(hashValue)
Where hasValue is the paramater in which you added all your PAYTM parameter , its a string type .
Here is method :
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
}
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.

- 7,862
- 4
- 36
- 71
-
Can we create checksum on iOS side or compulsory create on Merchant server side? – Saumil Shah Jan 12 '17 at 06:13
-
you should create it on server side , i did on iOS side but dint work but in android it works when handling in app side , choice is urs – Shobhakar Tiwari Jan 12 '17 at 06:20
-
Could you assist me "How to generate checksum in iOS side (swift 2.2)?" – Saumil Shah Jan 12 '17 at 07:04
-
1
-
@SaumilShah does it solve your issue then upvote so that other could get help and provide bounty to this question – Shobhakar Tiwari Jan 12 '17 at 08:54
-
-
Let us [continue this discussion in chat](http://chat.stackoverflow.com/rooms/132974/discussion-between-saumil-shah-and-shobhakar-tiwari). – Saumil Shah Jan 12 '17 at 09:14
-
See my above code in step 2 where I am assigning checksum constant string – Shobhakar Tiwari Jan 12 '17 at 09:17
-
-
could you please share the input string format or sample for createCheckSumString anyone? – ssowri1 Jun 16 '20 at 17:07
You can generate checksum from your server only (it is for SDK 2.0 and latest version ). Paytm do provide PHP file (java, python too) for checksum generation that you need to upload on your server. once upload done then change the merchant key - go inside lib folder and update key on config.paytm.php file . You can get reference from here for checksum generation using PHP file and the android code - http://www.blueappsoftware.in/android/blog/paytm-integration-sdk-2-1-android/

- 1,354
- 1
- 16
- 20