How to send form submitted data to paypal in Drupal? I have setup a form where user fill some fields and choose a user type &amp; on submission I have to send him to paypal with the values which he filled up, so that on IPN callback I receive the data from them and do something(this is the procedure I have come to know from reading paypal integration with php), I am stuck at form point because at submission I have another function where I can get the selected value by form_state..

Here is the code --

&lt;?php

//Hook_Menu for paypal callback function.
function user_type_registration_menu(){
  $items = array();
          $items['paypal/payment/ipn'] = array(
          'title' =&gt; t('Paypal Payment IPN'),
          'description' =&gt; t('Paypal Payment IPN'),
          'type' =&gt; MENU_CALLBACK,
        'file'  =&gt; 'paypal_payment.inc',
          'page callback' =&gt; 'paypal_payment_paypal_ipn_callback',
          'access callback' =&gt; TRUE,
        );   
      return $items;
}

//Form alter for registration form.
function user_type_register_form_alter(&amp;$form, &amp;$form_state, $form_id){
  switch($form_id) {
      case 'user_register_form': // the value we stole from the rendered form
        $form['account']['user_type'] = array(
          '#type' =&gt; 'select',
          '#title' =&gt; t('Membership Type:'),
          '#options' =&gt; array(
            0 =&gt; t('General $50.00/Yr'),
            1 =&gt; t('Student $40.00/Yr'),
            2 =&gt; t('Government $60.00/Yr'),
            ),
           '#weight' =&gt; -11,
           '#description' =&gt; t('Select the membership type, which you want to have.'),
          );        
        $form['account']['user_type_submit'] = array(
          '#type' =&gt; 'submit',
          '#value' =&gt; t('Submit'),
          '#submit' =&gt; array('user_type_register_form_submit'),
          '#validate' =&gt; array('user_type_register_form_alter_validate'),
        );        
        $form['account']['name']['#description'] = t('');
        $form['account']['mail']['#description'] = t('');
        unset ($form['actions']);// unset the default submit Button      
        return $form;
      break;
    }   
}

function user_type_register_form_submit($form, &amp;$form_state){  
  $username = $form_state['values']['name'];
  $user_email = $form_state['values']['mail'];
  $user_type = $form_state['values']['user_type'];
  $password = user_password(8);
  switch($user_type){

    case '0':
      dpm("General");
      $membership_price = 50;
      $fields = array(
        'name' =&gt; $username,
        'mail' =&gt; $user_email,
        'pass' =&gt; $password,
        'status' =&gt; 1,
        'init' =&gt; $user_email,
        'roles' =&gt; array(
          DRUPAL_AUTHENTICATED_RID =&gt; 'authenticated user',),
      );
      $account = user_save('', $fields);
      $account-&gt;password = $fields['password'];
      //--Here I have to send if to PAYPAL

      dpm("user registered");
      break;

    case '1':
      dpm("Student");
      $membership_price = 40;
      $fields = array(
        'name' =&gt; $username,
        'mail' =&gt; $user_email,
        'pass' =&gt; $password,
        'status' =&gt; 1,
        'init' =&gt; $user_email,
        'roles' =&gt; array(
          DRUPAL_AUTHENTICATED_RID =&gt; 'authenticated user',),
      );
      $account = user_save('', $fields);
      $account-&gt;password = $fields['password'];
      //--Here I have to send if to PAYPAL
      break;

    case '2':
      dpm("Government");
      $membership_price = 60;
      $fields = array(
        'name' =&gt; $username,
        'mail' =&gt; $user_email,
        'pass' =&gt; $password,
        'status' =&gt; 1,
        'init' =&gt; $user_email,
        'roles' =&gt; array(
          DRUPAL_AUTHENTICATED_RID =&gt; 'authenticated user',),
      );
      $account = user_save('', $fields);
      $account-&gt;password = $fields['password'];
      //--Here I have to send if to PAYPAL
      break;
  }
}

function user_type_register_form_alter_validate(){

}


I hope somebody can help...
I'm the maintainer of Drupal Commerce and of the Commerce PayPal module. I'm afraid your question is too broad to be answerable here, but for folks looking to solve the same issue, you should check out the code in my Commerce PayPal module. It provides a full integration of WPS, WPP, EC, and PPA / Payflow Link.

For general Drupal support, there are much better channels to pursue. I'd look into videos or books specifically focusing on the Forms API or just dive into module code like mine to learn through investigating working examples.