For the complete documentation index, see llms.txt. This page is also available as Markdown.

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()

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>

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


getCheckoutStatus()

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>

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


waitForCheckoutStatus()

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

Polling interval, timeout and abort signal

Returns

Promise<FirmhouseCheckoutPaymentStatus>

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

Last updated

Was this helpful?