Skip to main content

Payment request

Requests a payment to the LINE Pay server using the payment information received from the merchant terminal. The payment information must include the product details, the customer’s My Code (oneTimeKey) provided to the terminal, and merchant information. If the request is processed successfully, the payment is completed.

If payment confirmation and capture have been separated, calling this API alone doesn't complete the payment. You need to capture or void the payment afterward.

A transaction ID is returned in the response, which can be used to request a void, capture, or refund. If a read timeout occurs and you do not receive the response, check the payment status to obtain the result and transaction ID.

POST /v2/payments/oneTimeKeys/pay

Set the read timeout to at least 40 seconds.

If the payment is completed, ensure that the total payment amount (info.payInfo[].amount) in the response matches the requested amount. If there is a mismatch, request a refund from LINE Pay.

Path

None

Query

None

Body

Name
TypeLengthDescription
Required
amountnumber

Payment amount

captureboolean

Whether to capture automatically. Determines whether to process payment confirmation and capture simultaneously or separately after the payment request. The default value is true.

  • true: Process simultaneously.
  • false: Process separately.
currencystring3

Payment currency code (ISO 4217). Supported currency codes are as follows.

  • "USD"
  • "TWD"
  • "THB"
extrasobject

Additional payment information

oneTimeKeystring18 (TW), 12 (TH and Global)

My Code of the LINE Pay user. This value is obtained when the merchant terminal scans the customer’s My Code. It is valid for five minutes from the time the customer generates the code.

orderIdstring100

Order ID. Enter the ID generated by the merchant to manage orders.

productNamestring4000

Product name

Headers
  • Content-Type
  • X-LINE-ChannelId
  • X-LINE-ChannelSecret
  • X-LINE-MerchantDeviceProfileId
  • X-LINE-MerchantDeviceType

For more information, see Request header.

Request examples

curl -X POST \
-H "Content-Type: application/json" \
-H "X-LINE-ChannelId: YOUR_CHANNEL_ID" \
-H "X-LINE-ChannelSecret: YOUR_CHANNEL_SECRET" \
-H "X-LINE-MerchantDeviceProfileId: YOUR_DEVICE_PROFILE_ID" \
-d '{
"productName": "test product",
"amount": 100,
"currency": "THB",
"orderId": "merchant_test_order_1",
"oneTimeKey": "123456789012",
"extras": {
"addFriends": [
{
"type": "LINE_AT",
"idList": ["@aaa"]
}
],
"branchName": "test_branch_1",
"branchId": "branch1"
}
}' \
https://sandbox-api-pay.line.me/v2/payments/oneTimeKeys/pay