Friday, 7 December 2018

PAYTM SDK Installation and Setup for Android App

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) {}
     });

Monday, 3 December 2018

In-App Purchases - Android Developers


 Use In-app Billing with AIDL / Google Play Billing

1) Create product and configure it in Developer account.
    Need to create a product here Non-sunscription or subscription
    https://medium.com/@KarthikPonnam/inapp-purchase-subscription-android-8fff52fa4d3b

2) Download demo for inapp purchase for Android
Download link: https://drive.google.com/open?id=1-sqg2dBAC7PJTESsMjP1nq9vuyE_6w8m

Note:-
1) Please test in signed apk.
2) change SKU key according to configure in the developer account

Run/install/debug Android applications over Wi-Fi ?

Open Teminal/cmd --------------- Below steps is for Android 10 or lower Step 1 - Connect the device via USB and make sure debugging is work...