Skip to content

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?)

EnvConfig
TRONGRID_API_KEYtronGridApiKey
AUTLANTIC_PAYMENTS_SANDBOX or AUTLANTIC_PAYMENTS_TEST_MODEsandbox
AUTLANTIC_PAYMENTS_WEBHOOK_SECRETwebhookSecret
AUTLANTIC_PAYMENTS_POLL_LIMITincomingPollLimit
AUTLANTIC_TRONGRID_MAX_RETRIEStronGridMaxRetries

Methods

MethodReturnsDescription
createIntent(input)PaymentIntentValidates input, creates intent
verifyByTxHash(intent, txHash)PaymentVerificationResultOn-chain or sandbox verify
findMatchingPayment(intent)MatchedPayment | nullPoll recent incoming USDT
confirmByTxHash(intent, txHash){ ok, event?, transfer? }Verify + payment.confirmed event
signWebhook(event){ body, signature } | nullHMAC-SHA256 outbound webhook
verifyWebhook(body, header)booleanCheck x-autlantic-signature
parseWebhook(body, header)PaymentConfirmedEvent | nullVerify + parse JSON
emitTestEvent(input)EmitTestEventResultSandbox: run scenario + optional webhook
triggerTestEvent(input)same as emitTestEventCLI alias
listTestScenarios()SandboxScenario[]All built-in test cases

Sandbox scenario ids: see Sandbox & testing.

Core (@autlantic/payments-core)

  • PaymentIntent, CreatePaymentIntentInput
  • PaymentMatchStrategy: "minimum_amount" | "exact_amount"
  • PaymentFailureCodePAYMENT_FAILURE_CODES, failureMessageForCode()
  • verifyTransferAgainstIntent(intent, transfer) — pure, no I/O
  • defaultCheckoutExpiresAt(hours?), defaultMatchStrategy()
  • isValidTronTxHash, validatePayToAddress
  • isVerificationSuccess / isVerificationFailure

Chain (@autlantic/chain-tron)

  • fetchUsdtTransferByTxHash(txHash)
  • findIncomingUsdtPayment(intent, { limit? })
  • findMatchingIncomingRow(rows, intent)
  • configureTronGrid({ apiKey, fetchImpl, maxRetries, retryDelayMs })