Welcome Guest, Not a member yet? Register   Sign In
Paypal_Lib implementation
#1

[eluser]Ji31[/eluser]
Hi,

I'm trying to implement Paypal_Lib but I don't know how to manage this.

I have the function add() which add the post onto my site. Than I need customer to pay for this post.

My function is:
Code:
function add(){

  ...here is some validation of the adding form...

if($this->validation->run() == FALSE)
{
   $this->load->view('add_view');
}else{

  ...here I save the post and get the $id of the post...

//PayPal
  $this->load->library('Paypal_Lib');
  $this->paypal_lib->add_field('business', '[email protected]');
  $this->paypal_lib->add_field('return', site_url('paypal/success'.$id));
  $this->paypal_lib->add_field('cancel_return', site_url('paypal/cancel'));
  $this->paypal_lib->add_field('notify_url', site_url('paypal/ipn'));
  $this->paypal_lib->add_field('item_name', 'Adding job');
  $this->paypal_lib->add_field('item_number', $id);
  $this->paypal_lib->add_field('amount', $price);
    
  $this->paypal_lib->button('Click here to pay now (please)!');
  $this->paypal_lib->paypal_form();
//End of PayPal

}

And my problem is, that I get the blank page! No Paypal is showed, just blank page (even in the source of page). So surely I'm wrong somewhere in the Paypal_Lib implementation....

What I have to do to show the form?

Thanks
#2

[eluser]coolfactor[/eluser]
What does the paypal_form() method do? You're calling it, but should you echo() the returned value, or pass it into CI's output?
#3

[eluser]Ji31[/eluser]
[quote author="coolfactor" date="1185743205"]What does the paypal_form() method do? You're calling it, but should you echo() the returned value, or pass it into CI's output?[/quote]

!!! I must use 'echo'! How stupid from me :bug: ! Bud it didn't cross my mind for 3/4 hour!

Thanks :red:
#4

[eluser]Ji31[/eluser]
I'm sorry, but once again: how do I post the variable to Paypal and back? I need to send the id of post it is paid for and the contact address (not necessary the same as for payment was used for...).

I have really readed a lot of IPN PayPal manuals, but it's still not clear to me..

Thank for every advice..
#5

[eluser]CI Lee[/eluser]
I too had the issue of it not accepting post variables... I am sure I am doing it wrong, so I just hard coded it. If you figure it out please post your solution as I would love to see where I have gone wrong.
#6

[eluser]gunter[/eluser]
[quote author="Ji31" date="1185936358"]I need to send the id of post it is paid for and the contact address (not necessary the same as for payment was used for...)..[/quote] do you mean, you want know how to pass data via ipn to paypal and back, so you know later for which reason the money is for? like the id of the shopping cart or something like that?

you could use
Code:
$this->paypal_lib->add_field('custom', $your_shopping_cart_id);

//or

$this->paypal_lib->add_field('notify_url', site_url('paypal/ipn/'.$your_shopping_cart_id));

to pass data to the ipn function...




Theme © iAndrew 2016 - Forum software by © MyBB