Connect your system to LineP2P in minutes: create invoices, receive real-time webhooks and check payment status programmatically.
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.
/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_fiat | number | Yes | Amount in USD |
| token_type | string | Yes | Token: USDT, USDC, DAI or USDS |
| evm_network | string | Yes | EVM Network (see list) |
| description | string | No | Description (optional) |
| redirect_url | string | No | URL 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.
/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.
/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.
/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..."}]
}
}
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...
payment.confirmed) and can verify the status with GET /api/check-status.php. The redirect URL must be absolute and use http/https. 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
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
| event | Description |
|---|---|
| payment.confirmed | Sent 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).
# 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;
| Code | Description |
|---|---|
| 200 | OK |
| 400 | Bad Request — invalid or missing parameters. |
| 401 | Unauthorized — missing or invalid API key. |
| 404 | Not Found — invoice does not exist. |
| 500 | Server Error — try again later. |
Keep your API key secret. Always verify the X-Webhook-Signature with HMAC-SHA256 using your API key, and use HTTPS only.