我正在我的项目中进行 PayPal 集成。一切正常,但最后没有生成支付成功方法。我的付款成功代码是:
else if ([response isKindOfClass:[DoExpressCheckoutPaymentResponseDetails class]]) {
DoExpressCheckoutPaymentResponseDetails *dres = (DoExpressCheckoutPaymentResponseDetails *)response;
if (dres.PaymentInfo.count > 0 && ((PaymentInfo *)[dres.PaymentInfo objectAtIndex:0]).TransactionID.length > 0)
{
[self paymentSuccess:((PaymentInfo *)[dres.PaymentInfo objectAtIndex:0]).TransactionID];
}
else
{
NSLog(@"Error came");
[self paymentFailed];
}
}
并且支付成功方式是...
UINavigationController *navController = self.navigationController;
orderResultsViewController.forDelivery = ((ReviewOrderViewController *)[navController.viewControllers objectAtIndex:navController.viewControllers.count - 2]).forDelivery;
orderResultsViewController.transactionID = transactionID;
[navController popViewControllerAnimated:FALSE];
[navController setNavigationBarHidden:FALSE animated:TRUE];
[navController pushViewController:orderResultsViewController animated:TRUE];
如果你明白了,那就给我指明一个方向……
-(void)paymentFailed {
[self.navigationController popViewControllerAnimated:TRUE];
UIAlertView *alert = [[UIAlertView alloc] initWithTitle:@"Order failed"
message:@"Your order failed. Touch \"Pay with PayPal\" to try again."
delegate:nil
cancelButtonTitle:@"OK"
otherButtonTitles:nil];
[alert show];
[alert release];
}
我超出警报视图并且付款订单失败....