Dynamic Payment Method required Input Field for Ubercart Checkout I have a site running with Drupal 7.12 and Ubercart 3.0. I am creating a custom payment module which is used to pay by mobile phone. The workflow is:


User enters his mobile phone number in the checkout page
When he clicks on "verify phone number" he gets an SMS with a PIN which he has to enter in another input field.


The PIN field is a required field, but only if this specific payment option is chosen.

I know that i can add additional information by returning an instructions array in my callback method, like this:

function uc_my_payment_method($op, &amp;$order) {
    switch ($op) {
        case 'cart-details':
            $build['instructions'] = array(
                '#markup' =&gt; t('Your mobile phone') . ': ' .
                     /* some markup for the new input fields */
                    '&lt;br /&gt;'
            );
            return $build;
    }
}


But i am stuck at the form elements. Can you help me? Do you need additional information?
It's a bit late but just for reference for anyone finding this page as a search result: From what I found out by experimenting, you are right that you need to return an element. Actually what I had to do in my case was to use the following code:

$form = array();
$form['mobile_phone'] = array(
  '#type' => 'textfield',
  '#title' => t('Mobile phone'),
  '#description' => t('Enter your mobile phone number here and a PIN will get sent to you.'),
);
return $form;

You just build a normal form and it gets drupal_rendered when needed.