> For the complete documentation index, see [llms.txt](https://developer.firmhouse.com/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://developer.firmhouse.com/sdks/firmhouse-sdk/reference/functions/resolve-adyen-checkout-entry.md).

# Function: resolveAdyenCheckoutEntry()

```ts
function resolveAdyenCheckoutEntry(params): AdyenCheckoutEntry;
```

Determines how the checkout page was entered.

## Parameters

### params

[`AdyenCheckoutQueryParams`](/sdks/firmhouse-sdk/reference/typealiases/adyen-checkout-query-params.md)

Query parameters of the checkout page

## Returns

[`AdyenCheckoutEntry`](/sdks/firmhouse-sdk/reference/typealiases/adyen-checkout-entry.md)

Whether the page was mounted fresh or entered from a redirect

## Remarks

Adyen returns the customer to the `returnUrl` of the checkout with a `sessionId` and a `redirectResult` after payment methods such as iDEAL, Bancontact or a 3D Secure challenge. Re-initialise Drop-in with the returned session id and submit the result instead of creating a new session, otherwise the customer starts paying all over again. On a redirect return the payment is already with Adyen, so read the outcome before doing anything else. A session cannot be created for a payment that has been paid, and the webhook that pays it often lands before the customer is back.

## Example

```typescript
const entry = resolveAdyenCheckoutEntry(new URLSearchParams(window.location.search));
// The token of the payment returned by `client.carts.createSubscription`, stored
// before Drop-in was mounted so that it survives the redirect.
let paymentToken = sessionStorage.getItem('paymentToken');

if (entry.mode === 'redirect' && paymentToken) {
  const status = await client.payments.waitForCheckoutStatus(subscriptionToken, paymentToken);
  if (status.paymentStatus === 'PAID' && status.successUrl) {
    window.location.assign(status.successUrl);
    return;
  }
}

if (!paymentToken) {
  const { payment } = await client.carts.createSubscription(subscriptionToken, checkoutUrl, returnUrl);
  if (!payment) return;
  paymentToken = payment.token;
  sessionStorage.setItem('paymentToken', paymentToken);
}

// A fresh checkout, or a retry after the customer came back from a refused payment.
const session = await client.payments.createAdyenSession(subscriptionToken, paymentToken);
const checkout = await AdyenCheckout(buildAdyenCheckoutOptions(session));
new Dropin(checkout, buildAdyenDropinOptions(session)).mount('#dropin-container');
```
