Best Practices
Use these developer practices to handle Stax API limits, track ACH payment outcomes, test deposits, and classify stored-card transactions.
This guide is for developers using Stax.js and the Stax API. The Stax Pay instructions describe sandbox testing steps, not an end-user payment workflow.
Throttling – Rate Limiting
All Stax API routes are throttled to 200 requests per minute per IP address. You are only allowed 10 failed API requests per minute per IP address. If you hit either limit, you will be blocked for one hour.
Stax.js routes are different. When you call the .pay() or the .tokenize() method, Stax.js hits the Stax API with the defined Web Payments token. This resource is throttled to 10 requests per minute per IP address.
Some other Stax APIs may be throttled at a lower rate, depending on their security risk.
Note: If you need to process a higher number of requests, or have a use case where you think you may need to bypass these limits, please reach out to the Stax support or partner support team to have your IP address(es) whitelisted, or for more information about throttling.
ACH Transactions
You can accept ACH (Automated Clearing House, a network for bank-account payments) through Stax.js and the Stax API. Unlike the initial response for a credit card payment, an ACH payment's initial response does not confirm its final outcome. Allow up to 5 business days for the final success or failure status.
Track the payment through these stages:
- Check initial validation. Stax returns
"success": truewhen the payment passes its initial checks. If validation fails, Stax marks the payment as failed immediately. - Wait for processing. Payments that pass validation batch each day at 8 pm EST and enter a settling state (
"is_settling": true). Settlement is the processing stage in which a payment completes before funds are paid out to the merchant. - Check the final outcome. During the next 5 business days, the payment follows one of these paths:
- Settled: Stax populates
settled_atwith the settlement date and time. Expect the funds in the merchant's bank account in roughly 1–2 business days, although failed funding instructions can delay the deposit. - Rejected: Stax creates an associated void transaction (a record that cancels the original payment).
Transaction.child_transactions[0].typeis"void",Transaction.is_voidedistrue, andTransaction.settled_athas no value.
- Settled: Stax populates
Treat success: true as initial acceptance, not confirmation that the merchant has received the funds.
ACH Rejections
An ACH payment can be rejected because of insufficient funds, a frozen account, or incorrect account information. Rejection can occur 1–5 business days after the transaction. You can display the rejection details so your customer can check their account information or contact their bank.
- Confirm that
Transaction.methodis"bank". - Check that
Transaction.child_transactionscontains a transaction before accessing index0. - If
Transaction.child_transactions[0].typeis"void", read the rejection details fromTransaction.child_transactions[0].meta:achStatuscontains the ACH status, such as"FAILED".achDescriptioncontains a NACHA reason code (a standardized ACH-network code explaining why a bank rejected a payment) and its description in one string. For example:"ReasonCode: R03.ReasonDescription: No Account/Unable to Locate Account".
If the child transaction is absent or is not a void, do not treat it as the rejection record described here.
Testing ACH
Run these tests in your sandbox account. Use the supplied test bank details; you don't need to find IDs in the Dashboard.
- Create an ACH transaction with routing number
021000021and account number9876543210. This combination simulates a successful payment; any other combination triggers a failure. - To test a rejection or clawback (a reversal that takes back payment funds) during settlement processing, create a $730.14 transaction.
- Open Stax Pay > Reports > Deposit Report and select Simulate Settlements.
- Check the transaction's final status using the fields described in ACH Transactions and ACH Rejections above. For the rejection test, expect an associated void transaction rather than relying on the initial
successflag.
Testing Deposit Reporting
Use the Deposit Reporting API to retrieve deposits and connect them to the original transactions. In a sandbox account, you must simulate settlement (completion of payment processing) to generate deposit-reporting test data.
- Create transactions in your sandbox account before running the simulation.
- Open Stax Pay > Reports > Deposit Report and select Simulate Settlements to generate test data for the sandbox transactions. The existing simulation feature is also available in the API Keys App.
- Retrieve the generated data through the Deposit Reporting API and check that you can connect deposits to the original transactions.
When transactions exist before simulation, Simulate Settlements also fires the update_transaction_settled webhook event. Expect deposit-reporting data and the corresponding webhook events after running the simulation.
Reduce the risk of double-crediting ACH refunds
We recommend disabling refunds until the ACH payment has settled (completed payment processing). If you refund an unsettled payment and that payment later fails, you could credit your customer for money they never paid you. This creates a risk of double-crediting.
After you confirm the payment has settled, use the Refund Transaction API resource to request a refund. Waiting for this status reduces the risk described here; it does not guarantee that every refund will succeed.
ACH Specific Webhooks
Use these webhook events (notifications Stax sends to your configured URL) to track ACH payment outcomes:
create_transactionfires when Stax creates an ACH or credit card transaction. Whenmethodis"bank", treatsuccess: trueas initial acceptance, not completed payment processing. Display the payment as awaiting its final outcome, and do not offer refunds or voids while it remains in this state.update_transaction_settledfires when an ACH transaction settles (completes payment processing) or fails. Read theis_transaction_settledboolean to distinguish the outcome, and inspect the transaction details for rejection information when it fails.
Use the Webhooks API documentation to configure delivery to your URL.
The following valid JSON shows selected fields from an update_transaction_settled POST body. It is a payload excerpt, not executable code or a complete event; the full payload also includes the outcome fields described above.
{
"id": "6f49149d-69a1-48e6-bec5-d63eb5816118",
"child_transactions": [],
"is_voided": false
}The id is an example transaction UUID. In your integration, read the actual value from the webhook payload's id field; you do not need to copy an ID from the Dashboard. In this excerpt, the child-transaction list is empty, and the transaction is not voided; these fields alone do not confirm a successful final outcome.
Stored Credentials / Recurring Payments
When you first store a customer’s card details after approval and a successful transaction, Stax records the transaction’s details.
On future transactions, Stax references the stored card details and previous transaction details to reduce the chance of a decline. In addition, you must provide the reason for storing the card (regular payments, installment plans, recurring, or other reasons).
You must specify who initiated storing card details (merchant or customer). By default, Stax sends this data based on where the transaction occurred. For example, if the transaction occurred on the customer portal, then the type would be set to CIT or customer-initiated transaction.
Note: If you have your own scheduler or wish to override these settings, See our API for the correct metadata to send.
Credential on File Types
Scheduled: For regular payments, like subscriptions or payments split into several parts over time.
Unscheduled: For payments without a fixed schedule.
Types of Future Transactions (MIT or CIT):
MIT (Merchant Initiated Transaction): This is when the merchant starts a transaction without the customer directly involved, like a subscription renewal or recurring transaction.
CIT (Customer Initiated Transaction): This is when the customer actively initiates the transaction, like buying something from your merchant website.
Updated 5 days ago
