PAYTEEZ — QUICK INTEGRATION GUIDE · API v1

Documentation: https://payteez.com/docs?lang=en
API schemas: https://payteez.com/docs/openapi.json
PHP / Node.js / Python clients: https://payteez.com/payteez-integration-kit.zip
WordPress + WooCommerce: https://payteez.com/payteez-woocommerce.zip
Plugin guide: https://payteez.com/docs/wordpress?lang=en

1. SETUP
Open API → Accept payments → Add in the dashboard. Create a merchant, store its
ID and secret on your server, verify the HTTPS domain using the supplied file,
and submit for approval. Configure webhook, success and failure URLs on that domain.
The webhook must accept POST without login or redirects. Verify its signature.
Never expose secrets in browser code or AI conversations.

2. CREATE AN INVOICE
Base URL: https://payteez.com. POST with Content-Type: application/json.
POST /api/merchant/v1/orders
{"requestId":"shop-order-123-attempt-1","orderId":"ORDER-123","amount":"10.00","currency":"USD"}

Save requestId (16–100 characters) and orderId (1–100 characters) before sending.
Read the amount and currency from your database. Amount is a positive decimal string.
Maximum decimals: USD/RUB/EUR 2; USDT/USDC/XRP/TRX 6;
BTC/ETH/BCH/LTC/DASH/BNB/DOGE 8; TON/SOL 9.
Response: id, orderId, status, amount, currency, test, expiresAt, checkoutUrl.
Save id and redirect the buyer to checkoutUrl. The invoice expires after 30 minutes.
The buyer chooses a currency and continues to their Payteez dashboard to pay.
The QR code opens the invoice on another device. With conversion, the merchant
receives merchantAmount in the original currency, accounting for the fee payer. Verify payment via webhook or
status, never merely by a return-page redirect.

The supplied Node.js client signs requests:
import {Payteez} from './payteez.mjs';
const api = new Payteez(process.env.PAYTEEZ_SHOP_ID, process.env.PAYTEEZ_SHOP_SECRET);
const invoice = await api.request('/api/merchant/v1/orders', savedOrder);
// savedOrder contains the parameters already persisted in your database.
// Save invoice.id; redirect the buyer to invoice.checkoutUrl.
PHP and Python use the same request(path, data) method; see the kit examples.

3. SIGNING A CUSTOM CLIENT
Send these four headers with each request:
X-Payteez-Id: merchant ID (or a separate API-user ID for payouts)
X-Payteez-Time: 13-digit Unix timestamp in milliseconds; tolerance ±5 minutes
X-Payteez-Nonce: new random 16–100 character string using A–Z, a–z, 0–9, _ or -
X-Payteez-Signature: HMAC-SHA256(secret, canonical), lowercase hexadecimal
canonical = time + "\n" + nonce + "\nPOST\n" + path + "\n" + rawBody
\n is LF (0x0A). Use the secret as a UTF-8 string, not hex-decoded bytes.
The path excludes the domain and query. Sign the exact UTF-8 JSON bytes sent;
do not append a newline. The supplied clients handle signing automatically.

4. VERIFY PAYMENT
Payteez POSTs signed JSON to your webhook:
{"id":"INVOICE-UUID","orderId":"ORDER-123","merchantId":"149100","status":"paid","amount":"10.00","currency":"USD","test":false}
X-Payteez-Signature = HMAC-SHA256(secret, rawBody), lowercase hexadecimal.
Webhooks have no time/nonce; this formula differs from API request signing.
Verify the raw-body signature with a constant-time comparison. Match merchantId,
id, orderId, exact amount, currency, status=paid and test=false against your records.
Use decimal or integer minor units, not floating-point arithmetic.
Fulfil the order ONCE in a database transaction with a unique invoice-ID constraint.
Return HTTP 2xx after saving, including for previously processed valid events.
Failures are retried up to 10 times. A success URL redirect does not prove payment.
Existing invoices keep their original notification secret after key rotation.
Details: https://payteez.com/docs/webhooks?lang=en

5. STATUS AND SAFE RETRIES
POST /api/merchant/v1/status  {"id":"INVOICE-UUID"}
Invoice statuses: pending / paid / expired.
After a timeout, retry with the SAME requestId and details, but a new timestamp,
nonce and signature. Do not generate a new requestId because of a network error.
After confirmed expiry, create a new attempt with a new requestId and orderId.

6. OPTIONAL PAYOUTS
Create a separate approved API user with exact public server IPs, permissions,
currency and limits. Merchant keys cannot make payouts.
POST /api/payout/v1/balance  {}
POST /api/payout/v1/transfer
{"requestId":"payout-order-123456","recipient":"P149101","amount":"10.00","currency":"USD"}
POST /api/payout/v1/withdraw
{"requestId":"withdraw-order-123456","ticker":"USDTTRC","address":"RECIPIENT_ADDRESS","destTag":"","amount":"10"}
POST /api/payout/v1/status  {"requestId":"withdraw-order-123456"}
Payout requestId: 16–80 letters/digits/_/-. Preserve data and JSON field order on retry.
Permissions: balance / transfer / withdraw. Statuses: pending / sending / done / cancelled.
Check the network ticker, memo/tag, minimums and fees in dashboard Payment systems.
Transfer/withdrawal request amount is the recipient amount; response amount includes fees.
Merchant fees are fixed when an invoice is created. Callback amount is the original order amount.
Limits include fees; daily limits use UTC. Pending does not mean payment completed.
The public API does not provide card payouts, refunds, invoice cancellation or exchange.

7. TEST BEFORE LAUNCH
Reject wrong signatures, amounts, currencies and unrelated orders. Duplicate webhooks
must not fulfil an order twice. Timeouts must not create another transaction.
Errors: {"error":"description"}. HTTP 400 parameters/limits; 401 signature/time;
403 access/IP/permissions; 404 not found; 409 conflict/reused nonce;
413 body over 64 KiB; 415 format; 429 rate limit; 500 server error.
API limit: 60 requests per minute per IP and per key. Check status after timeouts/500.
Dashboard test invoices do not debit funds or send webhooks. There is no public
sandbox: do not execute real payouts merely to test code.

AI-ASSISTED INTEGRATION
Give your AI this file and the OpenAPI link. Ask it to adapt the integration to
your order database, authorization and server language, including retry and signature
tests. Supply keys separately through server environment variables.
Prompt: https://payteez.com/docs/ai?lang=en
Official logos and HTML: https://payteez.com/docs/branding?lang=en
Light background: https://payteez.com/brand/payteez-on-light.svg
Dark background: https://payteez.com/brand/payteez-on-dark.svg


FEES AND COMPATIBILITY
Never hardcode tariffs. Invoices return fee, feePayer, payerAmount and merchantAmount.
Merchant API and webhook amount is the original order amount, not the net credit.
Invoice fees are fixed at creation. Payout request amount is the recipient amount.
Before paying, POST /api/payout/v1/quote with action=transfer, currency, amount
or action=withdraw, ticker, amount. Sign with your payout key.
Include the returned total in transfer/withdraw. If the total changes, HTTP 409
is returned without debiting; recalculate and obtain approval, never auto-approve increases.
Payout responses: amount=total (full debit), fee, recipientAmount. Status returns saved
amounts. Old operations may omit fee/recipientAmount. On network errors, check status
and retry with the original requestId and body. Existing keys and requests keep working;
total is optional. Ignore unknown response fields.
Details: https://payteez.com/docs/fees?lang=en
