1

So I'm in the middle of creating a plugin that allows users to make payments with GoCardless. Once payment has been made on the GoCardless website the user needs to be redirected to a PHP script that will confirm the payment was all hunkie-dorie... but....

Where do I put this script? At the moment I've put it inside a folder that is inside the htdocs folder but I'm having problems calling craft()->plugin_name->confirmPayment() from this location as craft() is undefined here.

Help greatly appreciated, thanks!

1 Answer 1

1

After the payment has been made, you can have the response callback go to an anonymous action method on your plugin's controller.

The URL for that would look something like this:

http://mydomain.com/index.php/actions/myPluginHanlde/myPluginController/myPluginAction

From there you can perform any additional business logic (validation, record saving, etc.), and $this->redirect(''); to a success template.

4
  • Thanks for your help! Can I? GoCardless wants me to provide a url for the user to be sent to after submitting their payment details. So I've provided my url that is: <the-site>.co.uk/api/gocardless/payment-made/index.php How can I call the action from within that? Or am I looking at it wrong?
    – H2ONOCK
    Commented Nov 5, 2015 at 18:43
  • Updated answer.
    – Brad Bell
    Commented Nov 5, 2015 at 19:14
  • That looks brilliant, I'll try it ASAP. Thank you so much!
    – H2ONOCK
    Commented Nov 5, 2015 at 19:20
  • Worked a treat, nice one!
    – H2ONOCK
    Commented Nov 5, 2015 at 19:44

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.