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

EndpointTierLimit
POST /transaction/createWallet Gen20 / 15 min
GET /public/transaction/verifyStandard100 / 15 min
GET /public/transaction/listStandard100 / 15 min
POST /public/transaction/cancelStandard100 / 15 min

Create a Payment Link

POST /api/v1/transaction/create

Auth: apikey header

Query Parameters:

ParameterTypeRequiredDescription
currencyTypestringYesUSDT-TRC20 or USDT-ERC20
amountnumberYesPayment amount in USDT
callbackUrlstringNoRedirect URL after payment
timernumberNoInvoice expiry in minutes (default: 10)
webhookUrlstringNoOverride 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 FieldDescription
urlPayment page URL — share with customer
transactionIdUse for verification and webhook matching
invoiceNoSequential 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

StatusDescription
initiatedPayment link created, awaiting payment
amount confirmedOn-chain balance detected, sweeping
confirmedFunds swept and credited
failedInvoice expired without payment
cancelledManually cancelled via API

Cancel a Transaction

POST /api/v1/public/transaction/cancel
{ "transactionId": "a1b2c3d4...", "type": "deposit", "remarks": "Customer requested" }

Only initiated transactions can be cancelled.


List Transactions

GET /api/v1/public/transaction/list?type=deposit&status=confirmed&page=1&limit=20
ParameterDescription
typedeposit, withdrawal, payout
statusFilter by status
searchSearch by transaction ID, wallet address, or invoice number
page / limitPagination (default: 20, max: 100)

Error Handling

ErrorCodeSolution
API key required401Include apikey header
Wallet generation failed500Retry after a few seconds
Transaction not found404Verify the transaction ID
Only deposits with status initiated can be cancelled400Transaction already paid/expired