pilot

initialize() {#uctp-get-started-initialize}
===========================================

This method initializes the application with the common state. The initialize method must be called before any other methods.

JavaScript Example
------------------

```
window.onload = async function() {
            // Create a shorthand reference to the Unified Click to Pay SDK
            const vsdk = window.VSDK;
            // fetch the JWT from Capture Context
            // Initialize the Unified Click to Pay SDK with your JWT received from capture context
            try {
                await vsdk.initialize({
                    header: header,
                    payload: payload,
                    raw: capture - context
                    //optionally, pass the dpaTransactionOptions here
                });
                //Invoke getCards and other apis here onwards
            } catch (error) {
                console.error('Error initializing SDK:', error);
```

In this example, captureContext refers to the capture context JWT.

Syntax
------

Your initialize() request must have this syntax:

```
initialize({
    required object captureContext;
    optional DpaTransactionOptions dpaTransactionOptions;
});
```

