2

I am Craft newbie, and am trying to use PayPal express checkout but am stuck on a confirmation route.

How do I register a route like this:

localhost:8888/app/confirm?token=EC-5UA33446UB5625646&PayerID=8RB74GZ8ASWGQ 

What I have done so far:

Registered route confirm on the plugin but when PayPal adds the token and payerId, Craft doesn't understand the route anymore.

public function registerSiteRoutes()
{
    return array(
        'app/confirm' => array('action' => 'app/confirm')
    );
}

Any help will be appreciated.

  • How are you registering the confirmation route in the plugin? Can you share some sample code? – Brad Bell Sep 01 '14 at 02:36
  • public function registerSiteRoutes() { return array( 'paypaloots/confirm' => array('action' => 'paypaloots/confirm'), ); } – Silvanus Matiku Sep 01 '14 at 04:24
  • Hi Silvanus, welcome to Craft Stack Exchange! Please move your code example into the original question to make it much easier to read. You can edit the original question at any time to add new information which may be helpful in finding an answer. – Lindsey D Sep 01 '14 at 05:22

1 Answers1

4

Craft actually has its own built-in support for tokenized requests, which is activated if there's a "token" param. if that param is set, Craft will refer to the craft_tokens table for instructions in how to route the request, ignoring the normal routing steps.

The name of that param can be customized using the tokenParam config setting, but you should probably just have PayPal use a different query string param if you can.

Brandon Kelly
  • 34,307
  • 2
  • 71
  • 137