简体   繁体   中英

integration paypal with ios

I am developing an application where I need to integrate payments with PayPal, I have downloaded the PayPal iOS SDK , everything works perfectly with the sandbox but now I do not know how to switch the mode for production. any help would be apprediated.

The PayPal SDK is fine if you go for physical goods. Regarding your question: to switch to live you just need to remove this line

[PayPalPaymentViewController setEnvironment:PayPalEnvironmentNoNetwork];

The sample code you are probably following in the iOS integration docs sets the environment to PayPalEnvironmentNoNetwork :

// Start out working with the test environment! 
// When you are ready, remove this line to switch to live.
[PayPalPaymentViewController setEnvironment:PayPalEnvironmentNoNetwork];

You could just remove that line to go live, since the default is PayPalEnvironmentProduction .

However, you probably want to test your integration before going live by changing the environment to PayPalEnvironmentSandbox :

[PayPalPaymentViewController setEnvironment:PayPalEnvironmentSandbox];

You can create sandbox accounts over here .

When switching to production, rather than deleting the line, it is safer and clearer to be explicit:

[PayPalPaymentViewController setEnvironment:PayPalEnvironmentProduction];

See also PayPalPaymentViewController.h documentation on environments .

//for testing    
[PayPalPaymentViewController setEnvironment:self.environment]; 

//for Paypal live app than it set  in our app code  
[PayPalPaymentViewController setEnvironment:PayPalEnvironmentProduction];   

//check in Paypal sandbox account
[PayPalPaymentViewController setEnvironment:PayPalEnvironmentSandbox]; 

In PaymentMethodViewController

  1. Replace PayPalEnvironmentSandbox with PayPalEnviromentProduction of kPayPalEnvironment global variable.
  2. Set live credentials of paypal account.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM