Warscale 95 - Paypal integration... feature complete!!!
by Guimo · 06/16/2011 (7:43 am) · 1 comments
Hi Everybody!
It's been three weeks of hectic work but I'm quite pleased to inform the Paypal integration for Warscale is finished.
Paypal Integration
To be honest, I had never integrated a payment system before. I could only imagine the required steps and in fact, with a couple surprises, everything worked as expected.
Let me share the process (in general lines) should anyone may like to do it.
a. user browse and picks the items to buy. Each site handles this on its own way, so there is no point in commenting about this.
b. User reviews the items. Just a summary of items and totals. As Warscale is a one item per transaction only, there was no need for this.
c. Save your order in a DB, assign a unique id.
d. Send the order to papal. It's nothing mystical really but there are some interesting parameters to consider:
- The business number, is assigned by paypal when you create a business account. Nothing fantastic really.
- The server name. Use www.paypal.com or www.paypal.sandbox.com. The sandbox is a must to test your paypal payment processes. It also has an IPN testing tool (read about the IPN ahead).
- The item_number parameter where I set the unique id for my order.
- The return and return_cancel pages. The return and return_cancel are just simple "thank you" or "oh snap!" pages. No code needed. These will be automatically called when the user pas or cancels the order. Remember to turn the AutoRedirect feature on in your account.
- The IPN return page parameter.This is an important one. The IPN (Instant Payment Notification) script is called in an asynchronous process by paypal. If the call fails, the server will attempt again and again until it succeeds. While you really can handle the order finalisation events in the success or cancel pages using the redirect, the user may close his browser at any time cancelling your extremely important order update processes, so it is really a bad idea to put your throat in such delicate situation.
The IPN is called by the Paypal server and depends on your server and the paypal server only so there is little chance for failure and way less chance for hacking. Of course you could go for the extremely secure way and handle the order updating in the success/cancel pages AND in the IPN page. Personally I think its overkill.
In any case, if you are using IPN, remember to turn on the Instant Notifications service in your business page. It is really important. Also turn on the auto redirect in order to allow
e. The IPN page is a script which handles a call by the paypal server. The server sends a transaction ID which you use within the script to connect to the paypal server and extract all that transaction information including the item_number which hold your order id and the transaction status. If the status is cancelled then delete the order, if the transaction is succeed then mark the order as ready to process.
Order processing
In Warscale, the database is divided. I have a public web database and a closed game database. The close one is not exposed in any way to the internet. The main Warscale server connects via https scripts to the web server every 2 minutes, extracts any pending tasks (password updates, new registrations, password recoveries, pending orders) and executes the actions in the closed database, then updates the states in the web databases so the commands are not run again. The main database will also run a cleanup task every 7 days in order to remove older unnecessary records.
So in this case the master server will connect to the web server and download the list of completed orders. Then it will update the player accounts and, if the player is connected, will inform the players about the changes in their accounts. If the players are disconected, the information process is kept on hold and the player will be informed the next time he logs into the game.
I think all the process is quite sturdy. The is only one point which is hackable but not that much, and I have a solution for that too if things become difficult.
And as John Kovalic said... if you have never been hacked then you are nobody... (read The Dork Tower!!!)
More equipment
Seven more weapons for your avatars to hold! A battle axe in different materials. Battle axes are way more destructive than swords, but always require two hands so no place for shields.





If you join this axes with the swords I introduced in my previous post, you get a nice view of the Warscale element scale.
Feature complete!!!!
Warscale is now feature complete. I'm lacking more secondary features like some way more solid single player games. Also I have to fix tiles and improve some things, but that is exactly the point, its all way up from here on... the game is complete!!!!
With that in mind, I plan to call this version Warscale Beta 3 and restart again all the servers!
More creatures and equipment
To be honest, the creatures in Warscale are very very lame. But, as I mentioned, Quinton has licenses for all the MMOWorkshop creatures so the next step, along with GUI improvements, will be add up to the creature collection.
Nothing else.
Luck to you all in your projects!!
Guimo

Torque Owner Leathel Grody
Lethal Games