Skip to main content

Scottsdale ACH Gateway

Location: web/app/plugins/scottsdale-ach-gateway/ Version: 1.1.0 Author: Rhino Group Plugin Name: Scottsdale ACH Gateway


Overviewโ€‹

The scottsdale-ach-gateway plugin provides two WooCommerce payment gateways:

  1. Scottsdale ACH Gateway โ€” Full ACH bank transfer payment using Plaid for bank account authentication and iTransact as the ACH processing backend.
  2. Scottsdale Deposit Gateway โ€” Credit card deposit gateway (5% of order total) used for bank wire transfer orders. Extends the AngellEYE PayPal PPCP credit card gateway.

File Structureโ€‹

scottsdale-ach-gateway/
โ”œโ”€โ”€ init.php โ† Plugin bootstrap
โ”œโ”€โ”€ inc/
โ”‚ โ”œโ”€โ”€ class-plugin.php โ† Main orchestrator
โ”‚ โ”œโ”€โ”€ class-system.php โ† Gateway registration
โ”‚ โ”œโ”€โ”€ class-admin.php โ† Admin assets
โ”‚ โ”œโ”€โ”€ class-frontend.php โ† Nonce rendering, payment data saving
โ”‚ โ”œโ”€โ”€ class-api.php โ† REST API endpoint registration
โ”‚ โ”œโ”€โ”€ class-gateway.php โ† ACH WooCommerce payment gateway
โ”‚ โ”œโ”€โ”€ class-gateway-deposit.php โ† CC deposit payment gateway
โ”‚ โ”œโ”€โ”€ class-plaid-api.php โ† Plaid API client
โ”‚ โ”œโ”€โ”€ class-itransact-api.php โ† iTransact ACH processor client
โ”‚ โ”œโ”€โ”€ class-utils.php โ† Utility helpers
โ”‚ โ””โ”€โ”€ class-simplexml-extended.php โ† XML parsing utility
โ””โ”€โ”€ dist/
โ”œโ”€โ”€ css/ โ† Compiled CSS
โ”œโ”€โ”€ img/
โ”‚ โ”œโ”€โ”€ money-check-dollar-light.svg โ† ACH gateway icon
โ”‚ โ””โ”€โ”€ credit-card-regular.svg โ† Deposit gateway icon
โ””โ”€โ”€ js/
โ””โ”€โ”€ cc-deposit-checkout.js โ† Deposit gateway frontend

ACH Payment Gateway (WC_Scottsdale_ACH_Gateway)โ€‹

Gateway ID: scottsdale-ach-gateway Extends: WC_Payment_Gateway Title: "ACH Gateway - Scottsdale"

How ACH Checkout Worksโ€‹

1. Customer reaches checkout, selects "ACH Bank Transfer"
2. Gateway calls Plaid API โ†’ gets a Plaid Link token
3. Frontend launches Plaid Link (embedded bank auth UI)
4. Customer selects their bank, authenticates via Plaid
5. Plaid returns a public_token to the browser
6. Frontend calls POST /wp-json/plaid/get-access-token (REST API)
7. REST API exchanges public_token โ†’ access_token (stored in user meta)
8. Customer selects their bank account from the list Plaid returns
9. Customer submits checkout
10. WC_Scottsdale_ACH_Gateway::process_payment() calls iTransact API
11. iTransact submits ACH debit, returns transaction ID
12. Order status set to wc-pending-ach
13. Kount Pre-Auth runs; ENS callback updates order if approved
14. suma-woo-emails sends "Pending ACH" email to customer

Admin Configurationโ€‹

WooCommerce โ†’ Settings โ†’ Payments โ†’ Scottsdale ACH Gateway

SettingDescription
TitleGateway title shown at checkout
DescriptionDescription shown at checkout
ModeSandbox or Live (iTransact API mode)
DebugEnable debug logging

Key Methodsโ€‹

MethodDescription
payment_fields()Renders the Plaid Link button and existing account dropdown at checkout
enqueue_scripts()Loads Plaid SDK and gateway JS on checkout page
process_payment( $order_id )Processes the ACH payment via iTransact, returns redirect
get_admin_form_fields()Returns the admin settings field definitions

Deposit Gateway (WC_Scottsdale_Deposit_Gateway)โ€‹

Gateway ID: scottsdale-deposit-gateway Extends: WC_Gateway_CC_AngellEYE (PayPal PPCP credit card) Title: "Deposit Gateway - Scottsdale"

Purposeโ€‹

When a customer pays via bank wire transfer, Scottsdale Mint requires a 5% deposit to secure the order. This deposit is collected via credit card through the deposit gateway.

How the Deposit Flow Worksโ€‹

1. Customer selects "Bank Wire Transfer" at checkout
2. Deposit Gateway is presented instead of full CC payment
3. Customer enters credit card details (5% of order total is charged)
4. Kount Pre-Auth runs on the deposit transaction
5. Kount ENS callback: approved โ†’ order moves to wc-partially-paid
6. Customer receives confirmation email with bank wire instructions
7. Customer sends bank wire for remaining 95%
8. Admin confirms bank wire received โ†’ order moves to processing

Configurationโ€‹

Only loaded when the WC_Gateway_CC_AngellEYE PayPal PPCP extension is available. The System class checks for this dependency before registering the gateway.


Plaid API Client (\Scottsdale\ACH_Gateway\PlaidApi)โ€‹

Wraps Plaid's API for bank account authentication.

Key Methodsโ€‹

MethodDescription
get_link_token()Creates a Plaid Link token for the checkout UI
get_access_token( $public_token )Exchanges a Plaid public_token for a persistent access_token
get_accounts( $access_token )Returns list of bank accounts for the authenticated user

Data Storageโ€‹

Plaid tokens are stored in user meta (logged-in users) or WooCommerce session (guests):

Meta KeyDescription
plaid_access_tokenPersistent Plaid access token for the user's bank
plaid_selected_institutionName of the bank institution
plaid_selected_accountSelected account details (last 4 digits, type)

iTransact API Client (\Scottsdale\ACH_Gateway\ITransactApi)โ€‹

Handles ACH payment submission to the iTransact payment processor.

Mode: Configurable (sandbox / live) via gateway admin settings.

The iTransact gateway is specialized for precious metals dealers and provides:

  • ACH debit processing
  • Precious metals industry risk management
  • Industry-specific fraud screening in addition to Kount

REST API Endpointsโ€‹

Registered via \Scottsdale\ACH_Gateway\API using rest_api_init.

POST /wp-json/plaid/get-access-tokenโ€‹

Exchanges a Plaid public_token (generated client-side by Plaid Link) for a server-side access_token.

Authentication: WP nonce (rendered in page footer by Frontend::render_api_nonce())

Request body:

{
"public_token": "public-sandbox-abc123...",
"institution_name": "Wells Fargo",
"account_id": "xyz789"
}

Response:

{
"success": true,
"accounts": [
{ "id": "xyz789", "name": "Checking โ€ขโ€ขโ€ขโ€ข 4321", "type": "depository" }
]
}

POST /wp-json/plaid/remove-accountโ€‹

Removes a saved Plaid bank account from user meta.

Authentication: WP nonce

Request body:

{
"account_id": "xyz789"
}

WordPress Hooks Registeredโ€‹

HookClass::MethodPriorityDescription
plugins_loadedSystem::init()1001Initialize the plugin after all plugins are loaded
woocommerce_payment_gatewaysSystem::add_gateway()1100Register ACH and deposit gateways with WooCommerce
wp_footerFrontend::render_api_nonce()5Output API nonce for REST calls
woocommerce_checkout_update_user_metaFrontend::maybe_copy_payment_data_to_user_meta()10Persist Plaid selections to user meta
rest_api_initAPI::register_routes()โ€”Register Plaid REST routes
wp_enqueue_scriptsGateway::enqueue_scripts()99Load Plaid SDK on checkout
admin_initAdmin::enqueue_assets()โ€”Load admin CSS/JS

Dependenciesโ€‹

DependencyTypeRequired
Plaid API credentialsExternal APIYes (configured in WC gateway settings)
iTransact API credentialsExternal APIYes (configured in WC gateway settings)
WC_Gateway_CC_AngellEYEWooCommerce payment classFor deposit gateway only
Plaid Link SDKCDN scriptLoaded on checkout: https://cdn.plaid.com/link/v2/stable/link-initialize.js