Integrating Deposit Pages

Overview

The tutorial below guides you through the process of integrating a deposit page into an Android app (with Java code samples).

Prerequisites

You already have a logged-in William Hill customer within an application, and therefore a login ticket (what we refer to as a TGT)

Procedure

  1. Obtaining a Service Ticket - to do that, call the getServiceTicket() method from the Sessions API.(the credentials in the example below are obfuscated)
     
    httpcon = (HttpURLConnection) ((new URL(API_LOGIN_URL + "/" + sessionTicket + "/serviceTicket?target=" + TARGET).openConnection()));
    httpcon.setDoOutput(false);
    httpcon.setRequestProperty("Content-Type", "application/json");
    httpcon.setRequestProperty("Accept", "application/json");
    httpcon.setRequestMethod("GET");
    httpcon.setRequestProperty("apiKey", "l7xx1ce849xxxxxxxxxxxxxx");
    httpcon.setRequestProperty("apiSecret", "dca6e5xxxxxxxxxxxxxxxxxx");
    httpcon.connect();
                    ...

    The target URL is the service you wish to use, in this case, deposits for mobile. The URL is:

    https://sports.williamhill.com/mob/en-gb/payment/deposit/deposit.html

    In the response from the call, you will get a Service Ticket.
     

    {
         "ticket" : "ST-2xx0567-sxxxxxxx-gibxxx"
    }

     

  2. Opening the web view via a CAS re-direct - to do that, add your ticket and service to the following URL:
     
    https://auth.williamhill.com/cas/share?ticket=ticket&target=target&cust_login=true

     

    webView.setWebViewClient(new WebViewClient());
    webView.getSettings().setJavaScriptEnabled(true);
    webView.loadUrl("https://auth.williamhill.com/cas/share?ticket=" + response + "&target=" + TARGET + "&cust_login=true");
    

    Your webview should look like the screenshow shown below:


     

  3. Closing the web view - in our scenario, once the deposit is completed, the website will attempt to redirect the user to:
     
    https://sports.williamhill-pp1.com/mob/en-gb?action=GoAcct

     You can intercept this navigation event, and close the window and re-direct the customer back to your normal app view.