Post Method Instead of Get

wisdom - June 12, 2008 - 08:08
Project:e-Commerce
Version:5.x-3.4
Component:cart
Category:support request
Priority:normal
Assigned:Unassigned
Status:active
Description

It sounds get method is used to pass data to payment processor. What is the way to change this get method to post.

#1

Dublin Drupaller - January 24, 2009 - 20:34
Component:paypal» cart

bumping this.

You're right. GET is the default.

the workaround involves another step (another page) on the checkout review form. Have a look at the ec_caixa_penedes payment gateway module which uses the POST method for an example.

I'm working on another option i.e. overriding the checkout_review_form using template.php at the moment...will, erm..post back up here if I have any success.

dub

(changing component to CART because that's where the checkout_review_form is )

#2

Dublin Drupaller - January 25, 2009 - 16:03

update

Overriding the checkout_review_forms isn't simple, so I had a look at CURL, which may offer an elegant way of doing it, but, not all servers have libcurl enabled by default. I also glanced at fsockopen, which looked very involved...so I ended up with the following as a balance between simplicity and results.

You can use this snippet to automatically submit the form:

<script language="javascript">document.checkout_confirmation.submit()</script>

Notes: Where checkout_confirmation is the form name..e.g. <Form action="www.example.com/payment" method="post" name="checkout_confirmation">

The snippet automatically submits the form, but, should a customer have javascript completely disabled, the text above the form and "proceed" button, can be something like "Thank you for your order. We are now redirecting you to [payment gateway] so you can make your credit/debit card payment. If javascript is disabled in your browser, click on the button below to proceed."

hope that makes sense
Dub

#3

gordon - January 25, 2009 - 23:43

I have looked at this a number of times, and to do a POST vs a GET you need to redirect to a page which has a bunch of hidden fields and then use some js to submit the form.

I have never liked this as a solution and in v4 I have added functionality to support paypal express (it is broken ATM because of the formapi), which does this much nicer. I also think doing this breaks up the flow of the checkout.

 
 

Drupal is a registered trademark of Dries Buytaert.