Interface PaymentRequestOptions

Options to control the behavior of the Payment Request.

interface PaymentRequestOptions {
    initiationMode?: "DEVICE_BEST" | "REDIRECT" | "ON_PAGE" | "POPUP";
    returnUrl?: string;
}

Properties

initiationMode?: "DEVICE_BEST" | "REDIRECT" | "ON_PAGE" | "POPUP"

The initiation mode of the authorization flow, i.e if redirects or popups are preferred.

DEVICE_BEST.

See FlowInitiationMode

returnUrl?: string

Payment flow return URL Usages:

  • The customer will always be redirected to this URL on a successful authorization, if REDIRECT initiation mode the customer will also be redirected to this URL on a failed authorization.
  • The redirection can be prevented by defining the on('complete') callback and returning false.

Any payment request complete event handlers will run before redirection.

The URL supports placeholders variables, the variables will be replaced with the corresponding value before redirection. Placeholders are always encapsulated within single curly brackets ({}). Available placeholders for the success redirection URL:

{klarna.payment_request.id} - Replaced with the request id {klarna.payment_request.state} Replaced with the state of the request {klarna.payment_request.state_reason} - Replaced with the state reason {klarna.payment_request.payment_request_reference} - Replaced with your payment reference {klarna.payment_token} - Replaced with the payment token The values are all URL safe, or URL encoded before substitution. Example If you set this to https://partner.example/klarna-redirect?klarna_complete={klarna.payment_token} and the payment token is cd227fcd-21ee-4903-89ed-bd694144009e then the full redirection URL will be https://partner.example/klarna-redirect?klarna_complete=cd227fcd-21ee-4903-89ed-bd694144009e

window.location.href.