If for some reason a Worldpay Business Gateway callback fails, it can often be difficult to manually complete an order.

The quickest way, is actually very simple, and that is to simply use curl to resubmit the callback. This is assuming you have found, and if necessary corrected, the issue that stopped the callback succeeding in the first  place.

When a callback fails, either through a time out or some internal (500) error, you will receive an email from Worldpay notifying you. This mail includes two attachments one the request data Worldpay sent to your callback URL including the encoded post data as well as the response from your server.

Now assuming you work around your security arrangements (e.g your callback URL should listen only to certain addresses and expect auth credentials), you can use curl to resubmit your post data:

curl -d ‘testMode=0&authCost=716.86&currency=GBP&address=15+Somewhere+Street&countryString=United+Kingdom&callbackPW=xyz&installation=2555555&fax=&countryMatch=Y&transId=1000000000&AVS=2222&amountString=%26%23163%3B716.86&postcode=XX11+1XX&msgType=authResult&name=Mr+Test+Tester&tel=0208+111111&transStatus=Y&desc=Test+Transaction+1234&cardType=Visa+Delta&lang=en&transTime=1277741069650&authAmountString=%26%23163%3B716.86&authAmount=716.86&ipAddress=80.80.80.80&cost=716.86&charenc=UTF-8&instId=2555555&amount=716.86&compName=Testing Tester&_SP.charEnc=UTF-8&country=GB&rawAuthMessage=cardbe.msg.authorised&authCurrency=GBP&[email protected]&cartId=12345678&rawAuthCode=A&authMode=A’ \
'https://mysite.com/callback'

Now your program can handle the completion of the order as normal.

You can make this more sophisticated, by having a mail reader retrieve any missed payment notifications and parse them. With each failure notification you can add a retry to a job queue, or other batch processing stack. It would be worth adding some sort of retry threshold though, as well as sending notifications to developers to ensure there is no serious malfunction occurring.