Base URL: https://linep2p.com

API

Connect your system to LineP2P in minutes: create invoices, receive real-time webhooks and check payment status programmatically.

Quick Start

  1. 1 Create an account and copy your API key from the dashboard.
  2. 2 Create an invoice with a POST request and send the optional redirect_url of your success page.
  3. 3 Redirect the customer to the returned checkout_url.
  4. 4 Get notified via webhook, or poll the status. Once paid, the customer is redirected back to your redirect_url.

Authentication

Each merchant has a unique API Key. Include it in all requests via the X-API-Key header. Find your key in the dashboard Settings.

Find your API key in the dashboard under Settings → API Key.

# Create an invoice with curl
curl -X POST https://linep2p.com/api/create-invoice.php \
-H "Content-Type: application/json" \
-H "X-API-Key: linep2p_your_api_key_here" \
-d '{"amount_fiat":100,"token_type":"USDT","evm_network":"Polygon","redirect_url":"https://tutienda.com/gracias"}'

Endpoints

POST /api/create-invoice.php

Generates a payment link and returns the checkout details.

Request (application/json)

{
    "amount_fiat": 100.00,
    "token_type": "USDT",
    "evm_network": "Polygon",
    "description": "Order #123",
    "redirect_url": "https://tutienda.com/gracias"
}
Field Type Required Description
amount_fiatnumberYesAmount in USD
token_typestringYesToken: USDT, USDC, DAI or USDS
evm_networkstringYesEVM Network (see list)
descriptionstringNoDescription (optional)
redirect_urlstringNoURL to redirect the customer to after payment (optional)

Response

{
    "success": true,
    "invoice_id": 123,
    "crypto_amount": 100.50,
    "token_type": "USDT",
    "evm_network": "Polygon",
    "wallet_destination": "0xabc...",
    "checkout_url": "https://linep2p.com/public/pay.php?id=123",
    "redirect_url": "https://tutienda.com/gracias",
    "expires_at": "2026-01-01 12:00:00"
}

Returns invoice ID, crypto amount, checkout URL, and wallet address.

GET /api/check-status.php?id=<invoice_id>

Query the status of an existing invoice.

{
    "success": true,
    "invoice_id": 123,
    "status": "paid",
    "crypto_amount": 100.50,
    "tx_hash": "0xdef..."
}

Returns status (pending, paid, expired), amount, and TX hash if paid.

GET /api/verify-key.php

Check if an API key is valid.

Header:

X-API-Key: linep2p_your_key
{
    "valid": true,
    "email": "you@example.com"
}

Returns valid status and associated email.

GET /api/tokens.php

Get all supported tokens and their available networks dynamically.

Response:

{
    "success": true,
    "tokens": {
        "USDT": [{"network":"Ethereum","contract":"0x..."}, ...],
        "USDC": [{"network":"Ethereum","contract":"0x..."}, ...],
        "DAI":  [{"network":"Ethereum","contract":"0x..."}],
        "USDS": [{"network":"Ethereum","contract":"0x..."}]
    }
}

Payment confirmation & customer redirect

When creating an invoice you can send an optional redirect_url (alias return_url). As soon as the payment is confirmed on-chain, the checkout shows the payment confirmed message and, 2 seconds later, redirects the customer back to that URL appending the result as query params: invoice_id, status=paid and tx_hash.

URL your success page receives:

https://tutienda.com/gracias?invoice_id=123&status=paid&tx_hash=0xdef...
If you do not send a redirect_url, the customer stays on the checkout page with the payment confirmed message. Your server is also notified via webhook (payment.confirmed) and can verify the status with GET /api/check-status.php. The redirect URL must be absolute and use http/https.

Supported Networks

All 7 networks supported for USDT, USDC, DAI and USDS.

Ethereum

Ethereum

BNB Smart Chain

BSC

Polygon

Polygon

Base

Base

Arbitrum One

Arbitrum

Optimism

Optimism

Avalanche C-Chain

Avalanche

Webhooks

When a payment is confirmed, we send a POST request to your configured callback URL with the invoice data.

Set your callback URL in Settings → Webhook / Callback URL

Webhook Signature Verification

Each webhook includes a X-Webhook-Signature header. Verify it using HMAC-SHA256 with your API key as the secret to ensure the request is genuine.

Events

eventDescription
payment.confirmedSent when a payment is detected and confirmed on-chain.

Headers:

Content-Type: application/json
X-Webhook-Signature: <hmac-sha256(payload, your_api_key)>

Verification example (PHP):

$payload = file_get_contents('php://input');
$signature = $_SERVER['HTTP_X_WEBHOOK_SIGNATURE'];
$expected = hash_hmac('sha256', $payload, 'linep2p_your_api_key');
if (hash_equals($expected, $signature)) {
    // Webhook is valid - process it
}

Verification example (Node.js):

const crypto = require('crypto');

const signature = req.headers['x-webhook-signature'];
const expected = crypto
    .createHmac('sha256', 'linep2p_your_api_key')
    .update(rawBody)
    .digest('hex');

if (crypto.timingSafeEqual(Buffer.from(signature), Buffer.from(expected))) {
    // Webhook is valid - process it
}

POST payload sent to your URL:

{
    "event": "payment.confirmed",
    "invoice_id": 123,
    "status": "paid",
    "crypto_amount": 100.50,
    "token_type": "USDT",
    "evm_network": "Polygon",
    "wallet_destination": "0xabc...",
    "tx_hash": "0xdef...",
    "from_address": "0x123...",
    "fee_amount": 0
}

If your server does not respond with 2xx, we retry with exponential backoff. Make your endpoint idempotent (dedupe by invoice_id / tx_hash).

Examples

# Create an invoice with curl

curl -X POST https://linep2p.com/api/create-invoice.php \
-H "Content-Type: application/json" \
-H "X-API-Key: linep2p_your_key" \
-d '{"amount_fiat":50,"token_type":"USDC","evm_network":"BSC","redirect_url":"https://tutienda.com/gracias"}'

# Check invoice status

curl "https://linep2p.com/api/check-status.php?id=1"

# PHP integration example

$ch = curl_init('https://linep2p.com/api/create-invoice.php');
curl_setopt_array($ch, [
CURLOPT_POST => true,
CURLOPT_HTTPHEADER => ['Content-Type: application/json', 'X-API-Key: linep2p_your_key'],
CURLOPT_POSTFIELDS => json_encode(['amount_fiat' => 100, 'token_type' => 'USDT', 'evm_network' => 'Polygon', 'redirect_url' => 'https://tutienda.com/gracias']),
CURLOPT_RETURNTRANSFER => true,
]);
$res = json_decode(curl_exec($ch), true);
echo $res['checkout_url']; // Payment link

# JavaScript (fetch) example

const res = await fetch('https://linep2p.com/api/create-invoice.php', {
method: 'POST',
headers: {
'Content-Type': 'application/json',
'X-API-Key': 'linep2p_your_key'
},
body: JSON.stringify({ amount_fiat: 100, token_type: 'USDT', evm_network: 'Polygon', redirect_url: 'https://tutienda.com/gracias' })
});
const data = await res.json();
window.location.href = data.checkout_url;

Status Codes

CodeDescription
200OK
400Bad Request — invalid or missing parameters.
401Unauthorized — missing or invalid API key.
404Not Found — invoice does not exist.
500Server Error — try again later.

Security

Keep your API key secret. Always verify the X-Webhook-Signature with HMAC-SHA256 using your API key, and use HTTPS only.