createSession
Method creating a paymentInstrument object, attaching it to the cart and submitting it to Adyen as part of the session
The method communicates with the createSession endpoint of the Vue Storefront API Middleware and passes the shopper's locale to it. In turn, it creates a new paymentInstrument object in the cart with the 'AdyenComponent' ID
When the method is called with a registered user, the customerID which can be retrieved from the Basket and provided as a shopperReference in the payload, together with a few properties like storePaymentMethodMode, shopperInteraction, and recurringProcessingModel so it's possible to read and save the payment method for future usage.
Signature
export declare function createSession(
props?: CreateSessionParams,
options?: MethodOptions
): Promise<Session>;Parameters
| Name | Required | Type | Description |
|---|---|---|---|
props | Optional | CreateSessionParams | Parameter object which can be used with this method. Refer to its type definition to learn about possible properties. |
options | Optional | MethodOptions | Options that can be passed to additionally configure the request or customize the logic in a plugin. |
Returns
Returns a session object. That has to be passed to the mountPaymentElement SDK method.
Referenced Types
Examples
Creating a sfcc' payment containing Adyen's session, adding it to the active cart and obtaining session data.
import { sdk } from '~/sdk.config.ts';
const session = await sdk.adyen.createSession();