I have set up a Drupal site to connect to an external payment gateway (not using Drupal Commerce) for subscription-based billing. So making use of Drupal Webform, I have created forms for users to provide their payment information. Live site will be behind SSL.

What I would like to know is:

  1. Where do I start by taking the details of the completed Webform and submitting it to the Payment Gateway's XML web service? Essentially, what I'm looking for is some hook into when the form is filled in, to trigger some code (which I already have setup and tested in a separate plain PHP app) to call the Web Service; and then
  2. Based on the response that I get from the Payment Gateway, to add the logged in user to a specific role?

Your help will be greatly appreciated! Thank you in advance


1 Answer 1


While you could utilize hooks like hook_form_FORM_ID_alter setting custom #validate & #submit functions or hook_webform_submission_insert, I've had better success using the Payment module and writing a custom Payment Method class.

  • Hi freality, thank you for the suggestion! I didn't realise that Payment module could be used as a stand-alone solution.
    – maGz
    Commented Mar 20, 2016 at 22:53

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

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