createHeadlessCheckout
function createHeadlessCheckout<T, H>(
sessionParams,
hooks?,
apiPaths?): Promise<PurseHeadlessCheckout>;
Creates and initializes a new headless checkout instance. Use this function to start a new payment session with the Purse checkout system.
Type Parameters
| Type Parameter |
|---|
T extends | string | PurseHeadlessCheckoutV1Params |
H extends PurseHeadlessCheckoutHooks |
Parameters
| Parameter | Type | Description |
|---|---|---|
sessionParams | T | The checkout session configuration. |
hooks? | H | Optional lifecycle hooks to customize checkout behavior See PurseHeadlessCheckoutHooks for available hooks |
apiPaths? | APIPaths | dev purposes only to override the APi URL's' |
Returns
Promise<PurseHeadlessCheckout>
A promise that resolves to a configured checkout instance
Throws
- PurseHeadlessCheckoutError
EXPIRED_SESSION
If the session used to create the headless checkout instance is expired. - PurseHeadlessCheckoutError
INVALID_INIT_PARAMS
If the parameters used to init the headless checkout are invalid. - PurseHeadlessCheckoutError
UNKNOWN_ERROR
If tan unknown error is caught during the creation of the headless checkout instance.