问题描述
我想paytm钱包在我的Android应用程序集成。我发现很多关于谷歌文件及资料,但没有得到任何东西。是否有任何文件,code样品,你知道的请告诉我。先谢谢了。
I want to integrate paytm wallet in my android application. I find lots of documentations on google but didn't get anything. Is there any documentation, code sample that you know please inform me. Thanks in advance.
推荐答案
转到链接:
和下载Android + SDK
and download Android+SDK
下面放code。在您的函数或要开始paytm的东西。
put below code in your function or where you want to start paytm stuff.
private int randomInt = 0;
private PaytmPGService Service = null;
Random randomGenerator = new Random();
randomInt = randomGenerator.nextInt(1000);
//for testing environment
Service = PaytmPGService.getStagingService();
//for production environment
/*Service = PaytmPGService.getProductionService();*/
/*PaytmMerchant constructor takes two parameters
1) Checksum generation url
2) Checksum verification url
Merchant should replace the below values with his values*/
PaytmMerchant Merchant = new PaytmMerchant("https://pguat.paytm.com/merchant-chksum/ChecksumGenerator","https://pguat.paytm.com/merchant-chksum/ValidateChksum");
//below parameter map is required to construct PaytmOrder object, Merchant should replace below map values with his own values
Map<String, String> paramMap = new HashMap<String, String>();
//these are mandatory parameters
paramMap.put("REQUEST_TYPE", "DEFAULT");
paramMap.put("ORDER_ID", String.valueOf(randomInt));
//MID provided by paytm
paramMap.put("MID", "id provided by paytm");
paramMap.put("CUST_ID", "CUST123");
paramMap.put("CHANNEL_ID", "WAP");
paramMap.put("INDUSTRY_TYPE_ID", "Retail");
paramMap.put("WEBSITE", "paytm");
paramMap.put("TXN_AMOUNT", "1");
paramMap.put("THEME", "merchant");
PaytmOrder Order = new PaytmOrder(paramMap);
Service.initialize(Order, Merchant,null);
Service.startPaymentTransaction(activity, false, false, new PaytmPaymentTransactionCallback() {
@Override
public void onTransactionSuccess(Bundle bundle) {
app.getLogger().error("Transaction Success :" + bundle);
}
@Override
public void onTransactionFailure(String s, Bundle bundle) {
app.getLogger().error("Transaction Failure :" + s + "\n" + bundle);
}
@Override
public void networkNotAvailable() {
app.getLogger().error("network unavailable :");
}
@Override
public void clientAuthenticationFailed(String s) {
app.getLogger().error("clientAuthenticationFailed :" + s);
}
@Override
public void someUIErrorOccurred(String s) {
app.getLogger().error("someUIErrorOccurred :" + s);
}
@Override
public void onErrorLoadingWebPage(int i, String s, String s2) {
app.getLogger().error("errorLoadingWebPage :" + i + "\n" + s + "\n" + s2);
}
});
}
还有另一件事是,你需要在AndroidManifest.xml文件中声明了一个活动:
Also another thing is you need to declare one activity in AndroidManifest.xml file:
<activity
android:name="com.paytm.pgsdk.PaytmPGActivity"
android:theme="@style/AppTheme"
android:screenOrientation="portrait"
android:windowSoftInputMode="stateHidden"/>
希望以上code样本将帮助ü很多。还有另外一件事是,当你下载的Android + SDK,你会得到你需要在你的项目和MainActivity.java类文件供我们参考添加一个jar文件pgsdk.jar文件。享受!
Hope above code sample will help u lot.Also another thing is when you download Android+SDK you will get one jar file pgsdk.jar file that you need to add in your project and MainActivity.java class file for our reference. Enjoy!!!
注:ChecksumGenerator和ValidateChksum的网址是只是测试它是由paytm开发支持团队提供目的
Note: ChecksumGenerator and ValidateChksum urls are for just testing purpose which is provided by paytm development support team
这篇关于如何paytm钱包在Android应用程序集成?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!