So, I’ve done some homework and poked around, but I think I may be trying to do this the hard way.
I followed your advice and built an extension using cURL to gather up the POST values and make a cURL connection to the gateway system (though I have no idea how to test what might not be working… it’s not posting any errors presently, but it’s not doing what I want either). I think this might be the wrong way forward. At the very least I’m missing something important.
What I want to do is essentially make the return=”” parameter an external url as opposed to a template path and pass that POST data to that URL after it finished writing to the channel. When the form has been submitted, after writing to the channel, I should be at a shopping cart checkout site that hosted externally.
I’ve found a CI reference to this kind of external redirect CI Redirect - CI forums, but I don’t technically want to do a redirect in the 301 sense. I want to add an action that is an external php url. Here’s the default form code with some account details xx’ed out:
<form id="giftcert" action="https://secure.integritypaymentgateway.com/cart/cart.php" method="POST">
<input type="text" size="6" name="amount" value="53.00" />
<input type="text" size="26" name="merchant_defined_field_1" value="Recipient (if not purchaser)" />
<input type="text" size="24" name="merchant_defined_field_2" value="Full name of purchaser" />
<textarea rows="4" cols="53" name="merchant_defined_field_3">Leave a message here for your recipient</textarea>
<div id="ship_radio">
<input type="radio" name="merchant_defined_field_4" value="by_mail" />
<label>First Class Mail ($1.75 fee)</label><br />
<input type="radio" name="merchant_defined_field_4" value="by_email" />
<label>Digital Delivery (via email)</label>
</div>
<input type="hidden" name="title" value='{current_time format="{DATE_W3C}"}'>
<input type="hidden" name="key_id" value="XXXXXXXXX" />
<input type="hidden" name="action" value="process_variable" />
<input type="hidden" name="order_description" value="Gift Certificate" />
<input type="hidden" name="language" value="en" />
<input type="hidden" name="url_finish" value="http://client_domain.com" />
<input type="hidden" name="customer_receipt" value="true" />
<input type="hidden" name="hash" value="action|order_description|XXXXXXXXXXXXXXXXXXXXXXXXXX" />
<input type="submit" name="submit" value="SUBMIT" />
</form>
So I swapped out the form tags for these:
{exp:safecracker id="giftcert" channel="gift_cert_orders" return="https://secure.integritypaymentgateway.com/cart/cart.php" logged_out_member_id="2"}
<.......rest of the form.......>
{/exp:safecracker}
I’ve also made sure to use a correct return=“site/index” style return parameter, but it still doesn’t work. It just redirects me to my home page regardless.
I don’t have enough characters to paste my extension code, but I’ll put it in the next post for reference.