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
ValidationError - Thrown when a session cannot be created for this payment
ServerError - Thrown if the request fails
NotFoundError - Thrown if the payment is not found
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
ServerError - Thrown if the status could not be read
NotFoundError - Thrown if the payment is not found
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
ServerError - Thrown if the status could not be read
NotFoundError - Thrown if the payment is not found
Last updated
Was this helpful?