Created: 2011-07-16 18:09
Updated: 2014-02-22 04:03


  • Java jdk-1.5 or higher

Using SDK:

SDK Integration:

  • Download the project from github, build project using build.xml with default ant target, which will create 'invoicing-java-sdk_0.1.jar' inside 'dist' folder.

  • Copy 'invoicing-java-sdk_0.1.jar' inside 'dist' folder under SDK root, to your class path.

  • Copy the configuration file '' in SDK 'resource' folder to your project.

  • Import into your code.

  • Load the configuration file into your application with the below method calls as required.

      new InvoiceService(new File(" .../"));
      new InvoiceService(new InputStream(new File(" .../")));
      new InvoiceService(" .../");

Eg. if your file is in your WEB-INF/ folder, you can initialize the InvoiceService as below:

	  new InvoiceService(this.getServletContext().getRealPath("/") + "/WEB-INF/");
  • Create a service wrapper object.

  • Create a request object as per your project needs.

  • Invoke the appropriate method on the service wrapper object.

For example,

  import com.paypal.svcs.types.common.RequestEnvelope;
      RequestEnvelope env = new RequestEnvelope();
      InvoiceItemType item = new InvoiceItemType();
      InvoiceType invo = new InvoiceType();
      CreateInvoiceRequest request = new CreateInvoiceRequest();

      //userName is optional
      InvoiceService invc = new InvoiceService(".../");
      CreateInvoiceResponse ret = invc.createInvoice(req,userName);
  • There will be three types of PayPal authentication mechanisms that you can use through SDK
    • ThreeToken : You need to specify (username,password,signature,appId) in '' file and pass the username at invoice api call.

    • Certificate : You need to specify (username,password,certKey,certPath,appId) in '' file and pass the username at invoice api call.

    • Permission : You need to specify (username,password,appId) in '' file and pass the username at invoice api call. You need to set 'setter/getter' method for accessToken and tokenSecret in service wrapper object as follows. SDK will take care of signature generation using (accessToken,tokenSecret,username,password).


SDK Testing:

  • To run test cases, 'testng.jar' in SDK lib folder is required in class path.

  • Run default ant target "all" to compile and test the sdk classes.

  • Junit reports are generated in testReport folder.

  • '' in test folder contains constants for testing. It will mimic the API User Details and resource details in properties file. Replace the constants with your own appropriate values.

SDK Logging:

  • For logging - java.util.logging has been used. To change the default configuration, edit the file in 'jre/lib' folder under your JDK root.

SDK Configuration:

The SDK uses .properties format configuration file. Sample of this file is at

'resource/'. You can use the '' configuration file to configure

  • (Multiple) API account credentials.

  • HTTP connection parameters.

  • Service configuration.

Please refer to the sample config file provided with this bundle.

Cookies help us deliver our services. By using our services, you agree to our use of cookies Learn more