Skip to content

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() ​

ts
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 ​

CaptureInput

options? ​

CallOptions

Returns ​

Promise<LinePayResult<CaptureResponse>>


checkPaymentStatus() ​

ts
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 ​

CheckPaymentStatusInput

options? ​

CallOptions

Returns ​

Promise<LinePayResult<CheckPaymentStatusResponse>>


checkRegKey() ​

ts
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 ​

CheckRegKeyInput

options? ​

CallOptions

Returns ​

Promise<LinePayResult<LinePayResponse>>


confirm() ​

ts
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 ​

ConfirmInput

options? ​

CallOptions

Returns ​

Promise<LinePayResult<ConfirmResponse>>

Example ​

ts
const { body } = await linePay.confirm({ transactionId, amount: 1000, currency: 'TWD' })

expireRegKey() ​

ts
expireRegKey(input, options?): Promise<LinePayResult<LinePayResponse>>;

Defined in: src/client-types.ts:234

Expire a registration key.

Parameters ​

input ​

ExpireRegKeyInput

options? ​

CallOptions

Returns ​

Promise<LinePayResult<LinePayResponse>>


paymentDetails() ​

ts
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 ​

PaymentDetailsInput

options? ​

CallOptions

Returns ​

Promise<LinePayResult<PaymentDetailsResponse>>


payPreapproved() ​

ts
payPreapproved(input, options?): Promise<LinePayResult<PayPreapprovedResponse>>;

Defined in: src/client-types.ts:228

Charge a registration key without user approval.

Parameters ​

input ​

PayPreapprovedInput

options? ​

CallOptions

Returns ​

Promise<LinePayResult<PayPreapprovedResponse>>


reconcile() ​

ts
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? ​

CallOptions

Returns ​

Promise<ReconcileResult>

Example ​

ts
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() ​

ts
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 ​

RefundInput

options? ​

CallOptions

Returns ​

Promise<LinePayResult<RefundResponse>>

Example ​

ts
const { body } = await linePay.refund({ transactionId, refundAmount: 20 })

request() ​

ts
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 ​

RequestPaymentInput

options? ​

CallOptions

Returns ​

Promise<LinePayResult<RequestPaymentResponse>>

Example ​

ts
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() ​

ts
void(input, options?): Promise<LinePayResult<LinePayResponse>>;

Defined in: src/client-types.ts:192

Void an authorization that has not been captured.

Parameters ​

input ​

VoidInput

options? ​

CallOptions

Returns ​

Promise<LinePayResult<LinePayResponse>>


with() ​

ts
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

Released under the MIT License. An independent library, not made or endorsed by LINE Pay.