@yuju/tosspayments-sdk
Version:
Toss Payments SDK for Node.js
175 lines (174 loc) • 5.72 kB
TypeScript
/** 카드 종류입니다. 신용, 체크, 기프트, 미확인 중 하나입니다.
* 고객이 해외 카드로 결제했거나 간편결제의 결제 수단을 조합해서 결제했을 때 미확인으로 표시됩니다.
*/
type CardType = '신용' | '체크' | '기프트' | '미확인';
/** 카드의 소유자 타입입니다. 개인, 법인, 미확인 중 하나입니다.
* 고객이 해외 카드로 결제했거나 간편결제의 결제 수단을 조합해서 결제했을 때 미확인으로 표시됩니다.
*/
type OwnerType = '개인' | '법인' | '미확인';
/** 카드 결제의 매입 상태입니다. */
type AcquireStatus = 'READY' | 'REQUESTED' | 'COMPLETED' | 'CANCEL_REQUESTED' | 'CANCELED';
/** 할부가 적용된 결제에서 할부 수수료를 부담하는 주체입니다. */
type InterestPayer = 'BUYER' | 'CARD_COMPANY' | 'MERCHANT';
/** 카드로 결제하면 제공되는 카드 관련 정보입니다. */
type Card = {
amount: number;
issuerCode: string;
acquirerCode?: string;
number: string;
installmentPlanMonths: number;
approveNo: string;
useCardPoint: boolean;
cardType: CardType;
ownerType: OwnerType;
acquireStatus: AcquireStatus;
isInterestFree: boolean;
interestPayer?: InterestPayer;
};
/** 환불 처리 상태를 나타냅니다. */
type RefundStatus = 'NONE' | 'PENDING' | 'FAILED' | 'PARTIAL_FAILED' | 'COMPLETED';
/** 정산 상태를 나타냅니다. */
type SettlementStatus = 'INCOMPLETED' | 'COMPLETED';
/** 환불계좌 정보입니다. */
type RefundReceiveAccount = {
bankCode: string;
accountNumber: string;
holderName: string;
};
/** 가상계좌로 결제하면 제공되는 가상계좌 관련 정보입니다. */
type VirtualAccount = {
accountType: '일반' | '고정';
accountNumber: string;
bankCode: string;
customerName: string;
dueDate: string;
refundStatus: RefundStatus;
expired: boolean;
settlementStatus: SettlementStatus;
refundReceiveAccount?: RefundReceiveAccount;
};
/** 휴대폰으로 결제하면 제공되는 휴대폰 결제 관련 정보입니다. */
type MobilePhone = {
customerMobilePhone: string;
settlementStatus: SettlementStatus;
receiptUrl: string;
};
/** 상품권으로 결제하면 제공되는 상품권 결제 관련 정보입니다. */
type GiftCertificate = {
approveNo: string;
settlementStatus: SettlementStatus;
};
/** 계좌이체로 결제했을 때 이체 정보가 담기는 객체입니다. */
type Transfer = {
bankCode: string;
settlementStatus: SettlementStatus;
};
/** 발행된 영수증 정보입니다. */
type Receipt = {
url: string;
};
/** 결제창 정보입니다. */
type Checkout = {
url: string;
};
/** 간편결제 정보입니다. */
type EasyPay = {
provider: string;
amount: number;
discountAmount: number;
};
/** 결제 승인에 실패하면 응답으로 받는 에러 객체입니다. */
type Failure = {
code: string;
message: string;
};
/** 현금영수증 정보입니다. */
type CashReceipt = {
type: '소득공제' | '지출증빙' | '미발행';
receiptKey: string;
issueNumber: string;
receiptUrl: string;
amount: number;
taxFreeAmount: number;
};
/** 현금영수증 발행 및 취소 이력 정보입니다. */
type CashReceiptHistory = {
receiptKey: string;
orderId: string;
orderName: string;
type: '소득공제' | '지출증빙';
issueNumber: string;
receiptUrl: string;
businessNumber: string;
transactionType: 'CONFIRM' | 'CANCEL';
amount: number;
taxFreeAmount: number;
issueStatus: 'IN_PROGRESS' | 'COMPLETED' | 'FAILED';
failure: Failure;
customerIdentityNumber: string;
requestedAt: string;
};
/** 카드사의 즉시 할인 프로모션 정보입니다. */
type Discount = {
amount: number;
};
/** 결제 취소 이력 정보입니다. */
type CancelHistory = {
cancelAmount: number;
cancelReason: string;
taxFreeAmount: number;
taxExemptionAmount: number;
refundableAmount: number;
easyPayDiscountAmount: number;
canceledAt: string;
transactionKey: string;
receiptKey?: string;
};
type PaymentStatus = 'READY' | 'IN_PROGRESS' | 'WAITING_FOR_DEPOSIT' | 'DONE' | 'CANCELED' | 'PARTIAL_CANCELED' | 'ABORTED' | 'EXPIRED';
type PaymentMethod = '카드' | '가상계좌' | '간편결제' | '휴대폰' | '계좌이체' | '문화상품권' | '도서문화상품권' | '게임문화상품권';
type PaymentType = 'NORMAL' | 'BILLING' | 'BRANDPAY';
export interface Payment {
version: string;
paymentKey: string;
type: PaymentType;
orderId: string;
orderName: string;
mId: string;
currency: string;
method: PaymentMethod;
totalAmount: number;
balanceAmount: number;
status: PaymentStatus;
requestedAt: string;
approvedAt: string;
useEscrow: boolean;
lastTransactionKey?: string;
suppliedAmount?: number;
vat?: number;
cultureExpense?: boolean;
taxFreeAmount?: number;
taxExemptionAmount: number;
cancels?: CancelHistory[];
isPartialCancelable: boolean;
card?: Card;
virtualAccount?: VirtualAccount;
secret?: string;
mobilePhone?: MobilePhone;
giftCertificate?: GiftCertificate;
transfer?: Transfer;
receipt?: Receipt;
checkout?: Checkout;
easyPay?: EasyPay;
country: string;
failure?: Failure;
cashReceipt?: CashReceipt;
cashReceipts?: CashReceiptHistory[];
discount?: Discount;
}
export interface PaymentWithVirtualAccount extends Payment {
virtualAccount: VirtualAccount;
}
export interface PaymentWithCard extends Payment {
card: Card;
}
export {};