Paypal ios SDK即使在呼叫[PayPalmMobile clearAllUserData]后也不清算以前使用的信用卡
我正在将Paypal ios SDK 2.1版集成到我的应用程序中,但遇到了问题。 SDK似乎将过去的支付卡保存在内存中,即使我在支付完成后调用Paypal ios SDK即使在呼叫[PayPalmMobile clearAllUserData]后也不清算以前使用的信用卡,ios,paypal,card.io,Ios,Paypal,Card.io,我正在将Paypal ios SDK 2.1版集成到我的应用程序中,但遇到了问题。 SDK似乎将过去的支付卡保存在内存中,即使我在支付完成后调用[PayPalmMobile clearAllUserData] @interface AirliftCartViewController : AirliftViewController <AVCaptureMetadataOutputObjectsDelegate, UITableViewDelegate, AirliftCartTotalsCh
[PayPalmMobile clearAllUserData]
@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
界面AirliftCartViewController:AirliftViewController
@属性(强)AVCaptureSession*captureSession;
@属性(强、非原子)UIView*cameraPreview;
@属性(非原子、强、读写)PayPalConfiguration*PayPalConfiguration;
-(iAction)initiateCreditCardCheckout:(id)发件人;
@结束
...
@气举控制器的实现
-(id)initWithNibName:(NSString*)nibNameOrNil bundle:(NSBundle*)nibBundleOrNil timeout:(NSInteger)timeoutInSeconds屏幕名:(NSString*)屏幕名
{
self=[super initWithNibName:nibNameOrNil bundle:nibBundleOrNil timeout:timeoutingseconds屏幕名:@“AirliftCartView”];
如果(自我){
//自定义初始化
self.payPalConfiguration=[[payPalConfiguration alloc]init];
self.payPalConfiguration.rememberUser=NO;
}
回归自我;
}
-(无效)PayPalmPaymentDidCancel:(PayPalmPaymentViewController*)paymentViewController
{
NSLog(@“付款已取消!”);
//付款已取消;请解除PayPalmPaymentViewController。
[paymentViewController解除ViewController激活:是完成:^{
//清除所有贝宝用户信息
[PayPalMobile clearAllUserData];
}];
}
-(无效)PayPalmPaymentViewController:(PayPalmPaymentViewController*)paymentViewController未完成支付:(PayPalmPayment*)已完成支付
{
NSLog(“付款成功”);
//付款已成功处理;发送到服务器进行验证和履行。
[自我验证已完成付款:已完成付款];
//关闭PayPalPaymentViewController。
[paymentViewController解除ViewController激活:是完成:^{
//清除所有贝宝用户信息
[PayPalMobile clearAllUserData];
//空零件
[self.cartycart];
//重置元数据
[self.metaDataFound removeAllObjects];
}
-(iAction)initiateCheckout:(id)发送方{
NSLog(@“已请求签出!”);
[PayPalmMobile与环境预连接:PayPalenEnvironment沙盒];
//当前贝宝支付
PayPalPaymentViewController*payPalVC=[[PayPalPaymentViewController alloc]
initWithPayment:[self.cartController getPayPalPaymentFromCart]
配置:self.paypal配置委托:self];
[自我呈现视图控制器:payPalVC动画:是完成:^{
[self.captureSession停止运行];
[self.cameraPreview removeFromSuperview];
}];
}
@结束
我是这样展示PayPalPaymentViewController的(所以我看不出有什么有力的参考)
我的应用程序保留任何卡片信息是不可接受的,有人有什么想法吗
编辑:根据请求添加用户步骤:
- 用户选择要购买的产品,然后单击签出按钮,该按钮的操作为initiateCheckout
- 这将打开PayPalmPaymentViewCpController,它显示以前使用的卡作为唯一的支付选项(我第一次启动控制器时,它提供了登录paypal或使用卡的选择)
captureSession
和cameraPreview
添加属性声明,并扩展init
定义
编辑3:添加屏幕截图
这里是PayPal的Dave
有几个问题:
(1) 您的captureSession
和cameraPreview
怎么了
(2) 您能否从用户的角度提供一系列重现您的问题的具体步骤
(3) SDK将卡数据保存在内存中的指示是什么
(4) 你正在运行哪个版本的SDK?我猜它是最新的版本,2.1.5还是2.1.6
*编辑(2014年8月1日):最初描述的错误已在我们的系统中修复。*您也可以在PayPalConfiguration中设置remeberUser=NO,这样SDK甚至不会尝试保存任何内容。嗨,Dave,回答您的问题:(1)captureSession是我用于条形码扫描的AVCaptureSession。Camerapreview是与该会话相关联的预览层视图。(2)我编辑了我的问题,以包括步骤(3)当我在InitiateChecko中显示paymentviewcontroller时,以前使用的卡显示在第一个屏幕上,如果您愿意,我可以截屏。(4)标题上写着2.1,几个月前我复制了这个库。谢谢你的帮助!@SandeepPhadke谢谢!这看起来确实像SDK中的一个bug。我们可能会在几天内得到一个带有修复的更新版本。@SandeepPhadke跟进了@Romk1n的评论……尽管
clearAllUserData
中有一个bug,我会修复它ng,在我的测试中,设置payPalConfiguration。rememberUser
到NO
确实可以消除问题。您是否可以再次检查您的流程以确认payPalConfiguration。rememberUser
在创建和显示PayPalmPaymentViewController
时仍然是NO
?如果是,则不需要调用clearAllUserData
。另外,请下载并使用SDK的当前版本。标题应显示2.1.6
作为版本号。好的,我将升级SDK并查看,现在我在class init函数中调用payPalConfiguration.MemberRuser=NO
,也许我应该将其移动到viewDidLoad
并查看这是否会影响我在viewcontroller的init中将RememberRuser设置为NO的行为。