UNPKG

@portone/browser-sdk

Version:

PortOne SDK for browser

112 lines (111 loc) 3.6 kB
import { CapsToCamel, OneOfType } from '../utils.js'; import { Entity } from './index.js'; export declare function requestPayment(request: PaymentRequest): Promise<PaymentResponse | undefined>; export type PaymentRequest = { storeId: string; paymentId: string; orderName: string; totalAmount: number; channelKey?: string; pgProvider?: Entity.PgProvider; isTestChannel?: boolean; channelGroupId?: string; taxFreeAmount?: number; vatAmount?: number; customer?: Entity.Customer; windowType?: Entity.WindowTypes; redirectUrl?: string; noticeUrls?: string[]; confirmUrl?: string; appScheme?: string; isEscrow?: boolean; products?: Entity.Product[]; isCulturalExpense?: boolean; currency: Entity.Currency; locale?: Entity.Locale; customData?: Record<string, any>; offerPeriod?: Entity.OfferPeriod; productType?: Entity.ProductType; storeDetails?: Entity.StoreDetails; bypass?: Entity.PaymentBypass; country?: Entity.Country; shippingAddress?: Entity.Address; promotionId?: string; popup?: Entity.Popup; iframe?: Entity.Iframe; } & (PayMethodOptions<'CARD', Card> | PayMethodOptions<'VIRTUAL_ACCOUNT', VirtualAccount> | PayMethodOptions<'TRANSFER', Transfer> | PayMethodOptions<'MOBILE', Mobile> | PayMethodOptions<'GIFT_CERTIFICATE', GiftCertificate> | PayMethodOptions<'EASY_PAY', EasyPay> | PayMethodOptions<'PAYPAL', Paypal> | PayMethodOptions<'ALIPAY', Alipay> | PayMethodOptions<'CONVENIENCE_STORE', ConvenienceStore> | { payMethod?: undefined; }); /** * iframe/popup 방식으로 PG사 창이 렌더링 된 경우 * 프로세스 종료 후, 콜백 함수로 전달 될 결제 정보 데이터 */ export type PaymentResponse = { transactionType: typeof Entity.TransactionType.PAYMENT; paymentId: string; txId: string; code?: string; message?: string; pgCode?: string; pgMessage?: string; }; type PayMethodOptions<Method extends Entity.PayMethod, T> = { payMethod: Method; } & { [K in Method as CapsToCamel<K>]?: T; }; type Card = { cardCompany?: Entity.CardCompany; installment?: Entity.Installment; useCardPoint?: boolean; useAppCardOnly?: boolean; availableCards?: Entity.CardCompany[]; useFreeInterestFromMall?: boolean; useInstallment?: boolean; }; type VirtualAccount = { cashReceiptType?: Entity.CashReceiptType; customerIdentifier?: string; accountExpiry?: OneOfType<{ validHours: number; dueDate: string; }>; bankCode?: Entity.Bank; availableBanks?: Entity.Bank[]; fixedOption?: OneOfType<{ pgAccountId: string; accountNumber: string; }>; }; type Transfer = { cashReceiptType?: Entity.CashReceiptType; customerIdentifier?: string; bankCode?: Entity.Bank; }; type Mobile = { carrier?: Entity.Carrier; availableCarriers?: Entity.Carrier[]; }; type GiftCertificate = { giftCertificateType?: Entity.GiftCertificateType; }; type EasyPay = { easyPayProvider?: Entity.EasyPayProvider; installment?: Entity.Installment; availableCards?: Entity.CardCompany[]; useFreeInterestFromMall?: boolean; cashReceiptType?: Entity.CashReceiptType; customerIdentifier?: string; useCardPoint?: boolean; availablePayMethods?: Entity.EasyPayPaymentMethod[]; useInstallment?: boolean; }; type Paypal = Record<string, never>; type Alipay = Record<string, never>; type ConvenienceStore = { paymentDeadline?: OneOfType<{ validHours: number; dueDate: string; }>; }; export {};