Bind a Customer via LINE Login
Let your members bind their own LINE account. You just hand LOMA a member ID
(customerExternalId); LOMA returns a one-time LINE authorization link. After the
member authorizes on LINE, LOMA automatically binds that member to their LINE
account and 302-redirects back to a URL you specify.
Once bound, you can send messages (notifications / OTP) to that member.
Flow
- Your backend calls
POST /api/v1/merchant/binding/line-loginwith the member ID and areturnUrl. - LOMA returns a one-time
bindingUrl(valid 10 minutes by default). - You redirect / open
bindingUrlfor the member. They tap “Allow” on the LINE page. - LINE calls LOMA back → LOMA fetches the member's LINE
userIdand stores the binding. - LOMA 302-redirects the member back to your
returnUrlwith the result.
1. Create a binding link
POST /api/v1/merchant/binding/line-login
Headers
Requires X-Api-Key and X-Api-Secret (see Authentication).
Body
| Field | Type | Required | Description |
|---|---|---|---|
customerExternalId | string | ✅ | Your member / customer ID |
returnUrl | string | ✅ | Where LOMA redirects after binding completes |
{
"customerExternalId": "C10086",
"returnUrl": "https://your-app.com/line/bound"
}
Success 200
{
"code": "OK",
"message": "Success",
"requestId": "req_...",
"data": {
"bindingUrl": "https://access.line.me/oauth2/v2.1/authorize?response_type=code&client_id=...&state=...",
"state": "9f2a...c1",
"expiresAt": "2026-07-02T08:20:00Z"
}
}
| Field | Description |
|---|---|
bindingUrl | One-time LINE authorization link — redirect the member here |
state | One-time token (LOMA-internal; you don't need to handle it) |
expiresAt | Link expiry (UTC); after this, create a new link |
Common errors
| code | HTTP | Description |
|---|---|---|
LOGIN_NOT_CONFIGURED | 400 | Merchant has no LINE Login channel configured |
VALIDATION_ERROR | 400 | customerExternalId or returnUrl missing |
2. Redirect result
After the member finishes (or cancels), LOMA 302-redirects the browser to your
returnUrl with these query params appended:
Success:
https://your-app.com/line/bound?binding=success&customerExternalId=C10086
Failed / cancelled:
https://your-app.com/line/bound?binding=failed&customerExternalId=C10086&reason=cancelled
| Param | Description |
|---|---|
binding | success / failed |
customerExternalId | The member ID for this binding (echoed back) |
reason | Only on failure: cancelled (user cancelled) / expired (link expired) / already_used (link consumed) / ALREADY_BOUND (member already bound to another LINE) / LINE_ALREADY_BOUND (LINE already bound to another member) / exchange_failed (LINE exchange failed) |
⚠️ Redirect params are for UI hints only. Trust the server: after the redirect, re-confirm with Check binding status before proceeding.
3. Unbind a customer
Remove a member's current LINE binding. After unbinding, the member can go through the binding flow again (rebinding to a different LINE account also requires unbinding first).
DELETE /api/v1/merchant/customer/{customerExternalId}/line-binding
Headers
Requires X-Api-Key and X-Api-Secret (see Authentication).
Path params
| Param | Description |
|---|---|
customerExternalId | Your member / customer ID |
Success 200
{
"code": "OK",
"message": "Success",
"requestId": "req_...",
"data": {
"customerExternalId": "C10086",
"unbound": true,
"status": "UNBOUND"
}
}
| Field | Description |
|---|---|
unbound | Whether an active binding was removed this call. true = unbound; false = the member had no active binding (nothing to do) |
status | Always UNBOUND |
Idempotent: calling it repeatedly for the same member never errors; when there's nothing to remove it returns
unbound=false.
Example
curl -X DELETE https://loma-dev.acorners.com/api/v1/merchant/customer/C10086/line-binding \
-H "X-Api-Key: lk_xxxx" -H "X-Api-Secret: xxxx"
Idempotency & constraints
- One member maps to exactly one LINE account, and vice versa.
- Re-binding the same member with the same LINE account is idempotent — returns success, no duplicate record.
- To rebind, call the unbind endpoint first, then run the binding flow again.
Example
curl -X POST https://loma-dev.acorners.com/api/v1/merchant/binding/line-login \
-H "X-Api-Key: lk_xxxx" -H "X-Api-Secret: xxxx" \
-H "Content-Type: application/json" \
-d '{"customerExternalId":"C10086","returnUrl":"https://your-app.com/line/bound"}'