Business::PayPal::SDK - An interface to paypals SDK's.


  use Business::PayPal::SDK;
  my $pp = new Business::PayPal::SDK(
      paypal_apiid => "",
      paypal_apipw => "12345678",
      paypal_cert => "paypal_java_sdk/samples/Cert/sdk-seller.p12",
      paypal_certpw => "password",
      paypal_env => "sandbox",
      java_sdk_dir => "/path/to/paypals/java/sdk",

  my $res = $pp->SetExpressCheckout(
      OrderTotal => '10.00',
      ReturnURL => 'http:://',
      CancelURL => 'http:://',

  print $res->{token};


Business::PayPal::SDK is a perl interface to the SDK provided by paypal ( You can use this module to implement paypal pro and paypal express transactions in perl. On the back end this modules uses Inline::Java to interface directly with the paypals java sdk. Consequently you will need to get a J2SDK and Inline::Java installed. This was done for 2 reasons. 1) Speed of development, didnt have to deal with all the SOAP stuff. 2) Easier maintanance regarding future changes. That is to say, I only have to make sure I keep this compatiable with paypals SDK, not thier underlying protocol changes.

This document assumes you have an understanding of the java SDK and API provided by PayPal.

All methods take a single hashref as an argument. All methods return a hashref, or undef if there is an internal failure of some sort. Check $ret->{ack} to see if the call to PayPal was successful. If $ret->{ack} is not 'Success' than you can check the $res->{ErrorCodes}, this will be an hashref with the key being the error code from paypal and the value is the 'getLongMessage' from the error. Check $obj->error for description of failure.

Public Methods


All args are pass in as a hash ref. All the other functions require paypal_apiid, paypal_apipw, payapl_cert, paypal_certpw, paypal_env and java_sdk_dir to be defined. You can pass them all in the new call, or you can use there accessors. $obj->paypal_apiid.

Additionally, you can use pass jni => 1, or shared_jvm => 1 to have these values passed to Inline::Java. See Inline::Javas docs for more details on JNI and SHARED_JVM.


This will 'require' Inline::Java and get the jvm fired up.

Does not take any arguments. However, if you want to use the authentication information and cert that is used in the paypal API docs you can set the $Business::PayPal::SDK::PPCONINFO variable to true and it will use those instead of whatever you may have set.


DoDirectPayment charges a card. Returns a hasref very similar in structure to the object returned by the java jdk


DoExpressCheckoutPayment after getting a token


GetExpressCheckoutDetails to get customer details.


SetExpressCheckout to get token


RefundTransaction to do refund. RefundType is defaulted to 'Full'


This is not really completed yet.


This modules is currently in development, not all methods in the paypal SDK are implemented yet.


Non that I am aware of yet. :) Please email if you find any.


Jacob Boswell <>

Also thanks to Rob Brown for assistance.


Business::PayPal::SDK is Copyright(c) 2005 Jacob Boswell. All rights reserved You may distribute under the terms of either the GNU General Public License or the Artistic License, as specified in the Perl README file.