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.

3
  • How are you registering the confirmation route in the plugin? Can you share some sample code?
    – Brad Bell
    Commented Sep 1, 2014 at 2:36
  • public function registerSiteRoutes() { return array( 'paypaloots/confirm' => array('action' => 'paypaloots/confirm'), ); } Commented Sep 1, 2014 at 4: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
    Commented Sep 1, 2014 at 5:22

1 Answer 1

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.

1
  • Absolutely Brilliant @Brandon Kelly. Thank you. I have decided to overwrite token param in config for now. Cheers mate Commented Sep 2, 2014 at 5:54

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.