ios - Issue with Apple Pay / Stripe integration -


i have followed stripe's documentation , example app on integrating apple pay.

in handlepaymentauthorizationwithpayment method, under createtokenwithpayment, getting error:

error domain=com.stripe.lib code=50 "your payment information formatted improperly. please make sure you're correctly using latest version of our ios library. more information see https://stripe.com/docs/mobile/ios ." userinfo=0x170261b40 {com.stripe.lib:errormessagekey=your payment information formatted improperly. please make sure you're correctly using latest version of our ios library. more information see https://stripe.com/docs/mobile/ios ., nslocalizeddescription=your payment information formatted improperly. please make sure you're correctly using latest version of our ios library. more information see https://stripe.com/docs/mobile/ios .}

anyone know how resolve this? using latest stripe library.

thanks.

this little bit of rnd helped me. digging customsampleproject provided stripe themselves, applepaystubs works pretty when stpcard recognized when delegate

- (void)paymentauthorizationviewcontroller:(pkpaymentauthorizationviewcontroller *)controller                    didauthorizepayment:(pkpayment *)payment                             completion:(void (^)(pkpaymentauthorizationstatus))completion 

of pkpaymentauthorizationviewcontrollerdelegate called. sample code here checked if code run in debug applepaystubs, (pkpayment *)payment in delegate converted stpcard , launched stpapiclient stptoken generation. following body of above mentioned delegate:

#if debug // handle test result 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 

this worked me. applepaystubs (on simulator) , without them (on device) hope helps :)


Comments

Popular posts from this blog

ruby on rails - RuntimeError: Circular dependency detected while autoloading constant - ActiveAdmin.register Role -

c++ - OpenMP unpredictable overhead -

javascript - Wordpress slider, not displayed 100% width -