【问题标题】:Does it possible to test iOS app using PayPal Live Credentials(clientID & sandboxID) before submitting app in Apple App Store?在 Apple App Store 中提交应用程序之前,是否可以使用 PayPal Live Credentials(clientID & sandboxID) 测试 iOS 应用程序?
【发布时间】:2016-06-30 13:15:45
【问题描述】:

很抱歉提出这个问题。因为没有与此问题相关的可用链接,但我的意图有点不同,这就是我在此处发布此问题的原因:

在 Apple App Store 中提交应用之前,是否可以使用 PayPal Live Credentials 检查 iOS 应用?

问题是在 Apple 方面有 2 个概念,例如 推送通知应用内购买生产未开发)我们无法检查测试时间。我觉得 PayPal 也一样。但我对此有点怀疑.....

通过使用:https://simicart.zendesk.com/hc/en-us/articles/214860237-How-To-Obtain-API-Client-ID-And-Secret-Key-Within-Your-Paypal-Account-

我在我的应用程序中集成了 paypal,它在沙盒中运行良好,但现在我想在实时应用程序 ID 上实时运行,所以我需要做什么?

这里我面临的问题与:Invalid merchant - payments to this merchant are not allowed (invalid clientId )

注意:我也已经在 developer.paypal.com 中红色了 PayPal iOS SDK 集成过程

(1) "使用向应用程序所有者注册的 PayPal 帐户的凭据登录 PayPal 开发者网站。请注意,与应用程序关联的 PayPal 帐户必须是经过验证的 Premier 或经过验证的 Business 帐户。"

我做了同样的事情。现在我正在使用有效的 LIVE Client id & Sandbox Key。

ANDROID 中: LIVE 凭据工作正常

iOS 中: 它说的是我上面提到的错误?

我该如何解决这个问题?你能帮帮我吗?

这里我使用如下代码:

#pragma mark
#pragma mark -- connectToPayPalBtnClicked
- (IBAction)connectToPayPalBtnClicked:(id)sender {
 //    // Create a PayPalPayment
  PayPalPayment *payment = [[PayPalPayment alloc] init];
   payment.amount = [[NSDecimalNumber alloc] initWithString:@"10.95"];
   //we recommend limiting transactions to currencies supported by both payment types. Currently these are: USD, GBP, CAD, EUR, JPY.
   payment.currencyCode = @"USD";
   payment.shortDescription = @"Awesome saws";

   // Check whether payment is processable.
  if (!payment.processable) {
      // If, for example, the amount was negative or the shortDescription was empty, then
    // this payment would not be processable. You would want to handle that here.
 }
 /*
   For Test Account purpose
     [PayPalMobile initializeWithClientIdsForEnvironments:@{
                                                       PayPalEnvironmentSandbox : PayPalClienKey}];
 */
[PayPalMobile initializeWithClientIdsForEnvironments:@{PayPalEnvironmentProduction : @"AU2qoYgXhfghgfhgfhfghhNS_QYjTSMV_LS4RmG-qbPGdXODlvJXuSE5jXQRAeJEwPvh6h4C",
                                                       PayPalEnvironmentSandbox : @"ELQN7GqTJZDCH3Qfr17wyhfghfghgfhhg9esR9fyJ9prL6xKfFURMoAK0PZw0scTB5I6Un  "}];

  #ifdef CONFIGURATION_ReleaseLive
   [PayPalMobile preconnectWithEnvironment:PayPalEnvironmentProduction];
 #else
  [PayPalMobile preconnectWithEnvironment:PayPalEnvironmentSandbox]; // PayPalEnvironmentSandbox ?
#endif
  [self setPayPalConfig:[[PayPalConfiguration alloc] init]];
  [[self payPalConfig] setAcceptCreditCards:YES];
   [[self payPalConfig] setPayPalShippingAddressOption:PayPalShippingAddressOptionNone];
   [[self payPalConfig] setLanguageOrLocale:[NSLocale preferredLanguages][0]];
   // Create a PayPalPaymentViewController.
    PayPalPaymentViewController *paymentViewController;
     paymentViewController = [[PayPalPaymentViewController alloc] initWithPayment:payment
                                                                configuration:self.payPalConfiguration
                                                                    delegate:self];

   // Present the PayPalPaymentViewController.
    [self presentViewController:paymentViewController animated:YES completion:nil];
 }

#pragma mark - PayPalPaymentDelegate methods
- (void)payPalPaymentViewController:(PayPalPaymentViewController *)paymentViewController
             didCompletePayment:(PayPalPayment *)completedPayment {
     NSLog(@"PayPal Payment Success!");
    // Payment was processed successfully; send to server for verification and fulfillment.
    [self verifyCompletedPayment:completedPayment];

    // Dismiss the PayPalPaymentViewController.
    [self dismissViewControllerAnimated:YES completion:nil];
 }

   - (void)payPalPaymentDidCancel:(PayPalPaymentViewController *)paymentViewController {
     NSLog(@"PayPal Payment Canceled");
    // The payment was canceled; dismiss the PayPalPaymentViewController.
    [self dismissViewControllerAnimated:YES completion:nil];
  }
  - (void)verifyCompletedPayment:(PayPalPayment *)completedPayment {
   // Send the entire confirmation dictionary
      confirmation = [NSJSONSerialization  dataWithJSONObject:completedPayment.confirmation
                                                       options:0
                                                         error:nil];
     NSLog(@"Here is your proof of payment:\n\n%@\n\nSend this to your server for confirmation and fulfillment.", completedPayment.confirmation);

      // Send confirmation to your server; your server should verify the proof of payment
      // and give the user their goods or services. If the server is not reachable, save
     // the confirmation and try again later.
   }

【问题讨论】:

    标签: ios objective-c


    【解决方案1】:

    是的,您可以测试实时凭据。它不需要来自 Apple 的与推送通知或应用内购买相同的权限。

    除了在您的 appDelegate 中添加生产客户端 ID 之外,您还需要在加载 PayPalPaymentViewController 的任何 viewController 的 viewWillAppear 部分添加此行:

    [PayPalMobile preconnectWithEnvironment:PayPalEnvironmentProduction];
    

    现在,当加载 PayPal 结帐视图时,您可以使用自己的真实 Paypal 帐户(请注意,因为如果您付款将是真钱)而不是您设置的开发者帐户。

    【讨论】:

    • ThanQ @Ryan Friedman。如果你不是我的,我怎么能得到客户端实时生产密钥,你能分享一些示例代码吗
    猜你喜欢
    • 1970-01-01
    • 2011-08-12
    • 1970-01-01
    • 2017-07-06
    • 2018-02-28
    • 1970-01-01
    • 2014-08-30
    • 2014-03-07
    相关资源
    最近更新 更多