Confirm API
Overview
An API for the merchant to complete the payment when the user approves with the ConfirmURL or Check Payment Status API. Status of a payment where authorization and purchase are separated because 'options.payment.confirm' of the Request API is set as false
will be in purchase standby (Authentication) even after it is completed. To complete the purchase, an additional purchase process is required through the Confirm API.
send
send(confirmRequestConfig)
Returns Promise<ApiResponse<ConfirmResponseBody>>
Request Config
export type ConfirmRequestBody = {
/**
* Payment amount
*/
amount: number
/**
* Payment currency ([ISO 4217](https://en.wikipedia.org/wiki/ISO_4217))\
* Supported currencies are as follows.
* - USD
* - JPY
* - TWD
* - THB
*/
currency: Currency
}
export type ConfirmRequestConfig = GeneralRequestConfig & {
/**
* ID of the transaction
*/
transactionId: string
/**
* Request body of confirm API
*/
body: ConfirmRequestBody
}
Response Body
export type PayInfo = {
/**
* A payment method used for payment
* - Credit card: CREDIT_CARD
* - Balance: BALANCE
* - Discount: DISCOUNT
*/
method: string
/**
* Payment amount
*/
amount: number
/**
* Credit card nickname for automatic payment
* - Credit card name managed at LINE Pay. It is the name registered when registered to LINE Pay.
* - If LINE Pay user does not set a nickname, an empty string will be sent.
* - The nickname can be changed upon user's request and the change history will not be shared with the merchant.
*/
creditCardNickname?: string
/**
* Credit card brand used for automatic payment
* - VISA
* - MASTER
* - AMEX
* - DINERS
* - JCB
*/
creditCardBrand?: string
/**
* Masked credit card number (Send only for Taiwan merchants. Able to use the feature when requesting to the merchant center manager. Not sending in payment details API).
* - Format: **** **** **** 1234
*/
maskedCreditCardNumber?: string
}
export type Package = {
/**
* An unique ID of package list
*/
id: string
/**
* Name of the sales products
*/
name?: string
/**
* Total amount of products per package\
* `=sum(products[].quantity * products[].price)`
*/
amount: number
/**
* User fee: Sent as a respond if a list of fee is found within the payment amount.
*/
userFeeAmount?: number
}
export type Shipping = {
/**
* An ID of shipping method selected by user
*/
methodId: string
/**
* Shipping fee
*/
feeAmount: number
/**
* Shipping address
*/
address: Address
}
export type Info = {
/**
* An unique order ID of the merchant sent upon requesting the payment.
*/
orderId: string
/**
* Transaction ID
*/
transactionId: string
/**
* Authentication expiration date and time (ISO 8601)
* - Send if the payment proceeded only up to authentication (capture=false)
*/
authorizationExpireDate?: string
/**
* A key for automatic payment (15 digits)
*/
regKey?: string
/**
* Payment information
*/
payInfo: PayInfo[]
/**
* Package information
*/
packages: Package[]
/**
* Shipping information
*/
shipping?: Shipping
}
export type ConfirmResponseBody = GeneralResponseBody & {
/**
* Payment information
*/
info: Info
}
Return Code
Success
Code | Description |
---|---|
0000 | Success |
Error
Code | Description |
---|---|
1101 | Not a LINE Pay member |
1102 | The member is unable to proceed the transaction. |
1104 | Non-existing merchant |
1105 | The merchant cannot use the LINE Pay. |
1106 | A header info error |
1110 | Unacceptable credit card |
1124 | Amount info error (scale) |
1141 | A payment account error |
1142 | Low balance |
1150 | Cannot find the transaction history |
1152 | There is a history of transactions with the same transactionId. |
1153 | The payment amount is different than the requested amount. |
1159 | Payment request information is not found. |
1169 | Must select a payment method and password authentication at the LINE Pay. |
1170 | Balance of the member's account has been changed. |
1172 | A record of transaction with the same order number already exists. |
1180 | The payment has been expired. |
1198 | API call request has been duplicated. |
1199 | Internal request error |
1280 | A temporary error occurred while processing the credit card payment. |
1281 | A credit card payment error |
1282 | A credit card authorization error |
1283 | The payment was refused due to suspected fraud. |
1284 | The credit card payment has temporarily stopped. |
1285 | Missing credit card payment information |
1286 | Wrong credit card payment information |
1287 | The credit card has been expired |
1288 | The credit card has low balance |
1289 | Exceeded the credit card limit |
1290 | Exceeded the limit of the credit card per payment |
1291 | The card has been reported as a stolen card. |
1292 | The card has been suspended. |
1293 | A CVN input error |
1294 | The card is listed on the blacklist. |
1295 | A wrong credit card number |
1296 | Unable to proceed the amount |
1298 | The card has been declined. |
9000 | An internal error |
Example
Request
const res = await linePayClient.confirm
.send({
transactionId: '2021121600698709510',
body: {
currency: 'TWD',
amount: 1000
}
})
Response
{
"body": {
"returnCode": "0000",
"returnMessage": "Success.",
"info": {
"transactionId": "2021121600698709510",
"orderId": "20211216002",
"payInfo": [
{
"method": "CREDIT_CARD",
"amount": 1000,
}
],
"packages": [
{
"id": "c99abc79-3b29-4f40-8851-bc618ca57857",
"amount": 1000,
"userFeeAmount": 0,
"products": [
{
"name": "Demo Product",
"quantity": 2,
"price": 500
}
]
}
]
}
},
"comments": {}
}
addHandler
addHandler(handler)
Returns ConfirmClient
Example:
client.addHandler(({ type, req, next, httpClient }) => {
console.log(type) // confirm
return next(req)
})
addHandlers
addHandlers(...handlers)
Returns ConfirmClient
Example:
client.addHandlers(
({ req, next }) => next(req),
({ req, next }) => next(req),
({ req, next }) => next(req)
)