Retail API
Documentation
Online POS
More

This is an example web page showing how to implement Prepay card lookups on your website. This example is a recommended approach as it offers a good level of security. This example sends all requests to your webserver, and only your web server makes requests to fieldpine.com


Step 1 - Create a form to capture card details

Card#
Password

Step 2 - Create a handler to get request card details from your webserver

On this web page add logic to send the card and password to your server

    /SomeRequestUrl?card=xxx&pass=yyy

Step 3 - Add logic to your server

On your server implement the "SomeRequestUrl" handler to perform the equivalent of this pseudo code

    function SomeRequestUrlHandler(card, pass) {
        // Create a request object
        var req = new Object;
        req.filter_card = card;
        req.filter_pass = pass;
        req.apikey = YOUR-SECRET-API-KEY;

        // Fieldpine.com requires at least the following two pieces of information to provide
        // some preliminary fraud detection.  If you do not supply this detail
        // you can still retrieve card details at a highly reduced request rate

        req.client_Ip = Client browsers IP address
        req.client_UserAgent = Client browsers User-Agent header

        var x = new XMLHttpRequest();
        var Rm = "1,2,3,4";     //  Retailers RmSystem#.  This uniquely identifies this retailer to Fieldpine
        x.setRequestHeader("X-Api-Key", req.apikey);
        x.open("POST", "https://a1.fieldpine.com/RetailApi,"+Rm+"/request/card_inquiry.js", true);
        x.send(JSON.stringify(req));

        // Actual implementation will need you to handle response from a1.fieldpine.com and return this to your
        // client browser.
    }

Step 4 - Using Multiple servers

Optional.
Each retailer at fieldpine.com is assigned to multiple servers capable of handling requests about their data. You can retrieve a list of servers for a given retailer when you know the RmSystem#.

This Url will return a JSON packet containing various server details for the retail 1,2,3,4. Replace 1_2_3_4 with the retailers actual RmSystem#.
    https://fieldpine.com/anywhere_1_2_3_4/config/hostlist.js
This information is considered public and does not require an API key to retrieve it. The response information is considered slowly changing so you may cache this information for several days without repeating the request.

The response will contain an array called "APIN", which is a list of Api servers that can answer for this retailer. You may query any of the IP addresses supplied. If one server is not currently available, you can optionally fail over to another server. You will see that the response contains details of serveral servers and addresses, including some details which are encrypted.

Example Response

    {
        "RootType":"ARAY",
        "Dt":"09-Dec-2018 11:39:22",
        "APIN":[
            {
        "IP":"a1.fieldpine.com",
                "Type":"api",
                "Geo":"NZ",
                "Priority":1,
                "PUBL":[
                    {"Website":"bx1.fieldpine.com","Priority":1}
                    ,{"Website":"bx2.fieldpine.com","Priority":2}
                    ,{"Website":"bx1.fieldpine.com","Priority":3}
                    ,{"Website":"bx2.fieldpine.com","Priority":4}
                ]
            },
            {
        "IP":"a2.fieldpine.com",
                "Type":"api",
                "Geo":"NZ",
                "Priority":2,
                "PUBL":[
                    {"Website":"bx2.fieldpine.com","Priority":1}
                    ,{"Website":"bx1.fieldpine.com","Priority":2}
                    ,{"Website":"bx2.fieldpine.com","Priority":3}
                    ,{"Website":"bx1.fieldpine.com","Priority":4}
                ]
            }
        ],
        "MESH":[
            {"IP":"m1.fieldpine.com","Type":"meshmemory","Geo":"NZ","Priority":1}
        ],
        "STOR":[
            {"IP":"s1.fieldpine.com","Type":"storage","Geo":"NZ","Priority":1,"Protocol":"http"}
        ],
        "STOE":[
            {
                "IP":"AOKWI38SNDBJDUQML8SKSO20DFN44Y",
                "Type":"storage",
                "Geo":"DE",
                "Priority":1,
                "Protocol":"sj29j91283Bh7FP0XfR6HJ7yhLeYI28nBMuWE93mOkis",
                "Transform":"K1.28947364.FJ392fhfGhj329Kz$b"
            }
        ]
    }

Worked Example

RmSytem#This is server side, but shown here for example purposes
ApiKeyThis is server side, but shown here for example purposes
Card#
Password