Skip to content
romyblack edited this page Oct 12, 2014 · 1 revision

#Welcome to the ci_paypal wiki!

This class let you make the payment procces based on paypal API, effortless and easy.

  1. Use the same documentation about the vars from paypal page. http://bit.ly/j4wRR
  2. Customize the payment procces as you desire.
  3. Build with love.

Implementation

Copy this code in your controller's function

$config['business']             = '[email protected]'; //Your PayPal account
$config['cpp_header_image']     = ''; //Image header url [750 pixels wide by 90 pixels high]
$config['return']               = 'sucess.php';
$config['cancel_return']        = 'shopping.php';
$config['notify_url']           = 'process_payment.php';
$config['production']           = TRUE; //Its false by default and will use sandbox
$config['discount_rate_cart']   = 20; //This means 20% discount
$config["invoice"]              = '843843'; //The invoice id

$this->load->library('paypal',$config);

#$this->paypal->add(<name>,<price>,<quantity>[Default 1],<code>[Optional]);

$this->paypal->add('T-shirt',2.99,6); //First item
$this->paypal->add('Pants',40);       //Second item
$this->paypal->add('Blowse',10,10,'B-199-26'); //Third item with code

$this->paypal->pay(); //Proccess the payment

The notify url is where paypal will POST the information of the payment so you can save that POST directly into your DB and analize as you want.

With $config["invoice"] is how you identify a bill and you can compare,save or update that value later on your DB.

For test porpuses i do recommend to save the entire POST into your DB and analize if its working according to your needs before putting it in production mode. EX.

$received_post = print_r($this->input->post(),TRUE);

//Save that variable and analize.

Note: html reference page http://bit.ly/j4wRR

Clone this wiki locally