- first go the this link paypal SDK for downloading updated PayPal SDK (Version 2.0.1)for Android.
- Go to file Tab in eclipse and click import and select Existing Project into Workspabe under General folder click next and check select archive file radio button then click browse the source.zip from previous link and then click finish.
- Now you have import the source.zip file and you can see PayPalSDKExample project into your packageExplorer. if you find Error then you could rewrite target in project.properties and android:targetSdkVersion in AndroidManifest.xml.
- After step 3 save and clean the project and removed the error from project.
- Now you can run your project without communicating the PayPal Server.for sanbox testing go through step-6 to step-17 also.
- open the SampleActivity.java file you could see the private static final String CONFIG_ENVIRONMENT = PayPalConfigurnatio.ENVIRONMENT_NO_NETWORK;
- the line shown in step-5 indicate the PayPal Server Enviorment where we test our App there are 2 more options apart from above which is ENVIRONMENT_PRODUCTION and ENVIRONMENT_SANDBOX.
- for publishing app into market you would need to use PayPalConfigurnatio.ENVIRONMENT_PRODUCTION environment for real time payment this is also known as Live Environment. while PayPalConfigurnatio.ENVIRONMENT_SANDBOX used for testing app without real time payment.
- Second line You could see is private static final String CONFIG_CLIENT_ID = "credential from developer.paypal.com";
- Your mobile integration requires different client_id values for each environment: Live and Test (Sandbox).
- Go to this link register your app for register your app for getting client_id
- if you have PayPal Account the you can directly logged in and follow instruction for registering app otherwise you would need to sign up .
- after step-12 you would click on create app button and follow the step to register your app and get client_id
- replace CONFIG_CLIENT_ID with your app client_id
- create test account from this link whose type would be personal not Bussiness
- finally change CONFIG_ENVIRONMENT value to PayPalConfigurnatio.ENVIRONMENT_SANDBOX
- finally run your app and test in SANDBOX environment with test account without any real Transaction
please give me feedback and enjoy coding and blogging