Paytm Integration in Android App: https://developer.paytm.com/docs/v1/android-sdk
Server side integration
https://github.com/Paytm-Payments
Create a developer account here:
https://developer.paytm.com/
Get api key from your account (There are Test api detail and production api detail)
https://dashboard.paytm.com/next/apikeys
Below is for during implementation......Android
1. Dependency
dependencies {
compile('com.paytm:pgplussdk:1.2.3') {
transitive = true;
}
}
2. Permissions
<uses-permission android:name="android.permission.INTERNET"/>
<uses-permission android:name="android.permission.ACCESS_NETWORK_STATE"/>
<uses-permission android:name="android.permission.READ_SMS"/>
<uses-permission android:name="android.permission.RECEIVE_SMS"/>
3. Service
For Staging environment:
PaytmPGService service = PaytmPGService.getStagingService();
For Production environment:
PaytmPGService service = PaytmPGService.getProductionService();
4. Order
Note:- before call below code you have to call api to your server for get checksum.
(https://github.com/Paytm-Payments/Paytm_App_Checksum_Kit_PHP)
// First Get Checksum from Server for security purpose & pass that checksum to paytm params
// Checksum Generating code kit is available on GitHub for all server-side languages (like php, java etc.)
Map<String, String> paramMap = new HashMap<String,String>();
paramMap.put( "MID" , "rxazcv89315285244163"); // Key in your staging and production MID available in your dashboard
paramMap.put( "ORDER_ID" , "order1");
paramMap.put( "CUST_ID" , "cust123");
paramMap.put( "MOBILE_NO" , "7777777777");
paramMap.put( "EMAIL" , "username@emailprovider.com");
paramMap.put( "CHANNEL_ID" , "WAP");
paramMap.put( "TXN_AMOUNT" , "100.12");
paramMap.put( "WEBSITE" , "WEBSTAGING"); // This is the staging value. Production value is available in your dashboard
paramMap.put( "INDUSTRY_TYPE_ID" , "Retail"); // This is the staging value. Production value is available in your dashboard
paramMap.put( "CALLBACK_URL", "https://securegw-stage.paytm.in/theia/paytmCallback?ORDER_ID=order1");
paramMap.put( "CHECKSUMHASH" , "w2QDRMgp1234567JEAPCIOmNgQvsi+BhpqijfM9KvFfRiPmGSt3Ddzw+oTaGCLneJwxFFq5mqTMwJXdQE2EzK4px2xruDqKZjHupz9yXev4=")
PaytmOrder Order = new PaytmOrder(paramMap);
5. Certificate (optional)
Certificate object stores client-side SSL certificate related information and ensures secured handshake between your app and Paytm. Use this code snippet to create a certificate object:
PaytmClientCertificate Certificate = new PaytmClientCertificate(String inPassword, String inFileName);
// inPassword is the password for client side certificate
//inFileName is the file name of client side certificate
Note:
Client certificate must be present in “raw” folder
Pass filename without extension. For e.g if filename is “clientCert.cert” then pass only “clientCert”.
Parameters required to invoke the initialize method are Order and Certificate objects:
service.initialize(Order, Certificate);
In case you do not wish to pass the certificate, pass NULL:
service.initialize(Order, null);
6. Initiate Payment
Service.startPaymentTransaction(this, true, true, new PaytmPaymentTransactionCallback() {
/*Call Backs*/
public void someUIErrorOccurred(String inErrorMessage) {}
public void onTransactionResponse(Bundle inResponse) {}
public void networkNotAvailable() {}
public void clientAuthenticationFailed(String inErrorMessage) {}
public void onErrorLoadingWebPage(int iniErrorCode, String inErrorMessage, String inFailingUrl) {}
public void onBackPressedCancelTransaction() {}
public void onTransactionCancel(String inErrorMessage, Bundle inResponse) {}
});