在Apple App Store中提交应用程序之前,是否可以使用PayPal Live凭据(clientID& sandboxID)测试iOS应用程序?

时间:2016-03-15 08:02:17

标签: ios objective-c

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

在Apple App Store中提交应用之前,是否可以使用PayPal Live凭据检查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 Developer网站。请注意,与应用程序关联的PayPal帐户必须是经过验证的Premier或经过验证的Business帐户。”

我做了同样的事情。现在我正在使用有效的LIVE客户端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.
   }

1 个答案:

答案 0 :(得分:1)

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

除了在appDelegate中添加生产clientID之外,您还需要在viewController加载PayPalPaymentViewController的viewWillAppear部分中添加此行:

[PayPalMobile preconnectWithEnvironment:PayPalEnvironmentProduction];

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