flutter-plugin icon indicating copy to clipboard operation
flutter-plugin copied to clipboard

can't decode onApplePayResult dynamic value

Open heshesh2010 opened this issue 3 years ago • 0 comments

Hi , my apple pay button works great and return the token but i just need these values from onApplePayResult :

transactionId,
ephemeralPublicKey,
publicKeyHash,
data,
signature,
version,
transactionIdentifier,
network,
displayName,
type,

i'm using this code

void onApplePayResult(paymentResult) {

if (paymentResult is String) {
  Fluttertoast.showToast(
      msg: "String",
      toastLength: Toast.LENGTH_LONG,
      gravity: ToastGravity.TOP);
}

if (paymentResult is Map) {
  Fluttertoast.showToast(
      msg: "map",
      toastLength: Toast.LENGTH_LONG,
      gravity: ToastGravity.TOP);
}

Map result = jsonDecode(paymentResult); // give me error 


//  String transactionIdentifier = jsonDecode(paymentResult["transactionIdentifier"]);

String network = result['token']['network'];
String displayName = result['token']['displayName'];
String type = result['token']['type'].toString();

String version = result['token']['version'].toString();
String data = result['token']['data'];
String signature = result['token']['signature'];
String ephemeralPublicKey = result['header']['ephemeralPublicKey'];
String publicKeyHash = result['header']['publicKeyHash'];
String transactionId = result['header']['transactionId'].toString();

}

heshesh2010 avatar Oct 26 '22 07:10 heshesh2010