Apple Pay/Stripe整合问题

问题描述:

我已经关注了整合Apple Pay的Stripe文档和示例应用程序。Apple Pay/Stripe整合问题

在handlePaymentAuthorizationWithPayment方法,createTokenWithPayment下,我得到的错误:

Error Domain=com.stripe.lib Code=50 "Your payment information is formatted improperly. Please make sure you're correctly using the latest version of our iOS library. For more information see https://stripe.com/docs/mobile/ios ." UserInfo=0x170261b40 {com.stripe.lib:ErrorMessageKey=Your payment information is formatted improperly. Please make sure you're correctly using the latest version of our iOS library. For more information see https://stripe.com/docs/mobile/ios ., NSLocalizedDescription=Your payment information is formatted improperly. Please make sure you're correctly using the latest version of our iOS library. For more information see https://stripe.com/docs/mobile/ios .}

任何人都知道如何解决这个问题?我正在使用最新的条纹库。

谢谢。

我想我知道这里发生了什么。如果它有助于任何人,留下来。

当我最初将Stripe/Apple Pay设置到我的应用程序中时,当我试图执行STPTestPaymentAuthorizationController时,我不断收到大量错误。我发现这里描述的确切问题(Stripe payment library and undefined symbols for x86_64)。

我通过注释掉部分Stripe的代码来复制上面定义的解决方案,这可能(?)产生了Error Domain=com.stripe.lib Code=50错误。

我通过不使用STPTestPaymentAuthorizationController修复了这个问题,只是用PKPaymentAuthorizationViewController代替#DEBUG模式。

tl:dr不完全确定为什么STPTestPaymentAuthorization不起作用;通过在测试模式下使用我的iPhone和条纹仪表板运行PKPaymentAuthorizationViewController完全避免了情况。

+0

嗨,可以,如果我用我的Touch ID和Stripe在测试模式下使用Apple Pay付款,是不是会收费我的卡? – 2015-03-03 00:30:21

+3

@SaiJithendra正确,即使您的手机上的交易显示成功,它也不会为您的卡充电。 – 2015-03-07 06:38:09

+0

感谢您的回复:) – 2015-03-08 19:11:56

RnD的这一点帮助了我。挖成条纹本身提供的CustomSampleProject,ApplePayStubs工作得很好,当STPCardPKPaymentAuthorizationViewControllerDelegate的代表

- (void)paymentAuthorizationViewController:(PKPaymentAuthorizationViewController *)controller 
        didAuthorizePayment:(PKPayment *)payment 
          completion:(void (^)(PKPaymentAuthorizationStatus))completion 

被称为是公认的。这里检查的样本代码,如果代码是在调试那是ApplePayStubs运行时,(PKPayment *)支付在代理转换为STPCard,并推出了STPAPIClientSTPToken产生。以下是上述代表的身体:

#if DEBUG // This is to handle a test result from ApplePayStubs 
if (payment.stp_testCardNumber) 
{ 
    STPCard *card = [STPCard new]; 
    card.number = payment.stp_testCardNumber; 
    card.expMonth = 12; 
    card.expYear = 2020; 
    card.cvc = @"123"; 
    [[STPAPIClient sharedClient] createTokenWithCard:card 
              completion:^(STPToken *token, NSError *error) 
    { 
     if (error) 
     { 
      completion(PKPaymentAuthorizationStatusFailure); 
      [[[UIAlertView alloc] initWithTitle:@"Error" 
             message:@"Payment Unsuccessful! \n Please Try Again" 
             delegate:self 
           cancelButtonTitle:@"OK" 
           otherButtonTitles:nil] show]; 
      return; 
     } 
    /* 
    Handle Token here 
    */ 
              }]; 
} 
#else 
[[STPAPIClient sharedClient] createTokenWithPayment:payment 
             completion:^(STPToken *token, NSError *error) 
{ 
    if (error) 
    { 
     completion(PKPaymentAuthorizationStatusFailure); 
     [[[UIAlertView alloc] initWithTitle:@"Error" 
            message:@"Payment Unsuccessful!" 
            delegate:self 
          cancelButtonTitle:@"OK" 
          otherButtonTitles:nil] show]; 
     return; 
    } 
    /* 
    Handle Token here 
    */ 
}]; 
#endif 

这对我有效。与ApplePayStubs(在模拟器上),没有他们(在设备上)希望这可以帮助:)