我正在将 Paypal ios SDK 版本 2.1 集成到我的应用程序中,但遇到了问题。
即使我在付款完成后调用 [PayPalMobile clearAllUserData]
,SDK 似乎仍将过去的支付卡保存在内存中。
@interface AirliftCartViewController : AirliftViewController <AVCaptureMetadataOutputObjectsDelegate, UITableViewDelegate, AirliftCartTotalsChangeDelegate, PayPalPaymentDelegate>
@property (strong) AVCaptureSession * captureSession;
@property (strong, nonatomic) UIView *cameraPreview;
@property (nonatomic, strong, readwrite) PayPalConfiguration *payPalConfiguration;
- (IBAction)initiateCreditCardCheckout:(id)sender;
@end
...
@implementation AirliftCartViewController
- (id)initWithNibName:(NSString *)nibNameOrNil bundle:(NSBundle *)nibBundleOrNil timeout:(NSUInteger)timeoutInSeconds screenName:(NSString *)screenName
{
self = [super initWithNibName:nibNameOrNil bundle:nibBundleOrNil timeout:timeoutInSeconds screenName:@"AirliftCartView"];
if (self) {
// Custom initialization
self.payPalConfiguration = [[PayPalConfiguration alloc] init];
self.payPalConfiguration.rememberUser = NO;
}
return self;
}
- (void)payPalPaymentDidCancel:(PayPalPaymentViewController *)paymentViewController
{
NSLog(@"payment cancelled!");
// The payment was canceled; dismiss the PayPalPaymentViewController.
[paymentViewController dismissViewControllerAnimated:YES completion:^{
// clear all paypal user information
[PayPalMobile clearAllUserData];
}];
}
- (void)payPalPaymentViewController:(PayPalPaymentViewController *)paymentViewController didCompletePayment:(PayPalPayment *)completedPayment
{
NSLog(@"Payment was successful");
// Payment was processed successfully; send to server for verification and fulfillment.
[self verifyCompletedPayment:completedPayment];
// Dismiss the PayPalPaymentViewController.
[paymentViewController dismissViewControllerAnimated:YES completion:^{
// clear all paypal user information
[PayPalMobile clearAllUserData];
// emptycart
[self.cartController emptyCart];
// reset metadata
[self.metaDataFound removeAllObjects];
}
- (IBAction)initiateCheckout:(id)sender {
NSLog(@"checkout requested!");
[PayPalMobile preconnectWithEnvironment:PayPalEnvironmentSandbox];
// present paypal payment
PayPalPaymentViewController * payPalVC = [[PayPalPaymentViewController alloc]
initWithPayment:[self.cartController getPayPalPaymentFromCart]
configuration:self.payPalConfiguration delegate:self];
[self presentViewController:payPalVC animated:YES completion:^{
[self.captureSession stopRunning];
[self.cameraPreview removeFromSuperview];
}];
}
@end
我像这样展示 PayPalPaymentViewController(所以我看不出有强烈的引用)
为我的应用程序保留任何卡信息是 Not Acceptable ,有人有什么想法吗?
编辑:按要求添加用户步骤:
- 用户选择要购买的产品,然后点击以 initiateCheckout 作为其 Action 的结账按钮。
- 这会调出 paypalpaymentviewcpntroller,它显示以前使用的卡作为唯一的支付选项(我第一次启动 Controller 时提供了登录 paypal 或使用卡的选择)
编辑 2:为 captureSession
和 cameraPreview
添加了属性声明并扩展了 init
定义
编辑 3:添加了屏幕截图
最佳答案
来自 PayPal 的 Dave。
几个问题:
(1) 您的captureSession
和cameraPreview
发生了什么?
(2) 您能否从用户的角度提供一系列重现您的问题的具体步骤?
(3)SDK在内存中保存卡数据的标志是什么?
(4) 您运行的是哪个版本的 SDK?我猜它是最新版本之一,2.1.5 或 2.1.6?
* 编辑(2014 年 8 月 1 日):最初描述的错误已在我们的 latest release 中修复. *
关于ios - 即使在调用 [PayPalMobile clearAllUserData] 后,Paypal ios SDK 也不会清除以前使用的信用卡,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/24967759/