> 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/resources/payments.md).

# Class: PaymentsResource

Checkout payment methods for storefronts that render the payment step themselves instead of redirecting the customer to a hosted payment page.

## Remarks

Every method here requires a storefront access token and the subscription token of the checkout. A client configured with `Access.write` is rejected by the API.

## Methods

### createAdyenSession()

```ts
createAdyenSession(subscriptionToken, paymentToken): Promise<FirmhouseAdyenPaymentSession>;
```

Creates an Adyen payment session for a checkout payment.

#### Parameters

**subscriptionToken**

`string`

Token of the subscription the payment belongs to

**paymentToken**

`string`

Token of the payment to pay for

#### Returns

`Promise`<[`FirmhouseAdyenPaymentSession`](/sdks/firmhouse-sdk/reference/interfaces/firmhouse-adyen-payment-session.md)>

The browser-safe session configuration for Adyen Web Drop-in

#### Remarks

Requesting a session for the same payment again returns the session that is still active, so a customer who reloads the checkout page keeps the same session.

#### Throws

* [ValidationError](/sdks/firmhouse-sdk/reference/errors/validation.md) - Thrown when a session cannot be created for this payment
* [ServerError](/sdks/firmhouse-sdk/reference/errors/server.md) - Thrown if the request fails
* [NotFoundError](/sdks/firmhouse-sdk/reference/errors/not-found.md) - Thrown if the payment is not found

***

### getCheckoutStatus()

```ts
getCheckoutStatus(subscriptionToken, paymentToken): Promise<FirmhouseCheckoutPaymentStatus>;
```

Fetches the authoritative outcome of a checkout payment.

#### Parameters

**subscriptionToken**

`string`

Token of the subscription the payment belongs to

**paymentToken**

`string`

Token of the payment to return the status for

#### Returns

`Promise`<[`FirmhouseCheckoutPaymentStatus`](/sdks/firmhouse-sdk/reference/interfaces/firmhouse-checkout-payment-status.md)>

The payment status, subscription status and the URL to send the customer to

#### Remarks

Payment providers confirm payments through a webhook after the customer leaves the payment form, so read this instead of relying on the browser callback of Drop-in.

#### Throws

* [ServerError](/sdks/firmhouse-sdk/reference/errors/server.md) - Thrown if the status could not be read
* [NotFoundError](/sdks/firmhouse-sdk/reference/errors/not-found.md) - Thrown if the payment is not found

***

### waitForCheckoutStatus()

```ts
waitForCheckoutStatus(
   subscriptionToken, 
   paymentToken, 
options?): Promise<FirmhouseCheckoutPaymentStatus>;
```

Polls the checkout payment status until the payment is no longer open or pending.

#### Parameters

**subscriptionToken**

`string`

Token of the subscription the payment belongs to

**paymentToken**

`string`

Token of the payment to return the status for

**options?**

[`WaitForCheckoutPaymentStatusOptions`](/sdks/firmhouse-sdk/reference/interfaces/wait-for-checkout-payment-status-options.md)

Polling interval, timeout and abort signal

#### Returns

`Promise`<[`FirmhouseCheckoutPaymentStatus`](/sdks/firmhouse-sdk/reference/interfaces/firmhouse-checkout-payment-status.md)>

The last checkout payment status that was read

#### Remarks

Call this after Drop-in reports that it is done, or after the customer returns from a redirect, and send them to `successUrl` once the payment is paid. Returns the last status that was read when the timeout is reached, so always check `paymentStatus`. Pass an `AbortSignal` to stop polling when the customer leaves the page.

#### Throws

* [ServerError](/sdks/firmhouse-sdk/reference/errors/server.md) - Thrown if the status could not be read
* [NotFoundError](/sdks/firmhouse-sdk/reference/errors/not-found.md) - Thrown if the payment is not found
