Getting Started / Overview

LF Pay API Documentation

The LF Pay API lets you accept cryptocurrency payments, manage settlements, and track transactions programmatically.

BASE URL https://api.pay.lflabs.fund/v1
Shell Node Python
# Base URL
https://api.pay.lflabs.fund/v1

# All requests require an API key
curl https://api.pay.lflabs.fund/v1/payments \
  -H "Authorization: Bearer mk_live_..."
Getting Started / Authentication

Authentication

Authenticate requests by including your API key in the Authorization header.

API keys are available in your Merchant Dashboard → Integration. Use mk_test_ keys for sandbox and mk_live_ for production.

HeaderTypeRequiredDescription
AuthorizationstringYesBearer token with your API key
Content-TypestringYesMust be application/json
Header
Authorization: Bearer mk_live_7a3c9fE78543113412f6Ae1a...
Content-Type: application/json
Getting Started / Quick Start

Quick Start

Create your first payment in a single API call. The response includes a checkout_url you can redirect your customer to.

Shell Node Python
curl -X POST https://api.pay.lflabs.fund/v1/payments \
  -H "Authorization: Bearer mk_live_YOUR_KEY" \
  -H "Content-Type: application/json" \
  -d '{
    "amount": 149.99,
    "currency": "USD",
    "accepted_crypto": ["USDT","ETH","BTC","\$LF"],
    "callback_url": "https://yoursite.com/webhook",
    "metadata": {"order_id": "ORD-12345"}
  }'
Payments / Create Payment

POST Create Payment

/v1/payments

Creates a new payment intent. Returns a checkout URL and payment ID.

Request Body

ParameterTypeRequiredDescription
amountnumberYesPayment amount in fiat currency
currencystringYesFiat currency code (USD, EUR, GBP, etc.)
accepted_cryptoarrayNoCrypto whitelist. Default: all supported
callback_urlstringNoWebhook URL for payment events
redirect_urlstringNoURL to redirect customer after payment
metadataobjectNoCustom key-value data (max 10 keys)
expiry_minutesintegerNoPayment expiry time. Default: 30
ResponseRequest
{
  "id": "pay_8f3a2b1c...",
  "status": "pending",
  "amount": 149.99,
  "currency": "USD",
  "checkout_url": "https://pay.lflabs.fund/c/pay_8f3a2b1c",
  "expires_at": "2026-03-24T20:00:00Z",
  "created_at": "2026-03-24T19:30:00Z"
}
Payments / Get Payment

GET Get Payment

/v1/payments/{id}

Retrieves details of a specific payment including status, crypto used, settlement amount, and cashback distributed.

ParameterTypeInDescription
idstringPathThe payment ID (e.g. pay_8f3a2b1c)
Response
{
  "id": "pay_8f3a2b1c...",
  "status": "completed",
  "amount": 149.99,
  "currency": "USD",
  "crypto_used": "USDT",
  "crypto_amount": 149.99,
  "cashback_lf": 3.75,
  "settled": true
}
Payments / List Payments

GET List Payments

/v1/payments

Returns a paginated list of your payments. Supports filters: status, crypto, created_after, created_before, limit, offset.

Response
{
  "data": [
    { "id": "pay_8f3a...", "status": "completed" },
    { "id": "pay_2b1c...", "status": "pending" }
  ],
  "total": 47,
  "limit": 20,
  "offset": 0
}
Payments / Refund Payment

POST Refund Payment

/v1/payments/{id}/refund

Initiates a refund for a completed payment. Refund is sent in the original cryptocurrency to the customer's wallet. Partial refunds supported.

ParameterTypeRequiredDescription
amountnumberNoPartial refund amount. Omit for full refund
reasonstringNoRefund reason for records
Response
{
  "id": "ref_4d2e1a...",
  "payment_id": "pay_8f3a2b1c...",
  "status": "processing",
  "amount": 149.99,
  "crypto": "USDT"
}
Webhooks / Events

Webhook Events

Configure your webhook URL in the dashboard. LF Pay sends POST requests for the following events:

EventDescription
payment.createdPayment intent created
payment.completedOn-chain payment confirmed
payment.failedPayment expired or failed
payment.refundedRefund processed
settlement.processedFiat settled to bank account
cashback.distributed\$LF cashback sent to customer
Payload
{
  "event": "payment.completed",
  "data": {
    "id": "pay_8f3a2b1c...",
    "status": "completed",
    "amount": 149.99,
    "crypto_used": "USDT"
  },
  "timestamp": "2026-03-24T19:31:42Z"
}
Webhooks / Verification

Webhook Verification

Verify webhook authenticity using the X-LFPay-Signature header. We sign each webhook payload with your webhook secret using HMAC-SHA256.

Node.js Python PHP
// Node.js verification
const crypto = require('crypto');
const sig = crypto
  .createHmac('sha256', WEBHOOK_SECRET)
  .update(rawBody)
  .digest('hex');

const valid = sig === req.headers['x-lfpay-signature'];
Checkout / Widget

Checkout Widget

Embed the LF Pay checkout directly in your page. The widget handles crypto selection, QR code display, and payment confirmation.

AttributeTypeRequiredDescription
data-merchantstringYesYour API key
data-amountstringYesPayment amount
data-currencystringYesFiat currency code
data-themestringNodark or light. Default: dark
HTML
<script src="https://pay.lflabs.fund/v1/widget.js"></script>

<div id="lf-pay-widget"
  data-merchant="mk_live_YOUR_KEY"
  data-amount="149.99"
  data-currency="USD"
  data-theme="dark">
</div>
Checkout / Hosted Page

Hosted Checkout

Redirect customers to our hosted checkout page instead of embedding the widget. Use the checkout_url returned from the Create Payment endpoint.

The hosted page handles all payment logic — crypto selection, QR code, wallet connect, and confirmation. Customers are redirected to your redirect_url on completion.

Example
// Redirect to hosted checkout
window.location.href = payment.checkout_url;

// Example URL
"https://pay.lflabs.fund/c/pay_8f3a2b1c"
Settlement / API

GET Settlement API

/v1/settlements

Returns settlement history including dates, amounts, bank details, and associated transactions. Filter by status, date_from, date_to.

Response
{
  "data": [{
    "id": "stl_9a2b...",
    "amount": 4823.50,
    "currency": "USD",
    "transactions": 32,
    "fees": 36.18,
    "burned": 12.66,
    "settled_at": "2026-03-24"
  }]
}
Reference / Error Codes

Error Codes

CodeStatusDescription
400Bad RequestInvalid parameters
401UnauthorizedMissing or invalid API key
403ForbiddenInsufficient permissions or tier
404Not FoundResource does not exist
429Rate LimitedToo many requests
500Server ErrorInternal error — contact support
Error Response
{
  "error": {
    "code": 401,
    "status": "Unauthorized",
    "message": "Invalid API key provided"
  }
}
Reference / Rate Limits

Rate Limits

TierRequests/minRequests/day
Standard6010,000
Business30050,000
Enterprise1,000Unlimited
Rate Limit Headers
X-RateLimit-Limit: 60
X-RateLimit-Remaining: 58
X-RateLimit-Reset: 1711310400
Reference / SDKs & Plugins

SDKs & Plugins

Official SDKs and plugins:

PlatformTypeStatus
Node.jsSDKAvailable
PythonSDKAvailable
PHPSDKAvailable
ShopifyPluginAvailable
WooCommercePluginAvailable
MagentoPluginComing Q4 2026
Install
# Node.js
npm install @lflabs/pay

# Python
pip install lf-pay

# PHP
composer require lflabs/pay
Need help? Contact our developer support at dev@lflabs.fund or join our Telegram developer channel.