Jump to content

I've created a Gateway Module from scratch - stuck on one thing.


Guest

Recommended Posts

I had to create a Payment Gateway Module for my bank from scratch as there is currently no module in Cubecart.

I'm a beginner at PHP, but I think I'm doing OK so far.

I've created two files: transfer.inc.php and response.php

transfer.inc.php is correctly sending the order information and MD5 HASH to the bank

response.php is correctly receiving the response from the bank, and it is correctly performing an MD5 to ensure the information is coming from the bank (I instructed my bank to respond to response.php)

My problem is that I don't know how I tie the two PHP files together.

Firstly, I should explain to you the process between Cubecart and my bank

1. transfer.inc.php: I build a string to POST to the bank (amount, orderID, MD5 HASH)

(The MD5 HASH is based on the amount, orderID, and my merchant password)

2. response.php: Once the customer has paid/not paid, the bank POSTs back to response.php: RESULT, orderID, and a new MD5 HASH

3. response.php: I then perform an MD5 HASH on this information to ensure it's from the bank. I then tell Cubecart to process/drop the order depending on the RESULT (which I'm not sure how to do).

In transfer.inc.php - This (as I understand it) is the piece of code that adds the order to the Cubecart DB.

function success(){

		

		if something = value {		

			return FALSE;			

		} else {		

			return TRUE;			

		}	

}

In my case, does that piece of code need to ask response.php for an answer? Or is it up to response.php to tell Cubecart to proccess/drop the order?

I've looked through all the other Gateway modules for function success(), but they all seem to GET a value from the bank (if( $_GET['f']==1 )). My bank doesn't work that way.

How does response.php know what Cubecart session the bank is referring to?

I’d be grateful if someone could enlighten me.

Many thanks.

Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...