Hello,

I am trying to create another pay direct method for pay api and was closely looking at the paypal example. Unfortunately the pay_direct_method only does a simple redirect with the post values clearly visible @ the url.

          // pay_method_direct.inc

          // Effect a redirect to the direct payment gateway.
          if ($this->activity->action && $this->activity->action != 'pending') {
            unset($form_state['storage']);
            $form_state['rebuild'] = FALSE;
            $form_state['redirect'] = $this->direct_request();
            break;
          }

Lots of other payment gateways does not allow that nor do they give any infrastructure to support developers with url tricks like what sandbox paypal did.

To resolve situation id like to propose to make use of the lessons learned from drupal commerce Issue number : http://drupal.org/node/1110334 Automatically submit the payment redirect form on the Payment checkout page

They pretty much create another menu handler do a hidden values of the previous posted fields then has a target to the payment gateway and on page display voila through a .. js redirect script.. it does automatic redirect.

Comments

chriscalip’s picture

Yes, contrib developers of the payment gateway handlers can implement this trick through the form_submit override at their own pay_direct_method implementation.. but each contrib module of pay api will have to go through this .. instead of what drupal commerce manage to pull off and letting their contrib payment gateways just do a simple setting of 'offsite_autoredirect' => FALSE,

chriscalip’s picture

Trying to workaround the situation .. through the pay_direct_method implement of form_submit.. and do a drupal_execute on a form with external post action pointed to gateway, fields preppoped from mapped fields., drupal execute cant seem to post action to an external url.

chriscalip’s picture

drupal_execute seems to execute post actions its just that the current user doesnt get redirected along with the post. pretty much just a curl post, not the desired behavior.
as of now, i think drupal_execute is not the right path to go about this. looks like kinda stuck with drupal commerce workaround.

chriscalip’s picture

Title: Automatically submit the payment redirect form on the Payment checkout page » Implement api structure of intermediate form pages to facilitate development of "direct method" payment modules
chriscalip’s picture

so on the event pay api form submit:
a.) redirect to an intermediate form page i.e. pay/gateway/intermediate/%pay_activity
b.) intermediate form page contains user intent form values "first name, last name, email, etc.."
c.) intermediate form page contains a js script that automatically submit the form page to the payment gateway

I will release a payment api contrib "direct method" module soon.. that implements this idea.

jlyon’s picture

@chriscalip: Have you made any progress on your "direct method" module? If so, could you post the code (whatever you have) somewhere? I am going to be working on Dwolla integration that I think could use it, and I would be happy to help out with some of the work on it. Thanks!

chriscalip’s picture

@jlyon

Why yes! Yesterday released a working module ! uPay http://www.drupal.org/project/upay Unfortunately I have not documented this yet, currently creating a blog and videocast of how-to-use and how-to-configure.

Here's a rough how-to-install

So to use upay module.

a.) go to payment api overview settings page. @admin/settings/pay
b.) create a payment method instance @location admin/settings/pay/add using Touchnet uPay Payment Gateway
c.) Fill out settings.
UPAY_SITE_ID: XXX
EXT_TRANS_ID prefix: XXXX
Live URL : XXXXX
Test URL: XXXXX
Test mode: XXX
----- OPTIONAL if using webform_pay -----
d.) Create a webform with simulating fields to be passed to upay. Create payment information field.
e.) Map payment api fields to current node webform fields.

jlyon’s picture

@chriscalip: Thanks! That looks pretty straight-forward. I'll try playing around with it in the next couple days.

chriscalip’s picture

Cool looking forward to your work. keep in touch.

chriscalip’s picture

Issue summary: View changes

added location of code