Hi In my App I have Integrated Paytm Wallet and I'm getting the response as a JSON Bundle object type. Now I need to get the details from that JSON like ORDERID,TXNAMNT etc., Is there any method to parse JSON bundle or should I convert into JSON object and then parse it?
Below is my response from paytm in JSON format.
Merchant Response is {"MID":"SAMPLE09557238310462","ORDERID":"ORDER20000995","TXNAMOUNT":"171.75","CURRENCY":"INR","TXNID":"612917","BANKTXNID":"154301","STATUS":"TXN_SUCCESS","RESPCODE":"01","RESPMSG":"Txn Successful.","TXNDATE":"2016-03-02 16:38:12.0","GATEWAYNAME":"WALLET","BANKNAME":"","PAYMENTMODE":"PPI","IS_CHECKSUM_VALID":"Y"}
This is what I have tried.
public void onTransactionSuccess(Bundle inResponse) {
// After successful transaction this method gets called.
// // Response bundle contains the merchant response
// parameters.
Log.d("LOG", "Payment Transaction is successful " + inResponse);
Toast.makeText(getApplicationContext(), "Payment Transaction is successful", Toast.LENGTH_LONG).show();
try {
JSONObject json = new JSONObject( inResponse.getString("") );
JSONObject json2 = json.getJSONObject("");
String name1 = (String) json2.get("ORDERID");
Toast.makeText(getApplicationContext(), ""+name1, Toast.LENGTH_LONG).show();
} catch (JSONException e) {
e.printStackTrace();
}
}