CodeIgniter Forums

Full Version: Paypal wrong url
You're currently viewing a stripped down version of our content. View the full version with proper formatting.
Ok, this is my problem, i've been using THIS tutorial to implement Paypal in my website, after fighting the library a few days
I was finally able to run the code, but the Buy button takes me Here
it should take me to buying form right? so i can "pay" to test it 

Products controller
PHP Code:
function  __construct() {
 
       parent::__construct();
 
       $this->load->helper('form');
 
       $this->load->helper('url');
 
       $this->load->library('paypal_lib');
 
       $this->load->model('product_model');
 
   }


 
   function index(){
 
       $data = array();
 
       //get products data from database
 
       $data['products'] = $this->product_model->getRows();
 
       $data['title'] = 'Products';
 
       //pass the products data to view
 
       $this->load->view('products'$data);
 
   }

 
   function buy($id){
 
       //Set variables for paypal form
 
       $paypalURL 'https://www.sandbox.paypal.com/cgi-bin/webscr'//test PayPal api url
 
       $paypalID 'Here i am using my Paypal Business Email' //business email
 
       $returnURL base_url().'paypal/success'//payment success url
 
       $cancelURL base_url().'paypal/cancel'//payment cancel url
 
       $notifyURL base_url().'paypal/ipn'//ipn url
 
       //get particular product data
 
       $product $this->product_model->getRows($id);
 
       $userID 1//current user id

 
       $this->paypal_lib->add_field('business'$paypalID);
 
       $this->paypal_lib->add_field('return'$returnURL);
 
       $this->paypal_lib->add_field('cancel_return'$cancelURL);
 
       $this->paypal_lib->add_field('notify_url'$notifyURL);
 
       $this->paypal_lib->add_field('item_name'$product['name']);
 
       $this->paypal_lib->add_field('custom'$userID);
 
       $this->paypal_lib->add_field('item_number' $product['products_id']);
 
       $this->paypal_lib->add_field('amount' $product['price']);        
        
        $this
->paypal_lib->paypal_auto_form();
 
   


if you need more info to help please let me know
Have you tried that if you are logged out from paypal sandbox?
(04-07-2016, 04:48 AM)Tpojka Wrote: [ -> ]Have you tried that if you are logged out from paypal sandbox?

yes
First thing I'd do is to ask the guy who made tutorial in comment on that website.