Drupal Answers is a question and answer site for Drupal developers and administrators. It's 100% free, no registration required.

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

I'm working on a website that communicates with a bank API. During the process, the API sends a request to a callback page. I, therefore, created a "callback_bank.php" file, and put it at the root of the drupal folder (along with index.php, cron.php, etc.) so it's accessible by http://www.mywebsite.com/callback_bank.php

How would I go about packaging/deploying that file with the custom module I created, that does the rest of the work ?

Thank you!

share|improve this question
up vote 2 down vote accepted

Assuming the return path is configurable with the bank, you'd be better to create a hook_menu callback to handle the bank response.

That way you can leverage the Drupal API, e.g access callback to restrict to their IP address range to prevent spoofing etc..


 * Implements hook_menu().
function MYMODULE_menu() {
  $items = array();

  $items['payment/callback'] = array(
    'title' => 'Payment callback',
    'page callback' => 'MYMODULE_payment_callback_handler',
    'access callback' => 'MYMODULE_payment_callback_access',
    'type' => MENU_CALLBACK,
    'file' => 'MYMODULE.pages.inc',

  return $items;

The bank can then request https://www.yoursite.com/payment/callback?param1=foo&param2=bar

share|improve this answer
For anyone looking at this solution : MYMODULE_payment_callback_access must return TRUE. Otherwise you'll get an "access refused" error. Thanks for the answer ! It works like a charm :) – Ebpo Jan 11 '13 at 14:24

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

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