How to handle a post request from an external application in Drupal? I am integrating with the Stripe payment gateway and I need to be able to handle a post from their server to authenticate a standalone account. I am trying to follow the instructions at https://stripe.com/docs/connect/standalone-accounts

Namely, I need to provide a callback URL which will receive the data I need through request parameters.

https://mydrupalsite.com/callback?scope=read_write&amp;code=AUTHORIZATION_CODE

I need to be able to get the scope and the code value.  

Once I have that, I will need to then redirect based on their values to certain pages.  

I tried creating a MENU_CALLBACK type menu item with a page callback to handle the parameters, but what I tried didn't work.
Below is the code I tried.

function bh_commerce_stripe_oauth_menu() {
  $items = array();
  $items['bh_commerce_stripe_oauth/callback/%'] = array(
        'title' =&gt; 'bh_commerce_stripe_oauth_callback',
        'page callback' =&gt; '_bh_commerce_stripe_oauth_handle_callback',
        'page arguments' =&gt; array(2),
        'type' =&gt; MENU_CALLBACK     
  );
  return $items;    
}


function _bh_commerce_stripe_oauth_handle_callback($post_parm_args) {
  drupal_set_message(t('_commerce_stripe_oauth_handle_callback: called'));
  drupal_goto('&lt;front&gt;');
}
Your path is wrong I think. You should be able to access that callback here.

https://mydrupalsite.com/bh_commerce_stripe_oauth/callback/randomstring

So actually your hook_menu should look like this.

/* Implements hook_menu */
function bh_commerce_stripe_oauth_menu() {
  $items = array();
  $items['callback'] = array(
    'title' =&gt; 'bh_commerce_stripe_oauth_callback',
    'page callback' =&gt; '_bh_commerce_stripe_oauth_handle_callback',
    'type' =&gt; MENU_CALLBACK     
  );
  return $items;    
}


Note: You don't have any path wildcards (represented by % in your array key) in the callback you are getting that are useful. Therefore you don't need any page arguments. The interesting things are in the $_GET (or $_REQUEST).

And then to access the results something like:

function _bh_commerce_stripe_oauth_handle_callback() {
  $scope = $_GET['scope'];
  $code = $_GET['code'];
  drupal_set_message(t('_commerce_stripe_oauth_handle_callback: called'));
  drupal_goto('&lt;front&gt;');
}