/* * Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. */ import * as z from "zod/v3"; import { remap as remap$ } from "../../lib/primitives.js"; import { KlarnaSubscriptionOptions, KlarnaSubscriptionOptions$Outbound, KlarnaSubscriptionOptions$outboundSchema, } from "./klarnasubscriptionoptions.js"; export type KlarnaOptions = { /** * Provides subscription information to Klarna. */ subscription?: KlarnaSubscriptionOptions | null | undefined; /** * When set to `true`, this will authorize the transaction with Klarna for the purposes of tokenizing the payment method with the transaction details. No funds will be captured and the authorization will be automatically voided. This is useful for up-sell scenarios where you want to tokenize a Klarna payment method for future use. */ tokenOnlyMode?: boolean | null | undefined; /** * An authorization token returned by the Klarna Express Checkout JS SDK after the buyer completes payment in the embedded widget. When provided, the connector skips the HPP redirect and places the Klarna order directly using this token. */ authorizationToken?: string | null | undefined; }; /** @internal */ export type KlarnaOptions$Outbound = { subscription?: KlarnaSubscriptionOptions$Outbound | null | undefined; token_only_mode?: boolean | null | undefined; authorization_token?: string | null | undefined; }; /** @internal */ export const KlarnaOptions$outboundSchema: z.ZodType< KlarnaOptions$Outbound, z.ZodTypeDef, KlarnaOptions > = z.object({ subscription: z.nullable(KlarnaSubscriptionOptions$outboundSchema).optional(), tokenOnlyMode: z.nullable(z.boolean()).optional(), authorizationToken: z.nullable(z.string()).optional(), }).transform((v) => { return remap$(v, { tokenOnlyMode: "token_only_mode", authorizationToken: "authorization_token", }); }); export function klarnaOptionsToJSON(klarnaOptions: KlarnaOptions): string { return JSON.stringify(KlarnaOptions$outboundSchema.parse(klarnaOptions)); }