|
Resources: hippoVEND: Automated Notification System (ANS)
hippoVEND servers (1.6.2 or greater) have the ablity to use an Automated Notification System (ANS). In short, this means that a server can send you data when a sale is made; either to an email address of your choice, or to a web address. This allows you to easily write additional applications that log, manage or respond to sales data. The data format we use (more on this below) is compatible with other ANS formats in Second Life, opening up all kinds of possibilities.
Activitating ANS
If you edit your server’s "_config" notecard, you’ll find some ANS-related settings you can specify in it:
USE ANS: <Yes/No>
e.g. USE ANS: No
- Determines whether or not the server uses ANS
ANS EMAIL: <address>
e.g. ANS EMAIL: mydata@megacorp.com
- If you want the server to send ANS data to an email address, provide it here
ANS URL: <address>
e.g. ANS URL: http://www.megacorp.com/ans_processor.php
- If you want the server to send ANS data to your website, provide an address.
ANS SECURITY CODE: <string of numbers and or letters>
e.g. ANS SECURITY CODE: 12345678abc
- This will be passed to your email or web page along with other data; it enables you to verify that ANS data sent is genuinely from your server.
ANS VERIFICATION: <Yes/No>
e.g. ANS VERIFICATION: No
- If sending ANS data to a web address, this setting will tell the server to wait for a confirmation that the data was received before deleting it from its message memory. Note: the server can only hold 4 messages in the queue, after which a new one will replace the oldest one. For how to verify you received a message, see below.
ANS Message Format
Messages consist of fieldnames and data. If sent to the web, data is sent using GET. If sent via email, data consists of fieldname=data string, separated by the bar (|) character. Here is a list of the fields that will be sent (depending on the vendor type, not all will necessarily have data in them).
| Fieldname |
Contents |
| Source |
Always "Hippo" |
| Type |
Always "Purchase" |
| Currency |
Always "SLL" for Second Life Linden dollar |
| TransactionID |
A unique code that identifies each sale in our databases. |
| ProductName |
Product name of the item purchased. |
| InventoryName |
Name of the Second Life object that was delivered by the server. |
| PayerName |
Name of the avatar who purchased the item |
| PayerKey |
Key of the avatar who purchased the item. |
| ReceiverName |
Name of the avatar who received the item. |
| ReceiverKey |
Key of the avatar who received the item. |
| Region |
Second Life region where the vendor was located. |
| Location |
Coordinates within the region where the vendor was located. |
| ProductID |
Unique code representing the product in our database. |
| MerchantName |
Name of the seller (if this was e.g. a catalogue sale); otherwise it'll be your own name. |
| MerchantKey |
Key of the seller (if this was e.g. a catalogue sale); otherwise it'll be your own key. |
| PaymentGross |
Gross transaction amoun. |
| PaymentFee |
Any commission (to Hippo and/or a catalogue vendor owner). |
| PaymentShared |
Any money distributed via payment shares. |
Verifying receipt of ANS messages
If you’ve turned verification on for a server, your web page should return the string “ANS_OK:” followed by an MD5 hash of the ANS security code and the transaction ID. So, for example, if your ANS security code is the phrase “TOPSECRET”, then your PHP might look like this:
echo "ANS_OK:".md5("TOPSECRET".$_GET["TransactionID"]. ":0");
The ANS processor in the server will then know that you’ve safely received the message and will remove it from the message queue.
WARNING: Don’t have your web page return overly long pages after an ANS call; it could cause a memory overload on the ANS processor script; just return the verification message.
|