import type { Bank, BankCode, CardCompany, CardCompanyCode, EasyPayProvider, EasyPayProviderCode, MobileCarrier } from '@tosspayments/sdk-constants'; import { ValueOf } from '../utils/types'; export declare const PaymentMethod: { readonly 카드: "CARD"; readonly 가상계좌: "VIRTUAL_ACCOUNT"; readonly 휴대폰: "MOBILE_PHONE"; readonly 토스페이: "TOSSPAY"; /** * @deprecated */ readonly 토스결제: "TOSSPAY"; readonly 계좌이체: "TRANSFER"; readonly 문화상품권: "CULTURE_GIFT_CERTIFICATE"; readonly 게임문화상품권: "GAME_GIFT_CERTIFICATE"; readonly 도서문화상품권: "BOOK_GIFT_CERTIFICATE"; readonly 해외간편결제: "FOREIGN_EASY_PAY"; readonly 미선택: ""; }; export type PaymentMethodType = keyof typeof PaymentMethod; export type PaymentMethodCode = ValueOf; export declare function resolvePaymentMethodCode(typeOrCode: PaymentMethodType | PaymentMethodCode | string): PaymentMethodCode; export interface BasePaymentRequest { amount: number; orderName: string; successUrl: string; failUrl: string; orderId: string; customerName?: string; customerEmail?: string; taxFreeAmount?: number; cultureExpense?: boolean; forceFailure?: boolean; windowTarget?: 'iframe' | 'self'; mId?: string; methodType?: string; appScheme?: string; metadata?: Record | null; } export interface CommonPaymentRequest extends BasePaymentRequest { } export interface CommonPaymentRequestWithoutUrl extends Omit { } interface BaseCardPaymentRequest extends BasePaymentRequest { cardInstallmentPlan?: number; maxCardInstallmentPlan?: number; useInternationalCardOnly?: boolean; /** * @description 결제 통화입니다. 해외카드는 KRW, USD, JPY를 국내카드는 KRW만 지원합니다. */ currency?: string; useAppCardOnly?: boolean; useCardPoint?: boolean; freeInstallmentPlans?: Array<{ company: CardCompany | CardCompanyCode; months: number[]; }>; language?: 'KO' | 'EN' | 'JA' | 'ZH'; } export interface DefaultCardPaymentRequest extends BaseCardPaymentRequest { flowMode?: 'DEFAULT'; cardCompany?: CardCompany | CardCompanyCode; easyPay?: EasyPayProvider | EasyPayProviderCode; } export interface DirectCardPaymentRequest extends BaseCardPaymentRequest { flowMode: 'DIRECT'; cardCompany: CardCompany | CardCompanyCode; easyPay?: never; } export interface DirectEasyPayPaymentRequest extends BaseCardPaymentRequest { flowMode: 'DIRECT'; cardCompany?: never; easyPay: EasyPayProvider | EasyPayProviderCode; } export type CardPaymentRequest = DefaultCardPaymentRequest | DirectCardPaymentRequest | DirectEasyPayPaymentRequest; export type CardPaymentRequestWithoutUrl = Omit | Omit | Omit; interface EscrowProduct { id: string; code: string; name: string; unitPrice: number; quantity: number; } interface CashReceipt { type?: '소득공제' | '지출증빙' | '미발행'; } export interface VirtualAccountPaymentRequest extends BasePaymentRequest { /** * @description 에스크로 결제를 사용할 지 여부. * true로 넘기면 항상 에스크로 결제를 사용, false로 넘기면 에스크로 결제를 항상 사용하지 않도록 함. * 넘기지 않으면 사용자가 선택할 수 있음. */ useEscrow?: boolean; escrowProducts?: EscrowProduct[]; cashReceipt?: CashReceipt; /** * @deprecated 대신 `cashReceipt` 필드를 사용해주세요. */ cashReceiptInfo?: CashReceipt; validHours?: number; dueDate?: string; virtualAccountCallbackUrl?: string; customerMobilePhone?: string; } export interface VirtualAccountPaymentRequestWithoutUrl extends Omit { } export interface PhonePaymentRequest extends BasePaymentRequest { mobileCarrier?: MobileCarrier; } export interface PhonePaymentRequestWithoutUrl extends Omit { } export interface TranferPaymentRequest extends BasePaymentRequest { bank?: BankCode | Bank; cashReceipt?: CashReceipt; customerMobilePhone?: string; } export interface TranferPaymentRequestWithoutUrl extends Omit { } interface ForeignEasyPayProduct { name: string; quantity: number; unitAmount: number; currency: string; description: string; } interface ForeignEasyPayShipping { fullName?: string; address?: { country: string; line1?: string; line2?: string; area1?: string; area2: string; postalCode?: string; }; } export interface ForeignEasyPayPaymentRequest extends BasePaymentRequest { provider: string; currency: string; country: string; products?: ForeignEasyPayProduct[]; shipping?: ForeignEasyPayShipping; pendingUrl?: string; paymentMethodOptions?: { paypal?: { setTransactionContext?: Record; }; }; } export interface ForeignEasyPayPaymentRequestWithoutUrl extends Omit { } export type PaymentRequest = CommonPaymentRequest | CardPaymentRequest | VirtualAccountPaymentRequest | TranferPaymentRequest | ForeignEasyPayPaymentRequest; export type PaymentRequestWithoutUrl = CommonPaymentRequestWithoutUrl | CardPaymentRequestWithoutUrl | VirtualAccountPaymentRequestWithoutUrl | TranferPaymentRequestWithoutUrl | ForeignEasyPayPaymentRequestWithoutUrl; export declare function isSyncPaymentRequest(params: unknown): params is PaymentRequest; export interface PaymentRequestOptions { responseMode?: 'CALLBACK' | 'PROMISE' | undefined; } export {};