0

我正在将 Paypal ios SDK 2.1 版集成到我的应用程序中,但遇到了问题。SDK似乎将过去的支付卡保存在内存中,即使我[PayPalMobile 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

我像这样展示 PayPalPaymentViewController (所以我可以告诉它没有强烈的参考)

为我的应用程序保留任何卡信息是不可接受的,有人有什么想法吗?

编辑:根据要求添加用户步骤:

  • 用户选择要购买的产品,然后单击以initialCheckout 作为其操作的结帐按钮。
  • 这会打开 paypalpaymentviewcpntroller,它显示以前使用的卡作为唯一的支付选项(我第一次启动控制器时提供了登录贝宝或使用卡的选择)

编辑 2:为和扩展定义添加captureSessioncameraPreview属性init声明

编辑 3:添加截图

初始结帐 第二次结帐

4

2 回答 2

1

来自贝宝的戴夫在这里。

几个问题:

(1) 你的captureSessionand怎么了cameraPreview

(2) 您能否从用户的角度提供一系列具体步骤来重现您的问题?

(3) SDK 将卡片数据保存在内存中的指示是什么?

(4) 你运行的是哪个版本的SDK?我猜它是最新版本之一,2.1.5 还是 2.1.6?

* 编辑(2014 年 8 月 1 日):最初描述的错误已在我们的最新版本中修复。*

于 2014-07-26T08:23:07.183 回答
0

您还可以在 PayPalConfiguration https://github.com/paypal/PayPal-iOS-SDK/blob/master/PayPalMobile/PayPalConfiguration.h#L57中设置 remeberUser = NO,因此 SDK 甚至不会尝试保存任何内容。

于 2014-07-26T16:35:47.513 回答