Forums / Addon Payment Modules / WorldPay Module for ZenCartv1.3x

WorldPay Module for ZenCartv1.3x

Locked

Views: 137,250

Results 41 to 60 of 464
This thread is locked. New replies are disabled.
19 Aug 2006, 4:11 PM
#41
duncanad avatar

duncanad

Zen Follower

Join Date:
Nov 2004
Location:
Glasgow, Scotland
Posts:
247
Plugin Contributions:
0

WorldPay Module for ZenCartv1.3x

Michael,

Glad to hear you finally got to the bottom of your problem - and sorry that you had to do this largely by yourself.

Which version of PHP is installed on your server?

I've eventually got round to doing some research as to why you had to change the code in includes/templates/template_default/templates/tpl_wpcallback_default.php as you indicated eg:

if(isset($HTTP_POST_VARS['transId'])) {$transId = $HTTP_POST_VARS[transId];}

to

if(isset($_POST['transId'])) {$transId = $_POST[transId];}

etc.

It seems that $_POST was introduced in PHP v4.1 The data contained in this array is global.

$HTTP_POST_VARS contains the same data as $_POST but the data is NOT global.

For versions of PHP before v4.1 $HTTP_POST_VARS needs to be used or the code won't work. This is used in the WorldPay module since it should work for versions of PHP both before and after v4.1.

EXCEPT that $HTTP_POST_VARS is now deprecated and is now turned off by default in newer versions of PHP (v5.1 on).

So for all versions of PHP up to v 5.0 the current code will work. For servers with PHP v5.1 and above it won't work by default.

The solution is to either configure the server so that $HTTP_POST_VARS is turned on or replace the existing code with the new code as per your post.

Does anyone know of a more elegant solution, one which allows the code to work regardless of PHP version? Or should all code now use $_POST with the expectation that everyone should be using PHP 4.1 or greater?

I imagine this will effect other areas of ZenCart.

Regards,

Alan

workingIT.co.uk
working IT for business

20 Aug 2006, 5:12 AM
#42
rikki avatar

rikki

New Zenner

Join Date:
Mar 2006
Posts:
17
Plugin Contributions:
0

Re: WorldPay Module for ZenCartv1.3x

Hi Duncan,

Sorry for not explaining myself fully. What I meant was that I have set up the system for my friend and it's all setup live at WorldPay and also on the ZenCart module side.

When I mentioned moneys and account I was referring to my own personal bank account that has been debited with the correct amount of money when I make purchases but the screen still displays "this is a test transaction" in the browser.

In essence everything is working perfectly, but it displays "this is a test" to the customer.

I was wondering if anyone had any ideas on fixing this or if I should just butcher the line of text out of the PHP file (which is not the ideal situation LOL).

Many thanks for your help on this.

Kind regards,

Rikki

20 Aug 2006, 10:12 AM
#43
duncanad avatar

duncanad

Zen Follower

Join Date:
Nov 2004
Location:
Glasgow, Scotland
Posts:
247
Plugin Contributions:
0

Re: WorldPay Module for ZenCartv1.3x

Rikki,

A number of questions for you - I need answers to them all unfortunately.

When you say you have set it up live at WorldPay:

1: Have you forwarded an Activation Request Form to WorldPay?
2: Have WorldPay tested the installation and given you the go ahead to put through live transactions?

This is very important since you should not send any live transactions (test mode 0 in the module admin) until WorldPay have activated the account.

What is the 'Transaction Mode' set to in the module admin?

In your WorldPay control panel configuration you should have the following settings:

Callback URL: http://<wpdisplay item="MC_callback">

Callback Enabled: box ticked

Use callback response? : box ticked

Attach callback data to failure email? : box ticked

You should certainly not just 'butcher the line of text out'.

in includes/templates/template_default/templates/tpl_wpcallback_default.php st lines 208 and 320 the code is

		  
if ($testMode !== 0) {echo WP_TEST_HEADING . "<br /><br />";} 

$testmode is sent by the Zencart script to WorldPay as part of the transaction token. WorldPay simply return this unchanged with their response. $testmode is set to the value of Transaction Mode set in the module admin - ie '0', '100', or '101'.

The logic is if it's not '0' then it must be '100 or '101' so display the 'Test transaction' message.

Regards,

Alan

workingIT.co.uk
working IT for business

20 Aug 2006, 2:53 PM
#44
rikki avatar

rikki

New Zenner

Join Date:
Mar 2006
Posts:
17
Plugin Contributions:
0

Re: WorldPay Module for ZenCartv1.3x

Hi Alan,

  1. It has been tested and is live, WorldPay have been on to it and conducted their testing/audit/test purchase.

  2. Yes

I've grabbed screens of everything you asked for here, see if there is anything you can spot as Ive gone a bit cross eyed looking at it all :D

removed humongus screenshot

...

Kind regards,

Rikki

duncanad:

Rikki,

A number of questions for you - I need answers to them all unfortunately.

When you say you have set it up live at WorldPay:

1: Have you forwarded an Activation Request Form to WorldPay?
2: Have WorldPay tested the installation and given you the go ahead to put through live transactions?

This is very important since you should not send any live transactions (test mode 0 in the module admin) until WorldPay have activated the account.

What is the 'Transaction Mode' set to in the module admin?

In your WorldPay control panel configuration you should have the following settings:

Callback URL: http://<wpdisplay item="MC_callback">

Callback Enabled: box ticked

Use callback response? : box ticked

Attach callback data to failure email? : box ticked

You should certainly not just 'butcher the line of text out'.

in includes/templates/template_default/templates/tpl_wpcallback_default.php st lines 208 and 320 the code is

if ($testMode !== 0) {echo WP_TEST_HEADING . "<br /><br />";}

> 
> $testmode is sent by the Zencart script to WorldPay as part of the transaction token.  WorldPay simply return this unchanged with their response.  $testmode is set to the value of Transaction Mode set in the module admin - ie '0', '100', or '101'.
> 
> The logic is if it's not '0' then it must be '100 or '101' so display the 'Test transaction' message.
> 
> Regards,
> 
> Alan
20 Aug 2006, 2:54 PM
#45
rikki avatar

rikki

New Zenner

Join Date:
Mar 2006
Posts:
17
Plugin Contributions:
0

Re: WorldPay Module for ZenCartv1.3x

removed humongus screenshot

...

20 Aug 2006, 2:55 PM
#46
rikki avatar

rikki

New Zenner

Join Date:
Mar 2006
Posts:
17
Plugin Contributions:
0

Re: WorldPay Module for ZenCartv1.3x

and the last one :

removed humongus screenshot

Shows the money is indeed being transfered out of the customers credit / debit card account as noted above. That is for a previous purchase I made a few days ago as the one shown in the previous screen grabs obviously hasnt gone through the process of appearing on my statement just yet.

Any ideas on this puzzler :S

Kind regards,

Rikki

20 Aug 2006, 8:06 PM
#47
duncanad avatar

duncanad

Zen Follower

Join Date:
Nov 2004
Location:
Glasgow, Scotland
Posts:
247
Plugin Contributions:
0

Re: WorldPay Module for ZenCartv1.3x

Rikki,

Thanks for the comprehensive reply. It makes things so much easier to eliminate what is NOT causing the problem when you have all the information.

You have the 'Transaction Mode' set to '0' so that is OK.

Your WorldPay screenshots show that the purchase token received by WorldPay has $testMode = 0 otherwise each of the WorldPay screens would have

'TEST MODE - this is not a live transaction'

in red at the top.

That's OK too.

So there must be something wrong with the WorldPay response or the way your installation is handling the WorldPay response. This points to the file:

includes/templates/template_default/templates/tpl_wpcallback_default.php

or the version of this file you have in your custom template file e.g.

includes/templates/your_custom_template/templates/tpl_wpcallback_default.php

Have you customised this file in any way?

Check the code at line 206. It should look like this:

<?php 
	      //echo '<WPDISPLAY ITEM=banner>';
		  if ($testMode !== 0) {echo WP_TEST_HEADING . "<br /><br />";}
		  echo WP_CONTACT_HEADING . "<br /><br />";
	  	  echo $name . "<br/>";
		  echo $address . "<br />";
		  echo $postcode . "<br />";
		  echo $country . "<br />";
		  echo "Tel: " . $tel . "<br />";
		  echo "Email: " . $email . "<br /><br />";		  
		  echo WP_PAYMENT_HEADING . "<br /><br />";
		  echo $authAmountString . " has been debited from your " . $cardType . " card.<br />";
		  echo "Our ref: " . $cartId . "<br />";
		  echo "Your WorldPay Transaction ID is " . $transId . "<br />"; 
?>

This is the code which displays the information for a successful transaction. As I said in my previous post it's the following line which determines whether the 'Test transaction' message is displayed.

 if ($testMode !== 0) {echo WP_TEST_HEADING . "<br /><br />";}

Also at line 319

 <?php 
	  //echo '<WPDISPLAY ITEM=banner>';
	  if ($testMode !== 0) {echo WP_TEST_HEADING . "<br /><br />";}
	  echo WP_CANCELLED_HEADING . "<br /><br />";	  
	  echo "Our ref: " . $cartId . "<br />";
?>

This is the code for the information displayed when a transaction fails or is cancelled.

Check that this two pieces of code have not been changed in any way.

You could also add an additional line of code to test the value of $testMode being returned by WorldPay as follows:

echo '$testMode = ' . $testMode . "<br /><br />";

This should be positioned so that the above two pieces of code now look like this:

<?php 
	      //echo '<WPDISPLAY ITEM=banner>';
	 	  echo '$testMode = ' . $testMode . "<br /><br />";
		  if ($testMode !== 0) {echo WP_TEST_HEADING . "<br /><br />";}
		  echo WP_CONTACT_HEADING . "<br /><br />";
	  	  echo $name . "<br/>";
		  echo $address . "<br />";
		  echo $postcode . "<br />";
		  echo $country . "<br />";
		  echo "Tel: " . $tel . "<br />";
		  echo "Email: " . $email . "<br /><br />";		  
		  echo WP_PAYMENT_HEADING . "<br /><br />";
		  echo $authAmountString . " has been debited from your " . $cardType . " card.<br />";
		  echo "Our ref: " . $cartId . "<br />";
		  echo "Your WorldPay Transaction ID is " . $transId . "<br />"; 
?>
          <br />
<?php

and

<?php 
	  //echo '<WPDISPLAY ITEM=banner>';
	  echo '$testMode = ' . $testMode . "<br /><br />";
	  if ($testMode !== 0) {echo WP_TEST_HEADING . "<br /><br />";}
	  echo WP_CANCELLED_HEADING . "<br /><br />";	  
	  echo "Our ref: " . $cartId . "<br />";
?>

For a successful transaction you should see this on the callback page:

Response from WorldPay:

$testMode = x

This is a TEST TRANSACTION. No money has changed hands

Please check your contact details. If there are any errors please contact us immediately.

Fred Flintstone
Bedrock
6000BC
USA
Tel: 1234 567 8910
Email: [email protected]

Your payment details are detailed below. If you have experienced any problems with your payment please contact WorldPay immediately.

£41.24 has been debited from your Visa card.
Our ref: 12ee209e338e85761a568e2da2dcff39
Your WorldPay Transaction ID is 190601916

You will find WorldPay contact information here

and for a failed or cancelled transaction you should see this on the callback page

Response from WorldPay:

$testMode = x

This is a TEST TRANSACTION. No money has changed hands

Your payment has been cancelled. Please contact us for alternative methods of payment. If you have experienced any problems with your payment please contact WorldPay immediately.

Our ref: 12ee209e338e85761a568e2da2dcff39

You will find WorldPay contact information here

If x= 0 then all is well with the WorldPay callback response and the problem lies in your installation. If x = anything other than '0' then there is something wrong with the WorldPay response.

To test this put through a test purchase but click on 'Cancel' once you reach the WorldPay payment pages. Testing using a cancelled transaction will save further transaction charges and debits on your credit card.

Let me know how you get on.

Alan

workingIT.co.uk
working IT for business

22 Aug 2006, 3:47 PM
#48
jamie_scott avatar

jamie_scott

New Zenner

Join Date:
Aug 2004
Posts:
66
Plugin Contributions:
0

Re: WorldPay Module for ZenCartv1.3x

Hi all,

A further question about the latest WordlPay module. We need a Worldpay account to support multiple websites and therefore it would be ideal if each Zen site could send a unqiue Order_Id style e.g. ABC123, DEF123. Currently we are using different Order ranges

Site 1 - 10000+
Site 2 - 30000+
Site 3 - 50000+

One problem we have is that although each Zen cart store can use a different Order number range, the ID that Worldpay seems to receive/display is not applicable.

See attachment jpg.

The result was as follows:

Zen Cart Order Number = 10000
WorldPage Ref = 32ea519b65894d887094
WoldPay Transaction ID = 190893444

Question - Is it possible to send a ref to Worldpay so we can change their reference to either “10000” or "ABC-10000" or even "ABC-190893444"

Any help would be most appreciated

Regards

Jamie

22 Aug 2006, 7:24 PM
#49
jamie_scott avatar

jamie_scott

New Zenner

Join Date:
Aug 2004
Posts:
66
Plugin Contributions:
0

Re: WorldPay Module for ZenCartv1.3x

Update - Just spoken with WorldPay and they said that they only return back the number or charcters that they are sent.

If that's true, then this means we are sending them "190893444" -hummm, I can't believe that....

Any help would be appreciated.

22 Aug 2006, 7:37 PM
#50
duncanad avatar

duncanad

Zen Follower

Join Date:
Nov 2004
Location:
Glasgow, Scotland
Posts:
247
Plugin Contributions:
0

Re: WorldPay Module for ZenCartv1.3x

Jamie,

The way the WorldPay interface works is as follows:

When a customer clicks the final 'Confirm' button in the checkout process a 'Purchase Token' is sent to WorldPay. This contains data such as the customers name and address, the value of the purchase etc. Most of this data is returned to the callback URL via the WorldPay response.

I addition to the standard data you can include any data you want and, provided you use the correct naming conventions, WorldPay will use this data either in your WorldPay customised customer pages or return it unchanged in their response (or both).

Unfortunately you cannot send your order number in the purchase token since the order is not created until a 'Success' response is received from WorldPay. If we were to create the order before sending the purchase token to WorldPay and the customer cancelled the order on the WorldPay screens or their card was rejected we would have an order to fulfill but no payment will have been processed.

I'm afraid you are stuck with WorldPay's Transaction ID as this is their unique identifier for the transaction.

The ZenCart Order Number appears on the callback 'Success' page. This is the earliest time that it can appear since it is newly created as part of the callback process. If you have set a range for each of your installations then each installation should have a unique set of Order Numbers. The Order Number is not provided in the WorldPay callback response it is created by Zencart as a result of a 'Success' response from WorldPay.

I'm not sure what it is you want to use these references for. I do know that it can be difficult to cross reference ZenCart orders with transactions detailed in the WorldPay Statement. The WorldPay statement details the WorldPay Transaction ID and The ZenCart Cart ID. Although both these references appear on the callback page and in the Worldpay email they are not stored in the Orders table within the database. I think what you may really be after is for the WordPay Transaction ID to be stored in the Orders table and displayed in the Orders screens within the ZenCart admin. I know others have asked for this and I have in mind to do this when I revisit the module this month.

If you want the Transction ID to be in the format "ABC-190893444" you will need to amend the following file:

includes/templates/template_default/templates/tpl_wpcallback_default.php

Change line 31 from:

	if(isset($HTTP_POST_VARS['transId'])) {$transId = $HTTP_POST_VARS[transId];}

to:

	if(isset($HTTP_POST_VARS['transId'])) {$transId = 'ABC-' . $HTTP_POST_VARS[transId];}

This will display the transaction ID as "ABC-190893444" on the callback page but will not store this value anywhere and the WorldPay Statement will still show the Transaction ID as "190893444" so I don't know if this will have achieved much.

You can find out more about how the WorldPay Select Junior integration works on the support section of the WorldPay website at https://www.worldpay.co.uk

I hope this helps.

Regards,

Alan

workingIT.co.uk
working IT for business

22 Aug 2006, 7:42 PM
#51
duncanad avatar

duncanad

Zen Follower

Join Date:
Nov 2004
Location:
Glasgow, Scotland
Posts:
247
Plugin Contributions:
0

Re: WorldPay Module for ZenCartv1.3x

Jamie,

Our posts have just crossed.

You are quite right the transaction ID is created by WorldPay not by Zencart. WorldPay are nearly correct in that most of the data sent in the WorldPay response is a return of the data sent in the purchase token.

Regards,

Alan

workingIT.co.uk
working IT for business

23 Aug 2006, 1:57 PM
#52
jamie_scott avatar

jamie_scott

New Zenner

Join Date:
Aug 2004
Posts:
66
Plugin Contributions:
0

Re: WorldPay Module for ZenCartv1.3x

Thanks for your help Alan.

The difficulty is that from within the WorldPay Admin area there seems to be no reference to which store made the sale and then when we view a sale in Zen-Admin we get to only see our Zen Order Number.

We'll keep thinking...... ;)

Thanks once again

23 Aug 2006, 3:00 PM
#53
duncanad avatar

duncanad

Zen Follower

Join Date:
Nov 2004
Location:
Glasgow, Scotland
Posts:
247
Plugin Contributions:
0

Re: WorldPay Module for ZenCartv1.3x

Jamie,

I'm sorry but I'm a bit confused.

What I understood from your previous posts was that you have three stores ie three separate ZenCart installations all accessing the one WorldPay account for payment processing. No problem with that. A purchase transaction originated from Store 1 will be passed back to Store 1 by WorldPay. A purchase transaction originated at Store 2 will be passed back to Store 2 and Store 3 to Store 3. Each store admin will only display data for orders originated in that store. I can see why you would want identifiable order numbers so that you know which installation to go to check details, but within each store admin there is no dubiety as to where any orders listed originated.

Now I get a sense that what you have is three stores all residing within a single Zencart installation - or perhaps sharing a single database which is a totally different ballgame.

Could you please explain the exact configuration of your three stores.

Regards,

Alan

workingIT.co.uk
working IT for business

24 Aug 2006, 12:18 PM
#54
jamie_scott avatar

jamie_scott

New Zenner

Join Date:
Aug 2004
Posts:
66
Plugin Contributions:
0

Re: WorldPay Module for ZenCartv1.3x

Hi Alan,

Sometimes it's good to talk ;) - having re-read our posting I may of confused you.

You are correct the 1st time, we have 3 different stores which all use the same WorldPay account.

If we log into Worldpay we have difficulty seeing which store made the purchase as we are just shown a list of "Mechant Reference = SESSION_ID" sales.

We therefore, ideally, would like to pass over a Reference to help use identify a) the store and b) the sale.

Ideally this would be

            ABC+Order ID

so we can then relate the Zen-Cart Admin Sale with the WorldPay list of sales.

Hope that is a little clearer ;-) Thanks for all your help so far..

Thanks

Jamie

24 Aug 2006, 3:56 PM
#55
duncanad avatar

duncanad

Zen Follower

Join Date:
Nov 2004
Location:
Glasgow, Scotland
Posts:
247
Plugin Contributions:
0

Re: WorldPay Module for ZenCartv1.3x

Jamie,

I think I have found a simple solution to at least the WorldPay end of the problem.

Log in to your WorldPay account.

Click on 'Get Statement'.

Scroll down until you see 'Statement Configuration'

Click on 'Design Your Statement'

Click on 'New'.

At the top in the 'Column Configuration Name' field enter a name for your statement e.g. 'Custom Statement'

Choose which fields you wish to appear in your statement by choosing a column number from the dropdown lists adjacent to each field. Make sure you assign a column number to the 'Description' field. The column numbers determine the order in which the data is displayed.

Save your configuration by clicking 'Save Configuration' at the bottom.

Go to the bottom of the page again and click 'Back to Statement Request'.

In the 'Statement Request' page select 'Custom Statement' from the 'Column Configuration' drop down list.

Now click 'View Statement'.

You will now see all of the fields you have chosen to include in your custom statement. The description field will contain 'Purchase from "Your Store Name"' where "Your Store Name" will be the name of the initiating store as set up in your store admin - Configuration>My Store>Store Name.

This solves the problem of identifying which transactions have been initiated by which store in your WorldPay statement. It does not solve the problem of which transaction corresponds to which ZenCart Order number. For this it will be necessary to change things such that the WorldPay Transaction ID is stored in the ZenCart database and displayed within the 'Orders' screens in ZenCart Admin. A task for a future version of the WorldPay module. perhaps.

Hope this helps.

Regards,

Alan

workingIT.co.uk
working IT for business

28 Aug 2006, 10:20 PM
#56
rikki avatar

rikki

New Zenner

Join Date:
Mar 2006
Posts:
17
Plugin Contributions:
0

Re: WorldPay Module for ZenCartv1.3x

Hi Alan,

Im back, sorry about the delay:

removed humongus screenshot

Looking at the PHP code comparing for NOT 0 running is confusing me! Is it maybe because the 0 has no quotes around it and is a string and not an integer?

I doubt it as it would have flagged on loads of other systems before now.

Kind regards,

Rikki

28 Aug 2006, 11:13 PM
#57
duncanad avatar

duncanad

Zen Follower

Join Date:
Nov 2004
Location:
Glasgow, Scotland
Posts:
247
Plugin Contributions:
0

Re: WorldPay Module for ZenCartv1.3x

Rikki,

What you have just proved by adding my little snippet of code is that WorldPay are returning the correct value for 'Test Mode' for a live site ie '0'. So the problem is NOT at the WorldPay end.

I suspect you must have made an unintentional change to the code in

includes/templates/template_default/templates/tpl_wpcallback_default.php

line 208 should look exactly like this:

if ($testMode !== 0) {echo WP_TEST_HEADING . "<br /><br />";}

The syntax is as follows:

If the condition defined within the normal brackets is met then do whatever action is defined within the curly brackets.

The condition here is ($testMade !== 0) which basically means $testMode is NOT equal to '0'.

The action if this condition is met is to display the WP_TEST_HEADING text as defined in the language file.

You have just proved that $testMode does equal '0'. This is the only value that should result in the WP_TEST_HEADING text NOT being displayed so there must be something wrong with the syntax of this line of code. Check it very carefully. It should be exactly as shown above.

Regards,

Alan

workingIT.co.uk
working IT for business

29 Aug 2006, 4:29 PM
#58
rikki avatar

rikki

New Zenner

Join Date:
Mar 2006
Posts:
17
Plugin Contributions:
0

Re: WorldPay Module for ZenCartv1.3x

Here is the file, I had not altered it until you showed me how to display the text above.

http://www.kraftybitz.co.uk/tpl_wpcallback_default.php.txt

I've copied it and renamed the copy .txt so you can see it.

Many thanks,

Rikki

29 Aug 2006, 6:41 PM
#59
duncanad avatar

duncanad

Zen Follower

Join Date:
Nov 2004
Location:
Glasgow, Scotland
Posts:
247
Plugin Contributions:
0

Re: WorldPay Module for ZenCartv1.3x

Rikki,

I'm really quite baffled by this one. Your template file is identical to mine and I don't get your problem.

The only other thing I can think of is that there is something a bit awry with your language file.

Could you let me have a look at your includes/languages/english/wpcallback.php file?

Regards,

Alan

workingIT.co.uk
working IT for business

29 Aug 2006, 9:37 PM
#60
rikki avatar

rikki

New Zenner

Join Date:
Mar 2006
Posts:
17
Plugin Contributions:
0

Re: WorldPay Module for ZenCartv1.3x

I thought the same when I viewed the code!

Couldnt be a weird PHP versioning issue with global registers, or string/integer mismatch comparison? eg: ($variable !== "0")

Here is the other file you requested in TXT format.

http://www.kraftybitz.co.uk/wpcallback.php.txt

Many thanks,

Rikki

PS: Ive dropped you a PM.