Note that there are some explanatory texts on larger screens.

plurals
  1. PONew PayPal iOS SDK (beta) - Can't connect to sandbox
    text
    copied!<p>I've integrated the new PayPal iOS SDK into my app. Reference can be found <a href="https://developer.paypal.com/webapps/developer/index" rel="nofollow">here</a>. The new SDK is really easy to set up and it allows you to work in 3 different environments 1.) PayPalEnvrionmentNoNetwork 2.) PayPalEnvironmentSandBox and 3) No environment meaning to go onto their live servers. Everything works for the NoNetwork Environment, obviously because it uses mock dummy data, not having to access any servers. When I try to switch to the SandBox environment, PayPal can't connect to the servers, I get the following error: </p> <pre><code> We're Sorry There was a problem communicating with the PayPal servers. [Cancel][Try Again] </code></pre> <p>I'm not sure if this is a problem on my side or theirs. The following is the configuration:</p> <pre><code> #define kPayPalClientId @"AbRN_BAV7YMsvde9KUFPsbSC_72NA9swMcY-j0QZL629lXrjSc9CNwfFn8Ac" #define kPayPalReceiverEmail @"The email I use to login into PayPal" - (IBAction)pay { PayPalPayment *payment = [[PayPalPayment alloc] init]; payment.amount = [[NSDecimalNumber alloc] initWithString:@"14.99"]; payment.currencyCode = @"USD"; payment.shortDescription = @"Testing."; if (!payment.processable) { // This particular payment will always be processable. If, for // example, the amount was negative or the shortDescription was // empty, this payment wouldn't be processable, and you'd want // to handle that here. } // Any customer identifier that you have will work here. Do NOT use a device- or // hardware-based identifier. NSString *customerId = nil; // Set the environment: // - For live charges, use PayPalEnvironmentProduction (default). // - To use the PayPal sandbox, use PayPalEnvironmentSandbox. // - For testing, use PayPalEnvironmentNoNetwork. [PayPalPaymentViewController setEnvironment:self.environment]; PayPalPaymentViewController *paymentViewController = [[PayPalPaymentViewController alloc] initWithClientId:kPayPalClientId receiverEmail:kPayPalReceiverEmail payerId:customerId payment:payment delegate:self]; paymentViewController.hideCreditCardButton = NO; [self presentViewController:paymentViewController animated:YES completion:nil]; } </code></pre> <hr> <p><strong>FIX: Finally I figured out the problem, you need to add this after the view loads. I didn't have this at all.</strong></p> <pre><code> [PayPalPaymentViewController prepareForPaymentUsingClientId:kPayPalClientId]; </code></pre> <hr>
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload