Interface PaymentRequestData

Request for a purchase authorization.

This is the authorization context to use for a normal purchase.

interface PaymentRequestData {
    amount?: number;
    collectCustomerProfile?: (
        | "profile:name"
        | "profile:email"
        | "profile:phone"
        | "profile:locale"
        | "profile:billing_address"
        | "profile:country"
        | "profile:national_identification"
        | "profile:date_of_birth"
    )[];
    collectShippingData?: {
        scopes: ("SHIPPING_ADDRESS" | "SHIPPING_OPTION")[];
        supportedCountries?: string[];
    };
    currency: string;
    intent?: "authorization"
    | "preparation";
    interoperabilityData?: string;
    paymentOptionId?: string;
    paymentRequestReference?: string;
    requestCustomerToken?: {
        customerTokenReference?: string;
        scopes: (
            | "payment:customer_present"
            | "payment:customer_not_present"
            | "customer:login"
        )[];
    };
    supplementaryPurchaseData?: SupplementaryPurchaseData;
}

Properties

amount?: number

Total payment amount.

collectCustomerProfile?: (
    | "profile:name"
    | "profile:email"
    | "profile:phone"
    | "profile:locale"
    | "profile:billing_address"
    | "profile:country"
    | "profile:national_identification"
    | "profile:date_of_birth"
)[]

The collected customer data will be available for reading under stateContext.klarnaCustomer.customerProfile when the request is in state COMPLETED.

Note that you must have a valid purpose under GDPR or other relevant jurisdiction to request and process the identity information of the customer.

  • profile:name - returns the family name and given name
  • profile:email - returns the email and its verification status.
  • profile:phone - returns the phone number and its verification status.
  • profile:locale - returns the locale.
  • profile:billing_address - returns the customer profile address.
  • profile:country - returns the country.
  • profile:national_identification - returns the national identification number.
  • profile:date_of_birth - returns the date of birth.
collectShippingData?: {
    scopes: ("SHIPPING_ADDRESS" | "SHIPPING_OPTION")[];
    supportedCountries?: string[];
}

Instruct Klarna to collect a shipping address from the customer during the payment flow.

If you enable this, you must read back and honour the shipping address returned in the payment request response.

SHIPPING_ADDRESS - collects the shipping details including recipient name and shipping address. SHIPPING_OPTION - when provided shipping option selector will be displayed in KEC. This option is only available in ON_PAGE mode and it requires shipping event handlers to be implemented in the SDK. Shipping details if requested will be available under stateContext.klarnaCustomer.shipping when the request is in state COMPLETED

Type declaration

  • scopes: ("SHIPPING_ADDRESS" | "SHIPPING_OPTION")[]
  • OptionalsupportedCountries?: string[]

    A list of countries a partner ships to. If not provided Klarna will not limit the countries available in the shipping address selector in OPF review screen.

    []
    
currency: string

3-letter ISO 4217 currency code.

intent?: "authorization" | "preparation"

The intent of this payment request.

interoperabilityData?: string

This field should be used for any additional interoperability data sent by your Integrating Partner.

paymentOptionId?: string
paymentRequestReference?: string

Reference to the payment session or equivalent resource created on your side. This will be exposed in payment request webhooks (payments.v2.request.*) for the purpose of correlating your resource with the Klarna Payment Request.

requestCustomerToken?: {
    customerTokenReference?: string;
    scopes: (
        | "payment:customer_present"
        | "payment:customer_not_present"
        | "customer:login"
    )[];
}

Request a customer account linking to be set up, effectively returning a token called customerToken on successful confirmation of the payment request. The generated token allows the token owner to act on-behalf of the customer.

The generated token will be available under stateContext.klarnaCustomer.customerToken when the request is in state COMPLETED

Type declaration

  • OptionalcustomerTokenReference?: string

    Partner reference to the customer token created on Klarna side. If provided, this reference will be exposed in webhooks related to changes to the customer token (e.g. token revoked) for the purpose of correlating your resource with the Klarna customer token.

  • scopes: ("payment:customer_present" | "payment:customer_not_present" | "customer:login")[]

    The scopes of the requested customer token. The scopes define the permissions of the token.

    payment:customer_not_present - Enables payment tokenization of the customer, allows you to charge for subscriptions and on-demand when the customer is not present. payment:customer_present - Enables tokenization of the customer, subsequent charges depending on risk assessment and the initially selected payment method might go through immediately or, in certain cases, require step-up. customer:login - Enables account linking for the customer that allows the partner to create future payment requests in a logged in state for the customer.

supplementaryPurchaseData?: SupplementaryPurchaseData

Supplementary purchase data.