How to add fields to a form from a custom module I'm working on a custom module that will allow payments through a particular bank API.

The API requires me to do a POST to a certain URL that they have provided me, where the user will enter his credit card information.
To do so, I created a form with the #action set toward the provided URL, and with the mandatory fields asked by the bank (name, address, phone, etc.)

Unfortunatly, the form is in the module, and I don't think that is good practice, since it gets more complicated for a user to add his own custom field (lets say a date of birth for example).

Is there anyway that my module can get a form created by the form API in another module ("my_custom_cart") and add to it the mandatory fields needed for the transaction?

Thank you
I think using the form #action is the wrong approach there.

You should instead use

drupal_http_request


  Performs an HTTP request.
  
  This is a flexible and powerful HTTP client implementation. Correctly
  handles GET, POST, PUT or any other HTTP requests. Handles redirects.


In your form submit handler, to pass on the required parameters to the payment gateway.

Ensure everything is done under HTTPS.

To get another form, you can simply use

$form = array(); // new form
$defaults = drupal_get_form('my_default_form_builder_function');
$form += $defaults; // add defaults to new form