【问题标题】:PayPal iOS SDK 2.0.5 is not authenticating email id and password correctlyPayPal iOS SDK 2.0.5 未正确验证电子邮件 ID 和密码
【发布时间】:2014-06-01 09:19:42
【问题描述】:

大家好,我是这个专业网站的新手。实际上,我在 PayPal iOS SDK 2.0.5 中遇到了问题。这个 sdk 是从 github 下载的,现在当我尝试登录 paypal 时,它没有进行身份验证 谁能告诉为什么会发生这种情况,并且付款也没有从个人帐户转移到企业帐户中 谢谢 请帮帮我

这是链接 https://github.com/paypal/PayPal-iOS-SDK/archive/master.zip

    #define kPayPalEnvironment PayPalEnvironmentNoNetwork

       @interface ZZMainViewController ()

       @property(nonatomic, strong, readwrite) IBOutlet UIButton *payNowButton;
       @property(nonatomic, strong, readwrite) IBOutlet UIButton *payFutureButton;
       @property(nonatomic, strong, readwrite) IBOutlet UIView *successView;

       @property(nonatomic, strong, readwrite) PayPalConfiguration *payPalConfig;

       @end

       @implementation ZZMainViewController

       - (void)viewDidLoad {
      [super viewDidLoad];
      self.title = @"PayPal SDK Demo";

      // Set up payPalConfig
     _payPalConfig = [[PayPalConfiguration alloc] init];
     _payPalConfig.acceptCreditCards = YES;
     _payPalConfig.languageOrLocale = @"en";
     _payPalConfig.merchantName = @"Awesome Shirts, Inc.";
     _payPalConfig.merchantPrivacyPolicyURL = [NSURL    URLWithString:@"https://www.paypal.com/webapps/mpp/ua/privacy-full"];
     _payPalConfig.merchantUserAgreementURL = [NSURL URLWithString:@"https://www.paypal.com/webapps/mpp/ua/useragreement-full"];

    // Setting the languageOrLocale property is optional.
    //
    // If you do not set languageOrLocale, then the PayPalPaymentViewController will present
    // its user interface according to the device's current language setting.
    //
    // Setting languageOrLocale to a particular language (e.g., @"es" for Spanish) or
    // locale (e.g., @"es_MX" for Mexican Spanish) forces the PayPalPaymentViewController
    // to use that language/locale.
     //
          // For full details, including a list of available languages and locales, see   PayPalPaymentViewController.h.

        _payPalConfig.languageOrLocale = [NSLocale preferredLanguages][0];

        // Do any additional setup after loading the view, typically from a nib.

        self.successView.hidden = YES;

        // use default environment, should be Production in real life
        self.environment = kPayPalEnvironment;

        NSLog(@"PayPal iOS SDK version: %@", [PayPalMobile libraryVersion]);

     }

     - (void)viewWillAppear:(BOOL)animated {
        [super viewWillAppear:YES];

        // Preconnect to PayPal early
        [PayPalMobile preconnectWithEnvironment:self.environment];
    }

     #pragma mark - Receive Single Payment

    - (IBAction)pay {
     // Remove our last completed payment, just for demo purposes.
     self.resultText = nil;

    PayPalPayment *payment = [[PayPalPayment alloc] init];
    payment.amount = [[NSDecimalNumber alloc] initWithString:@"9.95"];
    payment.currencyCode = @"USD";
    payment.shortDescription = @"Hipster t-shirt";

     if (!payment.processable) {
    // This particular payment will always be processable. If, for
    // example, the amount was negative or the shortDescription was
    // empty, this payment wouldn't be processable, and you'd want
    // to handle that here.
    }

      // Update payPalConfig re accepting credit cards.
      self.payPalConfig.acceptCreditCards = self.acceptCreditCards;

       PayPalPaymentViewController *paymentViewController = [[PayPalPaymentViewController alloc] initWithPayment:payment
                                                                                                  configuration:self.payPalConfig
                                                                                                        delegate:self];
  [self presentViewController:paymentViewController animated:YES completion:nil];
   }



      - (void)payPalPaymentViewController:(PayPalPaymentViewController *)paymentViewController didCompletePayment:(PayPalPayment *)completedPayment {
       NSLog(@"PayPal Payment Success!");
       self.resultText = [completedPayment description];
       [self showSuccess];

        [self sendCompletedPaymentToServer:completedPayment]; // Payment was processed    successfully; send to server for verification and fulfillment
  [self dismissViewControllerAnimated:YES completion:nil];
   }

      - (void)payPalPaymentDidCancel:(PayPalPaymentViewController *)paymentViewController {
       NSLog(@"PayPal Payment Canceled");
       self.resultText = nil;
        self.successView.hidden = YES;
        [self dismissViewControllerAnimated:YES completion:nil];
   }

      #pragma mark Proof of payment validation

     - (void)sendCompletedPaymentToServer:(PayPalPayment *)completedPayment {
      // TODO: Send completedPayment.confirmation to server
         NSLog(@"Here is your proof of payment:\n\n%@\n\nSend this to your server for c  onfirmation   and fulfillment.", completedPayment.confirmation);
       }


      #pragma mark - Authorize Future Payments

      - (IBAction)getUserAuthorization:(id)sender {

          PayPalFuturePaymentViewController *futurePaymentViewController =      [[PayPalFuturePaymentViewController alloc] initWithConfiguration:self.payPalConfig delegate:self];
      [self presentViewController:futurePaymentViewController animated:YES completion:nil];
      }


      #pragma mark PayPalFuturePaymentDelegate methods

       - (void)payPalFuturePaymentViewController:(PayPalFuturePaymentViewController *)futurePaymentViewController didAuthorizeFuturePayment:(NSDictionary   *)futurePaymentAuthorization {
      NSLog(@"PayPal Future Payment Authorization Success!");
     self.resultText = futurePaymentAuthorization[@"code"];
     [self showSuccess];

     [self sendAuthorizationToServer:futurePaymentAuthorization];
      [self dismissViewControllerAnimated:YES completion:nil];
       }

         - (void)payPalFuturePaymentDidCancel:(PayPalFuturePaymentViewController      *)futurePaymentViewController {
          NSLog(@"PayPal Future Payment Authorization Canceled");
         self.successView.hidden = YES;
         [self dismissViewControllerAnimated:YES completion:nil];
     }

     - (void)sendAuthorizationToServer:(NSDictionary *)authorization {
     // TODO: Send authorization to server
      NSLog(@"Here is your authorization:\n\n%@\n\nSend this to your server to complete future payment setup.", authorization);
    }


    #pragma mark - Helpers

      - (void)showSuccess {
       self.successView.hidden = NO;
       self.successView.alpha = 1.0f;
      [UIView beginAnimations:nil context:NULL];
       [UIView setAnimationDuration:0.5];
        [UIView setAnimationDelay:2.0];
       self.successView.alpha = 0.0f;
       [UIView commitAnimations];
     }

     #pragma mark - Flipside View Controller

      - (void)flipsideViewControllerDidFinish:(ZZFlipsideViewController *)controller {
       if ([[UIDevice currentDevice] userInterfaceIdiom] == UIUserInterfaceIdiomPhone) {
       [self dismissViewControllerAnimated:YES completion:nil];
       }    else {
        [self.flipsidePopoverController dismissPopoverAnimated:YES];
         self.flipsidePopoverController = nil;
        }
     }

     - (void)popoverControllerDidDismissPopover:(UIPopoverController *)popoverController {
       self.flipsidePopoverController = nil;
       }

      - (void)prepareForSegue:(UIStoryboardSegue *)segue sender:(id)sender {
       if ([[segue identifier] isEqualToString:@"pushSettings"]) {
      [[segue destinationViewController] setDelegate:self];

           if ([[UIDevice currentDevice] userInterfaceIdiom] == UIUserInterfaceIdiomPad) {
            UIPopoverController *popoverController = [(UIStoryboardPopoverSegue *)segue popoverController];
             self.flipsidePopoverController = popoverController;
          popoverController.delegate = self;
          }
        }
      }

         - (IBAction)togglePopover:(id)sender {
        if (self.flipsidePopoverController) {
         [self.flipsidePopoverController dismissPopoverAnimated:YES];
         self.flipsidePopoverController = nil;
       } else {
        [self performSegueWithIdentifier:@"showAlternate" sender:sender];
       }
      }

  @end

【问题讨论】:

  • 你的代码在哪里? (捂脸)
  • 实际上这个sdk记录了任何电子邮件和用户ID...我从developer.paypal.com/webapps/developer/docs/integration/mobile/…这里下载了这个sdk
  • 这里是来自 PayPal 的戴夫。看起来您只是在尝试运行 PayPal iOS SDK 附带的示例应用程序,对吧?至少,这是您粘贴到问题中的代码。如果是这种情况,请提供您在运行应用程序时所遵循的具体步骤,并说明哪些行为与您的预期不符。或者,如果您已将 SDK 集成到您自己的应用程序中,请显示相关代码(来自您的应用程序)。然后,请提供您在运行应用程序时遵循的具体步骤,并说明哪些行为不是您所期望的。谢谢!
  • 是的,你说得对,我只是想运行 paypal ios SDK 附带的示例应用程序,当我运行这个应用程序时,它会询问电子邮件 ID 和密码,当我在其中输入任何内容时这两个盒子然后它接受。现在我想知道为什么这不验证电子邮件 ID 和密码,为什么不给出错误电子邮件 ID 和密码的错误消息。
  • 实际上我是第一次实施贝宝,所以我对此不太了解,所以请指导我谢谢

标签: ios paypal


【解决方案1】:

您没有验证电子邮件和密码,因为您将环境设置为 PayPalEnvironmentNoNetwork。将其设置为 NoNetwork 会将其设置为“模拟”环境并仅模拟操作。您需要将环境设置为 Live 或 Sandbox,以便使用这些环境进行处理/身份验证。下面的代码就是你需要看的相关sn-p...

// Set the environment:
// - For live charges, use PayPalEnvironmentProduction (default).
// - To use the PayPal sandbox, use PayPalEnvironmentSandbox.
// - For testing, use PayPalEnvironmentNoNetwork.
#define kPayPalEnvironment PayPalEnvironmentSandbox

【讨论】:

    猜你喜欢
    • 2016-05-19
    • 1970-01-01
    • 1970-01-01
    • 2011-11-22
    • 2021-10-13
    • 2015-11-14
    • 1970-01-01
    • 2020-06-17
    • 2011-06-29
    相关资源
    最近更新 更多