Appearance
Node.js SDK reference
Package: @autlantic/payments v0.1
AutlanticPayments
Constructor
ts
new AutlanticPayments({
tronGridApiKey?: string;
sandbox?: boolean;
webhookSecret?: string;
incomingPollLimit?: number; // default 50, max 200
tronGridMaxRetries?: number; // default 2
});static fromEnv(env?)
| Env | Config |
|---|---|
TRONGRID_API_KEY | tronGridApiKey |
AUTLANTIC_PAYMENTS_SANDBOX or AUTLANTIC_PAYMENTS_TEST_MODE | sandbox |
AUTLANTIC_PAYMENTS_WEBHOOK_SECRET | webhookSecret |
AUTLANTIC_PAYMENTS_POLL_LIMIT | incomingPollLimit |
AUTLANTIC_TRONGRID_MAX_RETRIES | tronGridMaxRetries |
Methods
| Method | Returns | Description |
|---|---|---|
createIntent(input) | PaymentIntent | Validates input, creates intent |
verifyByTxHash(intent, txHash) | PaymentVerificationResult | On-chain or sandbox verify |
findMatchingPayment(intent) | MatchedPayment | null | Poll recent incoming USDT |
confirmByTxHash(intent, txHash) | { ok, event?, transfer? } | Verify + payment.confirmed event |
signWebhook(event) | { body, signature } | null | HMAC-SHA256 outbound webhook |
verifyWebhook(body, header) | boolean | Check x-autlantic-signature |
parseWebhook(body, header) | PaymentConfirmedEvent | null | Verify + parse JSON |
emitTestEvent(input) | EmitTestEventResult | Sandbox: run scenario + optional webhook |
triggerTestEvent(input) | same as emitTestEvent | CLI alias |
listTestScenarios() | SandboxScenario[] | All built-in test cases |
Sandbox scenario ids: see Sandbox & testing.
Core (@autlantic/payments-core)
PaymentIntent,CreatePaymentIntentInputPaymentMatchStrategy:"minimum_amount"|"exact_amount"PaymentFailureCode—PAYMENT_FAILURE_CODES,failureMessageForCode()verifyTransferAgainstIntent(intent, transfer)— pure, no I/OdefaultCheckoutExpiresAt(hours?),defaultMatchStrategy()isValidTronTxHash,validatePayToAddressisVerificationSuccess/isVerificationFailure
Chain (@autlantic/chain-tron)
fetchUsdtTransferByTxHash(txHash)findIncomingUsdtPayment(intent, { limit? })findMatchingIncomingRow(rows, intent)configureTronGrid({ apiKey, fetchImpl, maxRetries, retryDelayMs })