Reputation: 1751
I have a PayPal Button tested in sandbox environment and it worked. Now i am trying to get it working in the live environment the button remains disable.
My code is
[PayPal initializeWithAppID:@"APP-80W284485P519543T" forEnvironment:ENV_LIVE];
UIButton *button = [[PayPal getInstance] getPayButton:self buttonType:BUTTON_278x43 startCheckOut:@selector(payWithPayPal) PaymentType:DONATION withLeft:20 withTop:240];
[self.view addSubview:button];
if I change Environment ENV_LIVE to ENV_SANDBOX the button is enable
Upvotes: 0
Views: 2029
Reputation: 677
The live environment can be used only after your app has been approved by PayPal. The AppID you are using to initialize PayPal is hardcoded for use in the SANDBOX env. For a live application you need to use the App ID that is assigned to your app by PayPal. Follow the steps in this page to get an App ID for your app.
Remember, you need to have your own verified PayPal Premier or Business Account before the app will work (even if it is approved).
If you are submitting a mobile app take these extra steps
Once your app is approved, you'll receive a Live App ID. Just replace the Test App ID with the Live App ID, and change your Sandbox API credentials to Live API Credentials.
Upvotes: 2
Reputation: 12231
At times, when PayPal server is down or for any problems with server, the initialization of the PayPal object fails, and the button would be disabled in these cases.
You can check for the status of the initialization using the following code:
if ([PayPal initializationStatus] == STATUS_COMPLETED_SUCCESS) { //We have successfully initialized and are ready to pay
}
}
From the documentation:
The “Pay with PayPal” button returned by the getPayButtonWithTarget method is disabled till the initialization is complete. Once the initialization is complete, if it was successful, the button will become enabled.
When initialization status returns STATUS_COMPLETED_ERROR - Request timeouts or host unavailable (Network connection failure) are valid initialization error cases for initializePayPal retry attempts.
If initialization failed due to a buyer error, the error message is presented as a UIAlertView.
Upvotes: 2
Reputation: 1406
You have to submit the app to paypal before converting it to live. They will provide you one id after testing your app in sandbox mode.
Check this link
https://www.x.com/community/ppx/xspaces/mobile/mep
Upvotes: 4