Seach

simple money payment using paypal api using codeigniter

create a paypal account
 we use paypal.com to original sits for development purpose we use sandbox.paypal account for testing
for reference  of integrating paypal reffer developer.paypal.com documentation and dashbord

controller

<?php
defined('BASEPATH') OR EXIT('Dirrect access not allowed');
class Pay extends CI_Controller
{
    public function __construct() {
        parent::__construct();
    }
    public function index()
    {
        $data['settings']=array('id'=>'your sandboxpaypal id  //mine is sellerhithn@gmail.com','url'=>'https://www.sandbox.paypal.com/cgi-bin/webscr');//test url  for testing provided by paypal orignal is http://www.paypal.com
        $this->load->view('pay_view',$data);
    }
    public function success()
    {
        $this->load->view('success_view');
       
       
    }
    public function failer()
    {
        echo 'problem occured';
    }
}

view
 //to know more options  visit https://developer.paypal.com/webapps/developer/docs/classic/paypal-payments-standard/integration-guide/formbasics/
 
 <form method="post" action="<?php echo $settings['url'];?>">
    <input type='hidden' name='cmd' value='_xclick'>
    <input type="hidden" name="address_override" value="1">
    <input type="hidden" name="first_name" value="hithin chandran">


    <input type="hidden" name="business" value="<?php echo $settings['id'];?>">
    <input type='hidden' name='item_name' value='Exam fee'>
    <input type='hidden' name='item_name' value='<?php echo rand(1,10000);?>'>
    <input type='hidden' name='amount' value='1000'>
    <input type='hidden' name='no_shipping' value='1'>
    <input type='hidden' name='currency_code' value='USD'>
    <input type='hidden' name='handling' value='0'>
    <input type='hidden' name='cancel_return' value="<?php echo site_url('pay/failer'); ?>">
    <input type='hidden' name='return' value="<?php echo site_url('pay/success'); ?>">

    <input type="image" src="https://www.sandbox.paypal.com/en_US/i/btn/btn_buynowCC_LG.gif" border="0" name="submit" alt="PayPal - The safer, easier way to pay online!">
    <img alt="" border="0" src="https://www.sandbox.paypal.com/en_US/i/scr/pixel.gif" width="1" height="1">

                   
</form>
<div>
  
</div>