Common Types
General Request Config
export type GeneralRequestConfig = {
/**
* API timeout
*/
timeout?: number
}
General Response Body
export type GeneralResponseBody = {
/**
* Return code
*/
returnCode: string
/**
* Return message
* Return message or reason for failure. The following are examples.
* - Unpayable merchant
* - Merchant authentication information error
*/
returnMessage: string
}
API Response
export type ApiResponse<Body extends GeneralResponseBody> = {
/**
* Response body
*/
body: Body
/**
* Additional comments may be added by handlers
*/
comments: Record<string, unknown>
}
Other Common Types
export type Recipient = {
/**
* Recipient name
*/
firstName?: string
/**
* Recipient last name
*/
lastName?: string
/**
* Additional information of the recipient first name
*/
firstNameOptional?: string
/**
* Additional information of the recipient last name
*/
lastNameOptional?: string
/**
* Email of the recipient
*/
email?: string
/**
* Phone number of the recipient
*/
phoneNo?: string
}
export type Address = {
/**
* Shipping country
*/
country?: string
/**
* Shipping postal code
*/
postalCode?: string
/**
* Shipping region
*/
state?: string
/**
* Shipping address
*/
city?: string
/**
* Shipping detail
*/
detail?: string
/**
* Additional information of the shipping address
*/
optional?: string
/**
* Recipient of the shipping address
*/
recipient?: Recipient
}
export type Product = {
/**
* ID of sales products of the merchant
*/
id?: string
/**
* Name of the sales products
*/
name: string
/**
* Image URL of the sales products
*/
imageUrl?: string
/**
* Number of products
*/
quantity: number
/**
* Price of each product
*/
price: number
/**
* Original price of each product
*/
originalPrice?: number
}
/**
* Payment currency (ISO 4217)
*/
export type Currency = 'USD' | 'JPY' | 'TWD' | 'THB'