Implementing a new Payment Gateway
Hi Everyone,
I'm in desperate need of some guidance. As the title suggest, I'm in the midst of implementing a new payment gateway (Webcash) for a South African client. This is what I've managed to do:
- Created a custom admin area that saves the Webcash variables (Merchant Identity number & Merchant Key) as provided by them;
- Created a checkbox on the admin area that, when checked overrides the PayPal Gateway (It'll be either / or - not both at the same time);
- Implemented a custom currency symbol (ZAR) that shows on the front end;
Now here's my problem - everything works perfectly until you get to the last step in the job submit process: actually processing the form in the backend. I'm able to do one of two things:
-- I can create a form (with a POST method, and an Action that happens on the Webcash side of things) that redirects the user to the payment area; But then the job doesn't get written to the database... OR
-- I can get the job to write to the database, but then I'm not redirected to the payment page.
I need to be able to do both: get redirected to the payment page AND get the job written to the database (obviously). Any help would be greatly appreciated as I've been stuck on this for about 6 hours now...
Here's the code that the Webcash Client needs to process the payment (It's different to how PayPal processes payment):
Code:
<?php
$pvtKey = get_option('jr_jobs_webcash_key');
$merchantIdent = get_option('jr_jobs_webcash_ident');
$tx_id = time();
$unique_merchant_key = MD5($tx_id . $pvtKey);
?>
<p>
<input type="hidden" name="amount" value="240.00" />
<input name="merchantIdent" type="hidden" value="<?php echo $merchantIdent ?>"/>
<input name="email" type="hidden" value="customer@email.com"/>
<input name="description" type="hidden" value="List Job as Featured"/>
<input name="transaction" type="hidden" value="<?php echo $tx_id ?>"/>
<input name="merchantKey" type="hidden" value="<?php echo $unique_merchant_key ?>"/>
</p>
How would I go about processing/sending this code with a redirect to the Webcash Client AND get the job to still save to the database?
Any help would be greatly appreciated... Please note, I'm a front end developer and while I'm very proud of how far I've gotten I'm by no means in my element