Invoice Payments (Accepting Payments)
Create one-time payment links with unique wallet addresses, track payment status, and receive webhook confirmations.
Invoice Payments
Create a payment link, share it with your customer, and 3PAY handles wallet generation, on-chain monitoring, and fund sweeping.
How It Works
1. Create Payment Link → POST /api/v1/transaction/create
2. Customer Pays → Sends crypto to the generated wallet
3. On-chain Detection → 3PAY detects the deposit
4. Funds Swept → Swept to your merchant wallet
5. Webhook Notification → confirmed / failed
6. Verify (Optional) → GET /api/v1/public/transaction/verify
Each payment link generates a unique wallet address monitored for the invoice timer duration (default: 10 min).
Rate Limits
| Endpoint | Tier | Limit |
|---|---|---|
POST /transaction/create | Wallet Gen | 20 / 15 min |
GET /public/transaction/verify | Standard | 100 / 15 min |
GET /public/transaction/list | Standard | 100 / 15 min |
POST /public/transaction/cancel | Standard | 100 / 15 min |
Create a Payment Link
POST /api/v1/transaction/create
Auth: apikey header
Query Parameters:
| Parameter | Type | Required | Description |
|---|---|---|---|
currencyType | string | Yes | USDT-TRC20 or USDT-ERC20 |
amount | number | Yes | Payment amount in USDT |
callbackUrl | string | No | Redirect URL after payment |
timer | number | No | Invoice expiry in minutes (default: 10) |
webhookUrl | string | No | Override default webhook URL |
Body Parameters (optional): username, firstName, lastName, email, phoneNumber, description, referenceId
Example
const response = await axios.post(
"https://pay.3pa-y.com/api/v1/transaction/create",
{ email: "[email protected]", referenceId: "ORD-1234" },
{
params: { currencyType: "USDT-TRC20", amount: 50, timer: 15 },
headers: { apikey: "your-api-key" }
}
);
// response.data:
// { success: true, url: "https://pay.3pa-y.com/s/abc123",
// transactionId: "a1b2c3d4...", invoiceNo: "INV-67890-0001" }| Response Field | Description |
|---|---|
url | Payment page URL — share with customer |
transactionId | Use for verification and webhook matching |
invoiceNo | Sequential invoice number |
Customer Payment
Share the url with your customer. The payment page shows the wallet address, QR code, countdown timer, and amount. It polls every 5 seconds and updates automatically on payment.
Webhook Notification
On confirmation, 3PAY sends a webhook with type: "deposit" and status: "confirmed" (or "failed" if the invoice expired).
See Webhook Handling for payload structure, HMAC verification, and best practices.
Verify Transaction (Optional)
GET /api/v1/public/transaction/verify?transactionId={id}&type=deposit
Auth: apikey header
const response = await axios.get(
"https://pay.3pa-y.com/api/v1/public/transaction/verify",
{
params: { transactionId: "a1b2c3d4...", type: "deposit" },
headers: { apikey: "your-api-key" }
}
);
// response.data.data.status → "confirmed", "initiated", "failed"Fees
Deposits use a tiered fee system per merchant. Minimum fee: 1 USDT (TRC20) / 1.50 USDT (ERC20).
depositFeePayer controls who pays: "merchant" (you absorb) or "user" (deducted from deposit).
Details: Settlement & Reconciliation
Transaction Statuses
| Status | Description |
|---|---|
initiated | Payment link created, awaiting payment |
amount confirmed | On-chain balance detected, sweeping |
confirmed | Funds swept and credited |
failed | Invoice expired without payment |
cancelled | Manually cancelled via API |
Cancel a Transaction
POST /api/v1/public/transaction/cancel
{ "transactionId": "a1b2c3d4...", "type": "deposit", "remarks": "Customer requested" }Only
initiatedtransactions can be cancelled.
List Transactions
GET /api/v1/public/transaction/list?type=deposit&status=confirmed&page=1&limit=20
| Parameter | Description |
|---|---|
type | deposit, withdrawal, payout |
status | Filter by status |
search | Search by transaction ID, wallet address, or invoice number |
page / limit | Pagination (default: 20, max: 100) |
Error Handling
| Error | Code | Solution |
|---|---|---|
API key required | 401 | Include apikey header |
Wallet generation failed | 500 | Retry after a few seconds |
Transaction not found | 404 | Verify the transaction ID |
Only deposits with status initiated can be cancelled | 400 | Transaction already paid/expired |
Updated 26 days ago
