com.klarna.checkout

## Class KlarnaCheckout

- java.lang.Object
- - com.klarna.checkout.KlarnaCheckout

-     public final class KlarnaCheckout
      extends java.lang.Object

  Primary checkout object for merchant integration.

  Standard "embedded" checkout initialization:
  KlarnaCheckout checkout = new KlarnaCheckout( myCurrentActivity );
  checkout.setSignalListener(..an implementation of the `SignalListener` interface..);
  checkout.loadCheckoutSnippet( ..the html snippet from merchant server.. );
  WebView webView = (WebView) checkout.getView();
  (the returned WebView can then be placed in layout placeholder or fragment as required)

  "Hybrid" checkout initialization:
  KlarnaCheckout checkout = new KlarnaCheckout( myCurrentActivity );
  checkout.setWebView( myMerchantWebView );
  checkout.setSignalListener(..an implementation of the SignalListener interface..);
  myMerchantWebView.loadUrl( "http://my_merchant_url" );
  ("myMerchantWebView" is a `WebView` instance that has loaded a web page which already contains the checkout code snippet)

  Disposal:
  When checkout is no longer needed you can call checkout's destroy method.
  checkout.destroy();
  NOTE: if using hybrid the main webView will not be destroyed. However the one created when using the embedded implementation will.
  See Also:
    `SignalListener`

- - ### Constructor Summary

    Constructors
    Constructor and Description
    `KlarnaCheckout(android.app.Activity currentActivity)`
    `KlarnaCheckout(android.app.Activity currentActivity, java.lang.String redirectURI)`

  - ### Method Summary

    All Methods Static Methods Instance Methods Concrete Methods
    Modifier and Type | Method and Description
    --- | ---
    `void` | `destroy()` Method to destroy checkout and remove all resources.
    `android.view.View` | `getView()` Returns the currentcheckout view} instance
    `void` | `resume()` Sends message to checkout to resume operations.
    `static void` | `setGooglePushMessageToken(java.lang.String token)` Sets google push messaging token if using with Klarna's GCM
    `void` | `setSignalListener(SignalListener checkoutSignalListener)` Sets an instance of a CheckoutSignalListener for all signals to allow switched implementations.
    `void` | `setSnippet(java.lang.String snippet)` Startup option for use when using a snippet obtained from server Loads html checkout "snippet" received from server into main WebView.
    `void` | `setWebView(android.webkit.WebView suppliedWebView)`
    `void` | `suspend()` Sends message to checkout to suspend operations.

    - ### Methods inherited from class java.lang.Object

      `equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

- - ### Constructor Detail

    - #### KlarnaCheckout

          public KlarnaCheckout(android.app.Activity currentActivity)

    - #### KlarnaCheckout

          public KlarnaCheckout(android.app.Activity currentActivity,
                                java.lang.String redirectURI)

  - ### Method Detail

    - #### suspend

          public void suspend()

      Sends message to checkout to suspend operations.

    - #### resume

          public void resume()

      Sends message to checkout to resume operations.

    - #### setWebView

          public void setWebView(android.webkit.WebView suppliedWebView)

      Parameters:
        `suppliedWebView` -

    - #### setSnippet

          public void setSnippet(java.lang.String snippet)

      Startup option for use when using a snippet obtained from server Loads html checkout "snippet" received from server into main WebView.

      NOTE: This is not needed if a supplied webview is used.
      Parameters:
        `snippet` - the snippet of html code that initializes the checkout.

    - #### setGooglePushMessageToken

          public static void setGooglePushMessageToken(java.lang.String token)

      Sets google push messaging token if using with Klarna's GCM
      Parameters:
        `token` - the token received from google.

    - #### getView

          public android.view.View getView()

      Returns the currentcheckout view} instance
      Returns:
        instance of the main WebView being used by checkout. but it is cast down to view only.

    - #### setSignalListener

          public void setSignalListener(SignalListener checkoutSignalListener)

      Sets an instance of a CheckoutSignalListener for all signals to allow switched implementations.
      Parameters:
        `checkoutSignalListener` - an SignalListener implemented instance.

    - #### destroy

          public void destroy()

      Method to destroy checkout and remove all resources. NOTE: the main WebView will only be destroyed if the checkout has created it. In hybrid mode the WebView will remain untouched.