PayLex API Reference
Accept card, bank and crypto payments in your website, shop or app and receive them in your own wallet. Three GET requests, no signup.
Integrate with your AI assistant
Copy the prompt and paste it into ChatGPT, Claude, Cursor or any coding agent. It reads our integration guide and builds the checkout, callback handler and security checks into your existing system, in your language and framework.
Fetch and follow the instructions at https://paylex.org/agent/prompt.md to set me up for the PayLex payment API.
The link is public and contains no personal data. Your assistant asks for your payout wallet and stack, and keeps an optional API key in an environment variable, never in the chat or in code. Also available as llms.txt.
Direct payouts
Each payment is forwarded to your wallet as soon as it arrives. Card and bank payments as USDC on Polygon.
Non-custodial
Funds go straight to your own wallet. PayLex never holds your money.
Easy integration
Plain HTTPS GET requests and JSON responses. No SDK, no signup.
Integration Flow
No account needed. Optional: send an in Step 1 to see your payments and statistics in the dashboard.
API Key
OptionalThe API works without registration. An API key links your payments to your PayLex account.
With an API key
Every payment of a wallet created with your key appears in your dashboard under My Links, with status, amounts and statistics.
Without an API key
Everything works the same and payouts are identical, but payments are not linked to an account and no statistics are available.
Create a key
- Create an account or sign in.
- Open the dashboard, tab API, and create a key (up to 10 active keys, e.g. one per shop).
- Copy the key right away. It starts with
plx_and is shown only once.
Send the key with Step 1 (wallet creation)
Use one of the following. The key is only needed when creating the wallet, not in the payment link (Step 2) and not in callbacks.
X-API-Key: plx_…RecommendedAuthorization: Bearer plx_…api_key=plx_…curl "https://api.paylex.org/control/wallet.php?address=0xF977814e90dA44bFA03b6295A0616a897441aceC&callback=https%3A%2F%2Fwww.example.com%2Forders.php%3Fnumber%3D827746841326" \
-H "X-API-Key: plx_your_api_key"Keep your key secret. Call wallet.php from your server only, never from the browser or an app, and never put the key into payment links.
An invalid or revoked key is rejected with HTTP 401 and no wallet is created. If a key leaks, revoke it in the dashboard and create a new one.
Step 1: Create Wallet
GEThttps://api.paylex.org/control/wallet.phpWhat this does
Creates a unique deposit address for one order and links it to your payout wallet. Call it from your server once per order; it is the first step of every payment.
Request Parameters
addressRequiredYour payout wallet on Polygon (0x + 40 hex characters). Use a wallet you control that can receive USDC on Polygon.
Example: 0xF977814e90dA44bFA03b6295A0616a897441aceC
callbackRequiredURL-encoded http(s) URL of your endpoint that receives the payment confirmation (Step 3).
api_keyOptionalYour PayLex API key, see . Payments of this wallet then appear in your dashboard. Prefer the X-API-Key header.
Response Fields
address_inEncrypted address for the payment link in Step 2. It is already URL-encoded: use it as-is, do not encode it again.
polygon_address_inThe deposit address itself. Callbacks report it as address_in; store it to match payments to the order. Never use it in payment links.
callback_urlYour callback URL exactly as you sent it.
ipn_tokenToken for . Store it with your order.
Errors
HTTP 400{"status":"error","message":"Invalid address or callback"}
The address is not a valid 0x… wallet or the callback is not an http(s) URL.
HTTP 401{"status":"error","message":"Invalid or revoked API key"}
Only when an API key was sent.
Any other non-200 response is temporary: show an error and let the customer try again.
Example
https://api.paylex.org/control/wallet.php?address=0xF977814e90dA44bFA03b6295A0616a897441aceC&callback=https%3A%2F%2Fwww.example.com%2Forders.php%3Fnumber%3D827746841326https://api.paylex.org/control/wallet.php?address=0xF977814e90dA44bFA03b6295A0616a897441aceC&callback=https%3A%2F%2Fwww.example.com%2Forders.php%3Fnumber%3D827746841326&api_key=plx_your_api_key{
"address_in": "k1PrTuxSNpkdPZwdmCm4K3nMjAYo1sx17ea6uG0LunhFbr7SHBGQ8NBs3b5jkQw9RVoyWIbOyqzh7wtEipPbGg%3D%3D",
"polygon_address_in": "0x32e854bD1270670C832634CA87858fFd9F3e2c78",
"callback_url": "https://www.example.com/orders.php?number=827746841326",
"ipn_token": "aHR0cHM6Ly93d3cuZXhhbXBsZS5jb20vb3JkZXJzLnBocD9udW1iZXI9ODI3NzQ2ODQxMzI2"
}Step 2: Payment Link
GEThttps://pay.paylex.org/pay.phpWhat this does
Build this link with the encrypted address_in from Step 1 and redirect your customer to it. The customer lands on the PayLex checkout, sees the amount and chooses from the payment methods available in their country. No request from your server is needed.
Parameters
addressRequiredThe encrypted address_in from Step 1, exactly as returned (it is already URL-encoded).
polygon_address_in do not work here. Always use the address_in of the wallet created for this order.amountRequiredOrder total with a dot as decimal separator (e.g. 103.78). You can add a surcharge to cover processing costs.
currencyRequiredThree-letter currency code of the amount (USD, EUR, CAD, …).
emailRecommendedURL-encoded customer email address. With an email the customer goes straight to the payment methods; without one they enter it on the checkout first.
A link without a valid address, a positive amount or a currency code shows an error page to the customer. Opening the same link again (same address, amount and currency) continues the same payment.
Example
https://pay.paylex.org/pay.php?address=k1PrTuxSNpkdPZwdmCm4K3nMjAYo1sx17ea6uG0LunhFbr7SHBGQ8NBs3b5jkQw9RVoyWIbOyqzh7wtEipPbGg%3D%3D&amount=103.78¤cy=USD&email=john%40example.comStep 3: Handle Callback
GETYour callback URL from Step 1What this does
When the payment arrives, PayLex sends a GET request to your callback URL with the payment details. Use it to update the order status and fulfil the purchase.
Callback Parameters
Your original parameters plus the following payment data:
value_coinAmount received, in units of coin. For stablecoins this equals USD; for other coins (e.g. POL) convert it with the price.
coinCoin that was paid, usually polygon_usdc (card and bank payments). Direct crypto payments can also arrive as e.g. polygon_usdt or polygon_pol.
value_forwarded_coinAmount paid out to your wallet (in coin), after fees.
txid_inTransaction hash of the incoming payment. Unique per payment: use it to process each payment only once.
txid_outTransaction hash of the payout to your wallet.
address_inThe deposit address, equal to polygon_address_in from Step 1, so you can match the payment to the order.
address_outJSON object with the receiving wallets and their share of the payment.
uuid / pendingId of the notification, and pending=0 once the payment is final. Do not fulfil while pending=1.
Example Callback
https://www.example.com/orders.php?number=827746841326&coin=polygon_usdc&value_coin=105.6&txid_in=0xa22a82b4aefbc55f6382e1b5c0b4f0e3c034a654df3bcac431f7fed1942e22bc&txid_out=0x94c2c3e84c2021e6bf377aebf8abf03b49570611bb0c336e357d7f4516f56244&uuid=fa7b54e3-55a8-4f01-a9f5-57150ca157b3&address_in=0x32e854bD1270670C832634CA87858fFd9F3e2c78&value_forwarded_coin=98.74&pending=0Best practices
- Answer with HTTP 200 once the payment is processed, and quickly. Any other status (or a timeout) counts as failed and the callback may be sent again.
- Process each
txid_inonly once, so repeated callbacks do not fulfil an order twice. - Keep a secret, random token in your callback URL and check it, so nobody can call your endpoint with made-up data. Also check that
address_inmatches the storedpolygon_address_in. - Compare the received value with your order total before you deliver. Provider fees and exchange rates mean it can differ slightly, so allow a tolerance; customers can also pay less than requested. For high-value orders also verify with .
- Each callback carries the header
X-PayLex-Wallet-Ref, the PayLex reference of the wallet (useful for support requests).
Check Payment Status
GEThttps://api.paylex.org/control/payment-status.phpWhat this does
Returns the payment state of a wallet from Step 1. Use it to double-check a callback or on your order confirmation page; the callback stays the primary signal, so do not poll in a tight loop.
Request Parameters
ipn_tokenRequiredThe ipn_token from the wallet creation response (Step 1).
Response Fields
statuspaid or unpaid. Unpaid responses contain only this field.
value_coinAmount received, in units of coin.
coinCoin that was paid, usually polygon_usdc.
txid_outTransaction hash of the payout to your wallet.
Example
https://api.paylex.org/control/payment-status.php?ipn_token=aHR0cHM6Ly93d3cuZXhhbXBsZS5jb20vb3JkZXJzLnBocD9udW1iZXI9ODI3NzQ2ODQxMzI2{"status": "unpaid"}
{"status": "paid", "value_coin": "105.6", "txid_out": "0x94c2c3e84c2021e6bf377aebf8abf03b49570611bb0c336e357d7f4516f56244", "coin": "polygon_usdc"}Utility Endpoints
GETRead-only helpers, no API key needed.
Convert to USD
https://api.paylex.org/control/convert.phpConverts an amount (value) in a currency (from) to USD; the result is in value_coin. Useful to compare a stablecoin value_coin with an order total in another currency.
https://api.paylex.org/control/convert.php?value=78.53&from=EUR{"status": "success", "value_coin": "87.95", "exchange_rate": "1.11994"}Coin info and price
https://api.paylex.org/crypto/{network}/{coin}/info.phpMinimum amount and current price of a coin in many currencies. The path follows the callback coin: polygon_pol becomes crypto/polygon/pol/info.php. Multiply value_coin by prices.USD to value a non-stablecoin payment.
https://api.paylex.org/crypto/polygon/pol/info.php{"coin": "POL", "minimum": "0.50000000", "prices": {"EUR": "0.082977", "USD": "0.092971", ...}}