This forum has moved to a new location and is in read-only mode. Please visit talk.octobercms.com to access the new location.

ribbsousa
ribbsousa

I'm trying to get parameters in a url returned from paypal on my component but I'm not getting it.

Url returned:

http://iepm.online/ajude-nos/doacao-concluida?PayerID=RB48JZQHUC6ZA&paymentId=PAY-0XP15245GE098571XLD72ASI&token=EC-8A022139KS115682D

In my component class

class Success extends ComponentBase
{
    public function onRun() {
     $id = get('paymentId') //not work return null
     $id = Input::get('paymentId') //not work return null
     $id = post('paymentId') //not work return null
  }
}

Can someone help?

pratyushpundir6424
pratyushpundir6424

You just access them like so:

// Returns the URL segment value, eg: /page/:post_id
$postId = $this->param('post_id');

Documentation here: http://octobercms.com/docs/plugin/components#routing-parameters

Also, just for future reference Input will only provide access to POST and GET data, say thru a form.

Last updated

pratyushpundir6424
pratyushpundir6424

Just as an example, you can check this out to see how payments could be handled using Stripe. I know you are using PayPal but there just might be some similarities for you to understand things better.

https://github.com/pratyushpundir/oc-sublimeStripe NOTE: Don't use my plugin in production just yet. It's got some issues I'm resolving at present.

ribbsousa
ribbsousa

Thanks! this not work for me.

// Returns null
$id = $this->param('paymentId');

In session:

var_dump($data = Session:all());

return this:

["_previous"]=> array(1) { ["url"]=> string(133) "http://iepm.online/ajude-nos/doacao-concluida?PayerID=RB48JZQHUC6ZA&paymentId=PAY-9G395799LL040063BLEBB5YI&token=EC-0LL8923276633774V" }

I can not get the paymentId value

ribbsousa
ribbsousa

The problem paypal return url correctly, but error occurs 302 not found

http://iepm.online/ajude-nos/doacao-concluida?paymentId=PAY-8UM34694RP2150941LEBEBWI&token=EC-2A224201440691903&PayerID=RB48JZQHUC6ZA

Then redirects without parameters to url

http://iepm.online/ajude-nos/doacao-concluida
// that is why returns null
$id = $this->param('paymentId');

Last updated

1-5 of 5

You cannot edit posts or make replies: the forum has moved to talk.octobercms.com.