Paypal IOS SDK issues (can't communicate with servers) -


i trying process paypal payment using latest ios sdk 2 - i'm trying follow example @ -

https://github.com/paypal/paypal-ios-sdk/blob/master/docs/single_payment.md

without luck.

  • background

i'm in australia.

i'm using paypal sdk take payment in ios app. app makes call php web server validate paypal payment , update subscription on php server backend.

what i've done , i'm getting stuck.

i've setup classic api application.

i've set production , sandbox environments using -

 [paypalmobile initializewithclientidsforenvironments:      @{paypalenvironmentproduction : @"hidden",      paypalenvironmentsandbox : @"hidden"}  ]; 

with text hidden replaced real ones.

i used following code, starts paypal dialog -

[paypalmobile preconnectwithenvironment:paypalenvironmentsandbox];     paypalpayment *payment = [[paypalpayment alloc] init]; nsdecimalnumber *total_cost = nsdecimalnumber decimalnumberwithstring:@"4.30"];    // amount, currency, , description payment.amount = total_cost; payment.currencycode = @"usd"; payment.shortdescription = @"test";  // use intent property indicate "sale" payment, // meaning combined authorization + capture. perform authorization only, // , defer capture server, use paypalpaymentintentauthorize. payment.intent = paypalpaymentintentsale;  // check whether payment processable. if (!payment.processable) {      [self display_message: @"payment not processed. can happen variety of reasons, i.e. payment  amount negative, etc. please contact if believe have received message in error."];     return; }      // create paypalpaymentviewcontroller. paypalpaymentviewcontroller *paymentviewcontroller; paymentviewcontroller = [[paypalpaymentviewcontroller alloc] initwithpayment:payment                                                                configuration:self.paypalconfiguration                                                                     delegate:self];     // present paypalpaymentviewcontroller. [self presentviewcontroller:paymentviewcontroller animated:yes completion:nil]; 

the paypal dialog appears displays "can't communicate servers error, try again later".

the following appears on xcode console -

2014-03-25 10:42:22.432 paypal sdk: request has failed error:

pp_service_error_json_parse_error - system error. please try again later. (500) | paypal debug-id: a26da2c300c31 | details: (         {         "ns_error" = "error domain=nscocoaerrordomain code=3840 \"the operation couldn\u2019t completed. (cocoa error 3840.)\" (no value.) userinfo=0xbadecd0 {nsdebugdescription=no value.}";     } ). 

so question (1) ideas why happening.

and question (2) after works , can make payment, need confirm payment info returned paypal? i.e. -

  1. extract payment id sdk callback.
  2. create rest app id in paypal in addition classic one, , auth token via rest call payal. without rest app, don't seem have secret key, etc access paypal rest service.
  3. then use auth token , id (1) make rest call payal payment info , validate (i.e. check amount whats expected etc)?

hope makes sense.

ps find docs incredibly confusing.

edit: ok, next day without changed, tried running app again, time different xcode console error - "invalid client credentials". in example @ https://github.com/paypal/paypal-ios-sdk/blob/master/docs/single_payment.md specify client credentials except part around client ids -

     [paypalmobile initializewithclientidsforenvironments:      @{paypalenvironmentproduction : @"hidden",      paypalenvironmentsandbox : @"hidden"}      ]; 

which i've set correctly. additional credentials need set before launching paypal ios sdk ui?


Comments

Popular posts from this blog

user interface - How to replace the Python logo in a Tkinter-based Python GUI app? -

objective c - Greedy NSProgressIndicator Allocation -

how to set an OCR language in Google Drive -