Sandeep Phadke
Sandeep Phadke

Reputation: 882

Paypal ios SDK not clearing previously used credit cards even after call to [PayPalMobile clearAllUserData]

I'm integrating Paypal ios SDK version 2.1 into my app but have run into a problem. The SDK seems to keep past payment cards in memory even though i call [PayPalMobile clearAllUserData] after the payment has been completed.

@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

I present the PayPalPaymentViewController like this (so there's no strong reference to it that i can tell)

Its not acceptable that any card information is kept retained for my app, any ideas anyone?

Edit: Adding user steps as requested:

Edit 2: Added property declarations for captureSession and cameraPreview and expanded init definition

Edit 3: Added screenshots

initial checkout second checkout

Upvotes: 0

Views: 557

Answers (2)

Dave Goldman
Dave Goldman

Reputation: 2257

Dave from PayPal here.

A few questions:

(1) What's going on with your captureSession and cameraPreview?

(2) Could you please provide a series of specific steps, from the user's perspective, that reproduce your problem?

(3) What is the indication that the SDK is keeping card data in memory?

(4) Which version of the SDK are you running? I'm guessing that it's the one of the most recent versions, 2.1.5 or 2.1.6?

* EDIT (1 August 2014): The originally described bug has been fixed in our latest release. *

Upvotes: 1

Romk1n
Romk1n

Reputation: 401

You can also set remeberUser = NO in PayPalConfiguration https://github.com/paypal/PayPal-iOS-SDK/blob/master/PayPalMobile/PayPalConfiguration.h#L57 so SDK doesn't even try to save anything.

Upvotes: 0

Related Questions