# Call the JavaScript Methods
source: https://developer.mastercard.com/mastercard-checkout-solutions/tutorial/integrate_apis/step4/index.md

## Step 4. Call the JavaScript Methods {#step-4-call-the-javascript-methods}

* Call the [JavaScript library](https://developer.mastercard.com/mastercard-checkout-solutions/documentation/sdk-reference/index.md) methods via the following window:

      NAMESPACE = window.click2pay.<method>

* For completing the checkout and receiving an encrypted payload,

  * **Option 1** : Use [checkout()](https://developer.mastercard.com/mastercard-checkout-solutions/documentation/sdk-reference/checkout-method/index.md) method by passing `payloadTypeIndicatorCheckout` = `FULL` to get the full payload in `checkoutResponse`. In this case, you can refer to [Step 5](https://developer.mastercard.com/mastercard-checkout-solutions/tutorial/integrate_apis/step5/index.md) for authentication and then directly [Step 8](https://developer.mastercard.com/mastercard-checkout-solutions/tutorial/integrate_apis/step8/index.md) for decrypting the payload.
  * **Option 2** : Use [Checkout](https://developer.mastercard.com/mastercard-checkout-solutions/documentation/api-reference/apis/index.md#checkout) API to get the full payload in `checkoutResponse`.

<br />

All the JavaScript methods other than the \[init()\](/documentation/sdk-reference/init/) method use JavaScript promises instead of events/callbacks. Note: The JavaScript library interprets the backend API calls (as designed) and provides the responses back to the Integrator. While XHRs responses can log backend API errors (like 400, INVALID_STATE), Integrator should ignore such errors and honor the responses returned by the JavaScript library function calls.
