I am trying to integrate paytm in my app. Where I am trying to pull signature and orderid
from the server in JSON format. But I am getting the below error.
Error:
W/xample.dctrade(20336): Accessing hidden method Lsun/misc/Unsafe;->getInt(Ljava/lang/Object;J)I (greylist, linking, allowed)
E/flutter (20336): [ERROR:flutter/lib/ui/ui_dart_state.cc(186)] Unhandled Exception: FormatException: Unexpected character (at character 2)
E/flutter (20336): {signature: sTknIJpTHoZLxyQhCO9UgXNz5lKcsOs5/jOKHDwWpCXHdK46Aa4pBUslC8YmwtV...
E/flutter (20336): ^
E/flutter (20336):
Here's the code:
Future<GetToken> gettoken() async{
final String url = "https://dcgroupofcompany.com/payment/payment.php";
Map<String, String> headers = {
'Content-Type': 'application/json;charset=UTF-8',
'Charset': 'utf-8'};
final response = await http.get(Uri.parse(url),headers: headers);
Map<String, dynamic> map = json.decode(response.body);
String token = map.toString();
return getTokenFromJson(token);
}
Future<void> startTransaction() async{
final GetToken _token = await gettoken();
String orderId = _token.orderid.toString();
String txntokens = _token.signature.toString();
String callbackUrl = "https://securegw-stage.paytm.in/theia/api/v1/initiateTransaction?mid="+mid+"&orderId="+orderId;
print(orderId);
}
JSON:
{
"signature": "pvuSBnN6l\/DapUvaYqL+5MTjxEpAolky1bNSf08cScQMPd5INfYH3xVTNCDnyEY\/Yb8qxEE4J6M1nxXoaVusFl+6bEo\/v8xfO1+eifipN74=",
"orderid": "DCTR150308020208"
}
Does any one know how to solve the problem?