ios - PayPal iOS SDK 2.0.5 未正确验证电子邮件 ID 和密码

标签 ios paypal

大家好,我是这个专业网站的新手。实际上我在 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

最佳答案

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

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

关于ios - PayPal iOS SDK 2.0.5 未正确验证电子邮件 ID 和密码,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/23127446/

相关文章:

ios - Objective C 到 Swift 的转换

ios - Realm 中的嵌套对象更新问题

ios - cocoa pod 更新破坏了一些东西,现在 "pod update"产生错误

使用自定义返回 URL 时,PayPal PDT 不会在 QueryString 中返回 tx 值

php - PayPal PHP SDK - 付款创建不适用于生产 - 空响应

ios - 实现PFQueryTableViewController搜索功能

ios - UIPageViewController 在旋转时不调整其 subview Controller 的大小

php - 包含多个项目的 Paypal 购物车无法使用

php - Paypal 购物车上传到白页

php - 如何从paypal返回客户信息?