Interface: LinePayClient
Defined in: src/client-types.ts:154
A LINE Pay client. It is immutable: with() returns a new client.
Every method takes one flat input object (path parameters and body or query fields side by side) and an optional CallOptions.
Methods
capture()
capture(input, options?): Promise<LinePayResult<CaptureResponse>>;Defined in: src/client-types.ts:186
Capture a payment that was authorized only (options.payment.capture was false).
Parameters
input
options?
Returns
Promise<LinePayResult<CaptureResponse>>
checkPaymentStatus()
checkPaymentStatus(input, options?): Promise<LinePayResult<CheckPaymentStatusResponse>>;Defined in: src/client-types.ts:216
Poll whether the user approved a payment request (instead of using the confirmUrl).
Parameters
input
options?
Returns
Promise<LinePayResult<CheckPaymentStatusResponse>>
checkRegKey()
checkRegKey(input, options?): Promise<LinePayResult<LinePayResponse>>;Defined in: src/client-types.ts:222
Check the status of a registration key (pre-approved payment).
Parameters
input
options?
Returns
Promise<LinePayResult<LinePayResponse>>
confirm()
confirm(input, options?): Promise<LinePayResult<ConfirmResponse>>;Defined in: src/client-types.ts:180
Complete the payment after the user approved it. An unknown outcome (a timeout) does not mean the payment failed; see reconcile.
Parameters
input
options?
Returns
Promise<LinePayResult<ConfirmResponse>>
Example
const { body } = await linePay.confirm({ transactionId, amount: 1000, currency: 'TWD' })expireRegKey()
expireRegKey(input, options?): Promise<LinePayResult<LinePayResponse>>;Defined in: src/client-types.ts:234
Expire a registration key.
Parameters
input
options?
Returns
Promise<LinePayResult<LinePayResponse>>
paymentDetails()
paymentDetails(input, options?): Promise<LinePayResult<PaymentDetailsResponse>>;Defined in: src/client-types.ts:210
Look up payments, refunds and orders by transaction ID or order ID.
Parameters
input
options?
Returns
Promise<LinePayResult<PaymentDetailsResponse>>
payPreapproved()
payPreapproved(input, options?): Promise<LinePayResult<PayPreapprovedResponse>>;Defined in: src/client-types.ts:228
Charge a registration key without user approval.
Parameters
input
options?
Returns
Promise<LinePayResult<PayPreapprovedResponse>>
reconcile()
reconcile(errorOrContext, options?): Promise<ReconcileResult>;Defined in: src/client-types.ts:265
Find out, from the payment details, whether a call with an unknown outcome (a timeout, a cut connection, or a duplicate answer) took effect. It only concludes from evidence and never repeats the operation.
Pass the error the call threw. If the process died before it got an answer there is no error: save a ReconcileContext before making the call, and pass that from a background job instead.
Parameters
errorOrContext
unknown
options?
Returns
Promise<ReconcileResult>
Example
try {
await linePay.confirm({ transactionId, amount, currency })
} catch (error) {
if (!needsReconcile(error)) throw error
const result = await linePay.reconcile(error)
if (result.status === 'applied' && result.operation === 'confirm') {
markPaid(result.body.info)
}
}refund()
refund(input, options?): Promise<LinePayResult<RefundResponse>>;Defined in: src/client-types.ts:204
Refund a payment, fully or partially. A refund is not idempotent: never repeat it blindly after an unknown outcome.
Parameters
input
options?
Returns
Promise<LinePayResult<RefundResponse>>
Example
const { body } = await linePay.refund({ transactionId, refundAmount: 20 })request()
request(input, options?): Promise<LinePayResult<RequestPaymentResponse>>;Defined in: src/client-types.ts:168
Reserve a payment. Send the user to body.info.paymentUrl.web (or .app, from an app), then call confirm when they return to your confirmUrl.
Parameters
input
options?
Returns
Promise<LinePayResult<RequestPaymentResponse>>
Example
const { body } = await linePay.request({
amount: 1000,
currency: 'TWD',
orderId: 'order-1',
packages: [{ id: 'p1', amount: 1000, products: [{ name: 'Tea', quantity: 2, price: 500 }] }],
redirectUrls: { confirmUrl: 'https://shop.example/confirm', cancelUrl: 'https://shop.example/cancel' }
})void()
void(input, options?): Promise<LinePayResult<LinePayResponse>>;Defined in: src/client-types.ts:192
Void an authorization that has not been captured.
Parameters
input
options?
Returns
Promise<LinePayResult<LinePayResponse>>
with()
with(...middleware): LinePayClient;Defined in: src/client-types.ts:243
Returns a new client with more middleware, placed inside the existing stack. The client it is called on does not change.
Parameters
middleware
...Middleware[]
Returns
LinePayClient