Reputation: 111
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.
Upvotes: 7
Views: 10620
Reputation: 1149
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.
Upvotes: 6
Reputation: 1266
In PaymentMethodViewController
kPayPalEnvironment
global variable.Upvotes: 1
Reputation:
//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];
Upvotes: 1
Reputation: 6712
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];
Upvotes: 9