Skip to main content

Real World: Banking FTP Integration

This guide covers integrating NetSuite with bank SFTP systems for payment file processing, including IP whitelisting requirements and ACK1/ACK2 acknowledgment patterns.


Overview

Banking SFTP integration is one of the most common middleware patterns in enterprise environments. Banks typically require:

  • Static IP whitelisting for security compliance
  • ACK files to confirm file receipt and processing status
  • Specific file formats unique to each bank

Architecture Options

Two main approaches depending on whether NetSuite IP is whitelisted by the bank:

SCENARIO A: Full VPS Middleware (NetSuite IP NOT whitelisted)
─────────────────────────────────────────────────────────────────
NetSuite → VPS (Static IP) → Bank SFTP
VPS polls bank for ACK files
NetSuite polls VPS for ACK files

SCENARIO B: Hybrid - Direct Upload + VPS ACK Bridge (NetSuite IP whitelisted)
─────────────────────────────────────────────────────────────────
NetSuite → Bank SFTP (direct)
VPS polls bank for ACK files
NetSuite polls VPS for ACK files

Why VPS Middleware for Banking?

ChallengeSolution
Bank requires static IP whitelistVPS has static IP (e.g., 203.0.113.50)
NetSuite IPs are dynamicNetSuite uploads to VPS, VPS uploads to bank
Bank uses legacy SFTP onlyVPS handles SFTP with proper authentication
ACK files need pollingCron jobs on VPS poll bank periodically
Security complianceVPS in controlled environment with audit logs

ACK1/ACK2 File Pattern

PAYMENT FILE LIFECYCLE
─────────────────────────────────────────────────────────────────

File Naming Convention:
PAYMENT_[BATCHID]_[YYYYMMDD]_[SEQ].txt ← Payment instruction
PAYMENT_[BATCHID]_[YYYYMMDD]_[SEQ].ACK1 ← File received by bank
PAYMENT_[BATCHID]_[YYYYMMDD]_[SEQ].ACK2 ← Processing result

Example:
PAYMENT_BATCH001_20240115_001.txt
PAYMENT_BATCH001_20240115_001.ACK1
PAYMENT_BATCH001_20240115_001.ACK2

Timeline:
─────────────────────────────────────────────────────────────────
T+0 T+5min T+2hours
│ │ │
▼ ▼ ▼
Upload ACK1 ACK2
(.txt) (Received) (Processed/Rejected)
StageFile ExtensionContentTiming
Payment Instruction.txtPayment details (bank format)Immediate
ACK1 (Acknowledgment 1).ACK1File received confirmation1-30 minutes
ACK2 (Acknowledgment 2).ACK2Processing result with status codes1-24 hours

Scenario A: Full VPS Middleware

Use when: NetSuite IP is NOT whitelisted by the bank.

FULL VPS MIDDLEWARE ARCHITECTURE
─────────────────────────────────────────────────────────────────

NetSuite VPS Middleware Bank SFTP
(Dynamic IP) (Static IP: 203.0.113.50) (Firewall)
Can't connect Whitelisted by Bank Only allows
directly whitelisted IPs
│ │ │
│ │ │
│ 1. Generate Payment │ │
│ Instruction File │ │
│ │ │
│ 2. SFTP Upload to VPS │ │
│ ─────────────────────────▶│ │
│ /incoming/ │ │
│ │ 3. Cron: Upload to Bank │
│ │ ────────────────────────▶│
│ │ /outgoing/ │
│ │ │
│ │ │ Bank processes
│ │ │ (minutes to hours)
│ │ │
│ │ 4. Cron: Poll for ACK1 │
│ │◀──────────────────────── │
│ │ PAYMENT_001.ACK1 │
│ │ │
│ 5. Scheduled Script │ │
│ Poll VPS for ACK │ │
│◀───────────────────────── │ │
│ /ack/ │ │
│ │ │
│ 6. Update Payment │ 7. Cron: Poll for ACK2 │
│ Status: ACK1_RECEIVED │◀──────────────────────── │
│ │ PAYMENT_001.ACK2 │
│ │ │
│ 8. Poll VPS for ACK2 │ │
│◀───────────────────────── │ │
│ │ │
│ 9. Update Payment │ │
│ Status: COMPLETED │ │
│ or REJECTED │ │

VPS Directory Structure

/opt/bank-integration/
├── bin/
│ ├── upload_to_bank.sh # Upload payment files to bank
│ ├── download_ack.sh # Download ACK files from bank
│ └── cleanup_old_files.sh # Archive old files
├── config/
│ └── bank_sftp.conf # Bank SFTP credentials
├── data/
│ ├── incoming/ # Files from NetSuite (to upload)
│ ├── outgoing/ # Uploaded to bank (waiting ACK)
│ ├── ack/ # ACK files for NetSuite to fetch
│ ├── processed/ # Completed files (archive)
│ └── failed/ # Failed files for investigation
├── logs/
│ └── integration.log # All activity logs
└── keys/
└── bank_sftp_key # SSH private key for bank SFTP

VPS Cron Jobs

ScheduleScriptPurpose
Every 5 minupload_to_bank.shUpload payment files to bank
Every 10 mindownload_ack.shDownload ACK files from bank
Daily midnightcleanup_old_files.shArchive old files

Scenario B: Hybrid - Direct Upload + VPS ACK Bridge

Use when: Bank allows NetSuite direct SFTP connection for uploads (NetSuite IP whitelisted), but ACK files need VPS bridge because NetSuite can't poll bank frequently enough.

HYBRID ARCHITECTURE - DIRECT UPLOAD + VPS ACK BRIDGE
─────────────────────────────────────────────────────────────────

NetSuite VPS Middleware Bank SFTP
(IP Whitelisted) (Static IP) (Firewall)
│ │ │
│ 1. Generate Payment │ │
│ Instruction File │ │
│ │ │
│ 2. SFTP Upload DIRECT to Bank ─────────────────────▶│
│ (NetSuite IP whitelisted) /outgoing/ │
│ │ │
│ │ │ Bank processes
│ │ │ (minutes to hours)
│ │ │
│ │ 3. Cron: Poll for ACK │
│ │◀──────────────────────── │
│ │ /ack/ │
│ │ │
│ │ 4. Copy ACK to VPS │
│ │ /data/ack/ │
│ │ │
│ 5. Scheduled Script │ │
│ Poll VPS for ACK │ │
│◀───────────────────────── │ │
│ │ │
│ 6. Move processed ACK │ │
│ to /data/arch/ │ │
│ ─────────────────────────▶│ │
│ │ │
│ 7. Update Payment │ │
│ Status in NetSuite │ │

Why This Hybrid Approach?

AdvantageDescription
Lower latencyNetSuite uploads directly to bank (no VPS hop)
Reduced VPS loadVPS only handles small ACK files
Bank complianceBank still controls ACK file access
Reliable pollingVPS cron provides consistent ACK polling

VPS Directory Structure (Simplified)

/opt/bank-integration/
├── bin/
│ ├── download_ack.sh # Poll bank for ACK files
│ └── cleanup_arch.sh # Archive old ACK files
├── config/
│ └── bank_sftp.conf # Bank SFTP credentials
├── data/
│ ├── ack/ # Fresh ACK files for NetSuite
│ └── arch/ # Processed ACK files (archive)
└── logs/
└── ack_poll.log # ACK polling logs

NetSuite Custom Record: Payment Batch

Create custom record customrecord_payment_batch:

Field IDTypePurpose
custrecord_pb_batch_idTextUnique batch identifier
custrecord_pb_filenameTextGenerated filename
custrecord_pb_file_contentLong TextPayment file content
custrecord_pb_statusListPENDING, UPLOADED, ACK1_RECEIVED, ACK2_RECEIVED, COMPLETED, REJECTED, FAILED
custrecord_pb_upload_dateDate/TimeWhen uploaded to VPS
custrecord_pb_ack1_dateDate/TimeWhen ACK1 received
custrecord_pb_ack2_dateDate/TimeWhen ACK2 received
custrecord_pb_ack2_codeTextBank response code from ACK2
custrecord_pb_errorLong TextError message if failed

Status Flow Diagram

PAYMENT BATCH STATUS FLOW
─────────────────────────────────────────────────────────────────

┌─────────┐
│ PENDING │ ← Created, not yet uploaded
└────┬────┘
│ Upload to VPS successful

┌──────────┐
│ UPLOADED │ ← File on VPS, waiting for bank ACK
└────┬─────┘

┌────┴────────────────────────────────┐
│ │
▼ ▼
┌──────────────┐ ┌────────────┐
│ ACK1_RECEIVED│ ← Bank received │ FAILED │ ← Upload/Connection error
└──────┬───────┘ the file └────────────┘

│ Bank processes (1-24 hours)

┌──────────────┐
│ ACK2_RECEIVED│ ← Bank finished processing
└──────┬───────┘

┌────┴────┐
│ │
▼ ▼
┌─────────┐ ┌──────────┐
│COMPLETED│ │ REJECTED │ ← Bank rejected (bad data, etc)
└─────────┘ └──────────┘

Comparison: Full VPS vs Hybrid

AspectFull VPS (Scenario A)Hybrid (Scenario B)
Payment upload pathNetSuite → VPS → BankNetSuite → Bank (direct)
ACK retrieval pathBank → VPS → NetSuiteBank → VPS → NetSuite
VPS responsibilityFull file relayACK bridge only
LatencyHigher (2 hops)Lower (1 hop for upload)
VPS disk usageHigherLower
ComplexityMediumMedium
Best forNetSuite IP not whitelistedNetSuite IP whitelisted by bank

Decision Guide

CHOOSING BETWEEN FULL VPS AND HYBRID
─────────────────────────────────────────────────────────────────

Is NetSuite IP whitelisted by bank?

├── No ──▶ Use Scenario A (Full VPS)
│ NetSuite cannot connect to bank directly

└── Yes ──▶ Use Scenario B (Hybrid)
NetSuite uploads direct, VPS bridges ACK files

VPS Setup Checklist

StepAction
1Provision VPS with static IP (AWS, DigitalOcean, Linode, etc.)
2Provide IP to bank for whitelisting
3Configure VPS firewall (allow SSH from office, SFTP from NetSuite)
4Install openssh-sftp-server
5Create integration user and directories
6Generate SSH key for bank SFTP connection
7Deploy bash scripts to /opt/bank-integration/bin/
8Configure cron jobs
9Test connectivity to bank SFTP
10Set up monitoring and alerting

Troubleshooting

IssueCheckSolution
Upload failsVPS disk spaceClean up old files
Bank rejects connectionIP whitelistVerify VPS IP with bank
ACK files not appearingBank processing timeWait, check bank status
Status file emptyCron not runningCheck systemctl status cron
Permission deniedFile ownershipchown bankint:bankint /opt/...
SFTP timeoutNetwork/firewallCheck VPS firewall rules