我在我的 monodroid 应用程序中使用 PayPal。我使用了本主题中已经分享的库:http ://forums.xamarin.com/discussion/comment/15331/#Comment_15331
但是我PaymentConfirmation
在方法中获取对象时遇到问题OnActivityResult
。这是我的代码:
protected override void OnActivityResult (int requestCode, Result resultCode, Intent data)
{
if (resultCode == Result.Ok ) {
var confirm = data.GetParcelableExtra ("com.paypal.android.sdk.paymentConfirmation") ;
PaymentConfirmation pc = (PaymentConfirmation)confirm;
if (confirm != null) {
try {
//Log.Info ("paymentExample", confirm.ToJSONObject ().ToString (4));
// TODO: send 'confirm' to your server for verification.
// see https://developer.paypal.com/webapps/developer/docs/integration/mobile/verify-mobile-payment/
// for more details.\
} catch (JSONException e) {
Log.Error ("paymentExample", "an extremely unlikely failure occurred: ", e);
}
}
}else if (resultCode == Result.Canceled ) {
Log.Info ("paymentExample", "The user canceled.");
}else {
Log.Info ("paymentExample", "An invalid payment was submitted. Please see the docs.");
}
}
在方法的第三行。编译器无法强制转换为PaymentConfirmation
. 我是否需要任何其他类或代码才能使用数据。GetParcelableExtra
?