I have the latest e-commerce installed and running and I am successfully checking out via Worldpay in test mode but I need some assistance understanding how the callback works.

At the moment I'm getting a successful test transaction and email from Worldpay but it all ends there on the Worldpay site.

What do I have to do next?

Comments

Hi redsmartie,

I created that module a while back for another drupaller..I didn't realise it had been updated for version 5.

In your worldpay configuration page (on worldpay.com), you need to specify the worldpay_callback link back to your Drupal site. Once that is done, the Worldpay module will automatically catch and recognise completed/cancelled transactions and you can specify what is displayed on the moduyle settings page in Drupal.

So if your site is www.example.com your Worldpay call back link will be something like http://www.example.com/worldpay_callback. In other words, you need to tell Worldpay where to go once the transaction is complete/cancelled.

I hope that makes sense. Post up here if you run into bother.

Dub

Dub

I'm still landing on a Worldpay Thank You page. I get the email from worldpay confirming the (test) transaction but there's no attempt to hand back to the site.

Here's the Select Junior config page as it stands.. what else might I need to set?

http://www.redsmartie.com/pics/worldpayconfig.jpg

It's a while since I looked at worldpay...

Isn't there another configuration page where you override the thankyou pages and specify you're using the callback?

Dub

That is the only screen of configurable options

I've noticed that the callback failure count increments and the callback suspended is ticked. If I untick it and try again it continues to increment the failure and suspend the callback.

I have entered my email address for failure notifications and clicked to have full error details sent but nothing has come through to me yet.

edit: I have a reply

Error reported: Callback to http://www.mysite.com/worldpay_callback: NOT OK, recevied HTTP status: 404
Server Reference: mggaeq3a:callbackFailureEmail-26111160:MerchReq-155

(I changed the address in this post to mysite.com)

I've sorted the first (and probably most important one). In the e-commerce worldpay settings page I have the Thank you page/WorldPay callback URL: set as the full url, i.e. http://www.mysite.com/worldpay_callback (as entered on the worldpay site) rather than just worldpay_callback. Once I changed that I started to get the callbacks and status changes on my transactions.

The second problem that may not be able to be fixed but I would like to know what was supposed to have happened is with the three strings of text below this setting. Worldpay_callback - Payment Completed message etc. Worldpay makes no attempt to hand back to the site or is this what Worldpay calls the "callback response"?

edit: sorry if this is a bit "live". I enabled callback response and got handed back to my site although the url was still worldpay until I clicked away.

The problem now is the text specified "WorldPay(tm) has accepted your card and payment has been made. Thank you. Click through to your %link to view/print out invoices and track your order." displays just as that. Isn't the string %link supposed to be replaced with something? Or am I supposed to do that manually?

I'll have to install the module and have a look redsmartie..it's a while since I've used it. It sounds like the callback page isn't picking up the correct links to the invoice.

Are you using version 5.1?

When you go to your orders page, is the worldpay_module correctly marking the transactions as paid?

As I say I didn't realise the module was updated for 5.1 so it looks like that's been done but it hasn't been properly tested.

Dub

I'm using 5.0 as I've yet to update this site to 5.1.

Transactions are properly being marked off as paid.

I've changed the text at the moment due to the fact that I don't need people to track orders as they are single donations in this case (but not my next project).

After searching a bit I, I realised the arguments passed to worldpay were not actual. Here is my fix

If anyone could make a patch out of this please.

function worldpay_goto($txn) {
    global $base_url;
    global $user;
    $worldpay_url = variable_get('worldpay_url', 'worldpay_callback');
    $worldpay_testMode = variable_get('worldpay_testMode', '');
    $worldpay_currency_code = variable_get('worldpay_currency_code', '');
    $worldpay_instId = variable_get('worldpay_instId', '');
    $worldpay_callback_url = variable_get('worldpay_callback_url');
    $billing = $txn->address['billing'];
// FORMAT BILLING ADDRESS AS 1 FIELD FOR WORLDPAY
    $address = $billing->street1;
    if($billing->street2) {$address .= '
' . $billing->street2;}
    if($billing->city) {$address .= '
' . $billing->city;}
    $address .= '
' . $billing->state;
    $postcode = $billing->zip;
    $tel = $billing->phone;
    $email = $user->mail;
// FORMAT BILLING NAME AS 1 FIELD FOR WORLDPAY
    $name = $billing->firstname . ' ' . $billing->lastname;
// BUILD A SUMMARY DESCRIPTION OF ITEMS BEING PURCHASED.
    $description_summary = '';
    $items = cart_get_items();
    foreach ($items as $product) {
        $node = node_load($product->nid);
        $description_summary .= $node->title;
        $description_summary .= ' (x' . $product->qty . '), <br>&#10;';
    }
    $payment_symbol = variable_get('payment_symbol', '');
// BUILD THE URL NEEDED TO REDIRECT TO WORLDPAY
    $url .= "?instId=" . $worldpay_instId . "&";
    $url .= "currency=" . $worldpay_currency_code . "&";
    $url .= "cartId=" . $txn->txnid . "&";
    $url .= "amount=" . $txn->gross . "&";
    $url .= "testMode=" . $worldpay_testMode . "&";
    $url .= "Address=" .  urlencode($address) . "&";
    $url .= "postcode=" .  urlencode($postcode) . "&";
    $url .= "country=" . urlencode($billing->country) . "&";
    $url .= "tel=" .  urlencode($tel) . "&";
    $url .= "name=" .  urlencode($name) . "&";
    $url .= "email=" .  urlencode($email) . "&";
    $url .= "MC_callback=" . $base_url . "/". $worldpay_callback_url . "&";
    $url .= "desc=" .  urlencode($description_summary);
    $url = $worldpay_url . $url;
    return $url;
}

Just what I needed in one of my projects. I was wondering why user email wasn't showing on worldpay payment process page and with this fix it does now. So I made patch with the fix that weedoo posted.

I don't know why I can't attach a file, so I just pasted the content of a patch:

--- worldpay.module-orig 2008-03-29 15:33:33.000000000 +0100
+++ worldpay.module 2008-03-29 16:04:12.000000000 +0100
@@ -218,11 +218,13 @@
function worldpay_goto($txn) {
global $base_url;
+ global $user;
   $worldpay_url = variable_get('worldpay_url', 'worldpay_callback');
   $worldpay_testMode = variable_get('worldpay_testMode', '');
   $worldpay_currency_code = variable_get('worldpay_currency_code', '');
   $worldpay_instId = variable_get('worldpay_instId', '');
+  $worldpay_callback_url = variable_get('worldpay_callback_url', 'node');
$billing = $txn->address['billing'];
@@ -262,9 +264,12 @@
$url .= "testMode=" . $worldpay_testMode . "&";
$url .= "Address=" .  urlencode($address) . "&";
$url .= "postcode=" .  urlencode($postcode) . "&";
+$url .= "country=" . urlencode($billing->country) . "&";
$url .= "tel=" .  urlencode($tel) . "&";
$url .= "name=" .  urlencode($name) . "&";
-$url .= "MC_callback=" . "worldpay_callback1" . "&";
+$url .= "email=" .  urlencode($email) . "&";
+$url .= "MC_callback=" . $base_url . "/". $worldpay_callback_url . "&";
+//$url .= "MC_callback=" . "worldpay_callback1" . "&";
//$url .= "MC_callback=" . $base_url . $worldpay_url . "&";
$url .= "desc=" .  urlencode($description_summary);

Gregor Flajs, Drupal Web developer

Gregor Flajs, Drupal Web developer