我是Android新手 我想知道如何在我的应用程序中集成 ATOM支付网关移动结帐页面?
我想要它以便用户填写他的信用卡详细信息并在线支付。
如果我使用其他支付网关,例如Paytm或Payu,他们会提供SDK,但Atom不会
任何帮助将不胜感激
答案 0 :(得分:5)
根据this,他们没有提供java和/或android SDK。 您仍然可以点击"与我们联系" 按钮(位于网页底部)并直接询问他们是否提供了适用于java / android的SDK。
更新: Android SDK现在由ATOM支付网关提供。点击this即可获得相同的内容。
答案 1 :(得分:4)
更新:Android SDK现在由ATOM支付网关提供。Click this以获取适用于各种平台的SDK。
以前的方法
在付款按钮点击
上调用此asynctaskprivate class StartPayment extends AsyncTask<String, Void, String> {
String Atom2Request;
@Override
protected String doInBackground(String... params) {
SimpleDateFormat sdf = new SimpleDateFormat("dd/MM/yyyy");
String CurrDateTime = sdf.format(new Date()).toString();
vVenderURL = "https://paynetzuat.atomtech.in/paynetz/epi/fts?login=160&pass=Test@123&ttype=NBFundTransfer&prodid=NSE&amt=50&txncurr=INR&txnscamt=0&clientcode=TkFWSU4%3d&txnid=123&date=03/07/2015&custacc=1234567890&udf1=Customer&udf2=rajtufan@gmail.com&udf3=8485835654&udf4=pune&ru=http://example.webservice/response.aspx?";
Log.d("Vvendor URL", vVenderURL);
XMLParser parser = new XMLParser();
String xml = parser.getXmlFromUrl(vVenderURL); // getting XML
Document doc = parser.getXMLElement(xml); // getting DOM element
Log.d("XML URL", xml);
NodeList nList = doc.getElementsByTagName(KEY_RESPONSE);
for (int tempN = 0; tempN < nList.getLength(); tempN++) {
Node nNode = nList.item(tempN);
if (nNode.getNodeType() == Node.ELEMENT_NODE) {
Element eElement = (Element) nNode;
System.out.println("URL : " + eElement.getElementsByTagName("url").item(0).getChildNodes().item(0).getNodeValue());
xmlURL = eElement.getElementsByTagName("url").item(0).getChildNodes().item(0).getNodeValue();
NodeList aList = eElement.getElementsByTagName("param");
String vParamName;
for (int atrCnt = 0; atrCnt < aList.getLength(); atrCnt++) {
vParamName = aList.item(atrCnt).getAttributes().getNamedItem("name").getNodeValue();
System.out.println("<br>paramName : : " + vParamName);
if (vParamName.equals("ttype")) {
xmlttype = aList.item(atrCnt).getChildNodes().item(0).getNodeValue();
} else if (vParamName.equals("tempTxnId")) {
xmltempTxnId = aList.item(atrCnt).getChildNodes().item(0).getNodeValue();
} else if (vParamName.equals("token")) {
xmltoken = aList.item(atrCnt).getChildNodes().item(0).getNodeValue();
} else if (vParamName.equals("txnStage")) {
xmltxnStage = aList.item(atrCnt).getChildNodes().item(0).getNodeValue();
}
}
Log.d("XML URL", xmlURL);
Log.d("XML TRANS TYPE", xmlttype);
Log.d("tempTxnId : ", xmltempTxnId);
Log.d("param : token :", xmltoken);
Log.d("param : txnStage : ", xmltxnStage);
}
}//for
Atom2Request = xmlURL + "?ttype=" + xmlttype + "&tempTxnId=" + xmltempTxnId + "&token=" + xmltoken + "&txnStage=" + xmltxnStage;
Atom2Request = Atom2Request.replace(" ", "%20");
Log.d("ATOM 2nd Request URl", Atom2Request);
return Atom2Request;
}
@Override
protected void onPostExecute(String result) {
if (pDialog != null) {
pDialog.dismiss();
Intent intent = new Intent(Recharge_Activity.this, WebContent.class);
intent.putExtra(KEY_ATOM2REQUEST, result);
startActivityForResult(intent, 3);
}
}
@Override
protected void onPreExecute() {
pDialog.setMessage("Processing Request...");
pDialog.setIndeterminate(false);
pDialog.setCancelable(false);
pDialog.show();
super.onPreExecute();
}
}
当我们从网页得到回复时,我们形成网址并转移到
<强> WebContent.class 强>
import android.app.Activity;
import android.content.Context;
import android.content.Intent;
import android.content.SharedPreferences;
import android.graphics.Bitmap;
import android.os.Bundle;
import android.util.Log;
import android.webkit.JavascriptInterface;
import android.webkit.WebView;
import android.webkit.WebViewClient;
public class WebContent extends Activity {
private static final String TAG = "WebContent";
SharedPreferences sp;
static Context mContext;
public static final String KEY_ATOM2REQUEST = "Atom2Request";
String Atom2Request;
Intent intent;
boolean loadingFinished = true;
boolean redirect = false;
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.webviewrecharge);
// Thread.setDefaultUncaughtExceptionHandler(new ExceptionHandler(this));
mContext = this;
Bundle extras = getIntent().getExtras();
if (extras != null)
Atom2Request = extras.getString(KEY_ATOM2REQUEST);
Log.d("ATOM2Request webview", Atom2Request);
WebView webView = (WebView) findViewById(R.id.webView);
webView.setWebViewClient(new MyWebViewClient());
webView.getSettings().setJavaScriptEnabled(true);
webView.getSettings().setDomStorageEnabled(true);
webView.addJavascriptInterface(new WebAppInterface(this), "Android");
webView.loadUrl(Atom2Request);
}
private class MyWebViewClient extends WebViewClient {
@Override
public boolean shouldOverrideUrlLoading(WebView view, String urlNewString) {
if (!loadingFinished) {
redirect = true;
}
loadingFinished = false;
view.loadUrl(urlNewString);
return true;
}
@Override
public void onPageStarted(WebView view, String url, Bitmap facIcon) {
loadingFinished = false;
//SHOW LOADING IF IT ISNT ALREADY VISIBLE
Log.w(TAG, "Loading");
}
@Override
public void onPageFinished(WebView view, String url) {
if (!redirect) {
loadingFinished = true;
}
if (loadingFinished && !redirect) {
//HIDE LOADING IT HAS FINISHED
Log.w(TAG, "Finish Loading");
} else {
redirect = false;
}
}
}
public class WebAppInterface {
Context mContext;
WebAppInterface(Context c) {
mContext = c;
}
@JavascriptInterface
public void onResponse(String reponseText) {
Intent returnIntent = new Intent();
returnIntent.putExtra("Result", reponseText);
setResult(RESULT_OK, returnIntent);
finish();
}
}
}
// vVendorURl 您需要重定向网址才能从 ATOM 获取请求并将响应发送到 android Mobile
只需将此代码放入重定向网址
即可// reponseText是从ATOM接收到的文本是好还是否
<script type="text/javascript">
function showAndroidToast(reponseText) {
Android.onResponse(reponseText);
}
答案 2 :(得分:2)
Now atom为各种平台提供SDK。您可以从它的网站下载 atomtech
答案 3 :(得分:1)
商家如何与atom在线支付网关集成?
PHP 代码:
1.创建表单
<?php
if ($testmode)
{
$url = ‘http://203.114.240.77/paynetz/epi/fts';// test bed URL
$port = 80;
$atom_prod_id = “NSE”;
}
else
{
$url = ‘https://payment.atomtech.in/paynetz/epi/fts';//live URL
$port = 443;
$atom_prod_id = “ESDS”;
}
// code to generate token
$param = “&login=”.$userid.”&pass=”.$password.”&ttype=NBFundTransfer&prodid=”.$atom_prod_id.”&amt=”.$amount.”&txncurr=INR&txnscamt=0&clientcode=”.$clientcode.”&txnid=”.$invoiceid.”&date=”.$today.”&custacc=12345″;
$ch = curl_init();
curl_setopt($ch, CURLOPT_URL, $url);
curl_setopt($ch, CURLOPT_HEADER, 0);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
curl_setopt($ch, CURLOPT_POST, 1);
curl_setopt($ch, CURLOPT_PORT , $port);
curl_setopt($ch, CURLOPT_SSLVERSION,3);
curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, FALSE);
curl_setopt($ch, CURLOPT_SSL_VERIFYHOST, 2);
curl_setopt($ch, CURLOPT_POSTFIELDS, $param);
$returnData = curl_exec($ch);
// Check if any error occured
if(curl_errno($ch))
{
echo ‘Curl error: ‘ . curl_error($ch);
}
curl_close($ch);
$xmlObj = new SimpleXMLElement($returnData);
$final_url = $xmlObj->MERCHANT->RESPONSE->url;
// eof code to generate token
// code to generate form action
$param = “”;
$param .= “&ttype=NBFundTransfer”;
$param .= “&tempTxnId=”.$xmlObj->MERCHANT->RESPONSE->param[1];
$param .= “&token=”.$xmlObj->MERCHANT->RESPONSE->param[2];
$param .= “&txnStage=1″;
$url = $url.”?”.$param;
// eof code to generate form action
?>
<form action='<?php echo $url?>’ method=’post’>
<input type=’submit’ value=’Pay Now’ name=’btn_pay’ />
</form>
步骤2.处理响应
<?php
// log post data
$orgipn = ”;
foreach ($_POST as $key => $value)
{
$orgipn .= (” . $key . ‘ => ‘ . $value . ‘
‘);
}
// eof log post data
if($_POST[‘f_code’]==”Ok”) // atom status
{
$invoiceid = $_POST[‘mer_txn’];
$amount = $_POST[‘amt’];
$transid = $_POST[‘mmp_txn’];
// add your transaction
}
?>
有可用的扩展程序以及codes可用的免费扩展程序。
希望这有用!