Skip to content

Sandbox & testing

Use sandbox mode as your test environment. No real USDT, no TronGrid key required.

DANGER

Never enable AUTLANTIC_PAYMENTS_SANDBOX in production.

Enable sandbox

bash
export AUTLANTIC_PAYMENTS_SANDBOX=true
export AUTLANTIC_PAYMENTS_WEBHOOK_SECRET=whsec_test_123   # optional
ts
import { AutlanticPayments } from "@autlantic/payments";

const payments = AutlanticPayments.fromEnv();
// or
const payments = new AutlanticPayments({ sandbox: true, webhookSecret: "whsec_test_123" });

Test transaction hashes

Pass these as txHash in verifyByTxHash while sandbox: true:

Test tx hashScenarioExpected result
sandbox_payment_confirmedSuccessful paymentok: true
sandbox_payment_shortUnderpaymentPAYMENT_SHORT
sandbox_payment_expiredExpired checkoutPAYMENT_EXPIRED
sandbox_payment_wrong_addressWrong walletPAYMENT_WRONG_ADDRESS
sandbox_payment_too_earlyTx before sessionPAYMENT_TOO_EARLY
sandbox_payment_not_foundTx not on chainPAYMENT_TX_NOT_FOUND
sandbox_payment_invalid_hashBad hash formatINVALID_TX_HASH

Legacy aliases (sandbox_confirm_test, sandbox_success, etc.) still work.

Trigger test events

Like stripe trigger — no tx hash needed:

ts
const payments = new AutlanticPayments({ sandbox: true, webhookSecret: "whsec_test" });

const success = payments.emitTestEvent({
  scenario: "payment.confirmed",
  merchantRef: "order_1001",
  amountUsdt: 49,
  payToAddress: "TLyqzVGLV1srkB7dToTAEqgDSfPtXRJZYH",
});

console.log(success.event);
console.log(success.webhook?.body, success.webhook?.signature);

const failed = payments.emitTestEvent({
  scenario: "payment.failed.short",
  merchantRef: "order_1002",
  amountUsdt: 20,
  payToAddress: "TLyqzVGLV1srkB7dToTAEqgDSfPtXRJZYH",
});

if (!failed.verification.ok) {
  console.log(failed.verification.code); // PAYMENT_SHORT
}

List scenarios:

ts
payments.listTestScenarios().forEach((s) => {
  console.log(s.id, s.testTxHash, s.description);
});

Scenario ids

Scenario idEvent type
payment.confirmedpayment.confirmed
payment.failed.shortpayment.failed
payment.failed.expiredpayment.failed
payment.failed.wrong_addresspayment.failed
payment.failed.too_earlypayment.failed
payment.failed.tx_not_foundpayment.failed
payment.failed.invalid_hashpayment.failed

CLI

bash
npx autlantic-payments scenarios

npx autlantic-payments trigger payment.confirmed \
  --merchant-ref order_1 --amount 20 \
  --to TLyqzVGLV1srkB7dToTAEqgDSfPtXRJZYH

npx autlantic-payments sandbox \
  --merchant-ref order_3 --amount 20 \
  --to TLyqzVGLV1srkB7dToTAEqgDSfPtXRJZYH \
  --tx sandbox_payment_confirmed

Live mode (optional)

Use real Tron tx hashes (64 hex) + TRONGRID_API_KEY with sandbox off.

Autlantic product

The Autlantic membership platform uses the same npm SDK in production. For end-to-end checkout testing on a store, set AUTLANTIC_PAYMENTS_SANDBOX=true on web and worker services.