Quick Reference: Switching Customer from Credit Card to PO

The Problem

Customer called and you switched them to PO/Invoice, but they're still being auto-charged and getting decline errors.

Why This Happens

The RecurringCardChargeJob only looks at the ORDER's payment_method field, not company settings or invoices sent.

The Fix (3 Steps)

1. Quick Manual Fix (Production)

ssh root@5.78.141.175 'docker exec $(docker ps --filter label=service=quarry_rentals --filter label=role=web --format "{{.Names}}" | head -1) bin/rails runner "
o = Order.find(ORDER_ID)
o.payment_method = \"purchase_order\"
o.payment_terms = \"net_30\"
o.payment_profile_id = nil
o.payment_status = \"unpaid\"
o.save!
puts \"Order switched to PO - auto-charging stopped\"
"'

2. Using the Script (Cleaner)

# Copy script to server first
scp scripts/switch_order_to_po.rb root@5.78.141.175:/tmp/

# Run it
ssh root@5.78.141.175 'docker exec $(docker ps --filter label=service=quarry_rentals --filter label=role=web --format "{{.Names}}" | head -1) bin/rails runner /tmp/switch_order_to_po.rb ORDER_ID net_30'

3. Verify It Worked

ssh root@5.78.141.175 'docker exec $(docker ps --filter label=service=quarry_rentals --filter label=role=web --format "{{.Names}}" | head -1) bin/rails runner "
o = Order.find(ORDER_ID)
puts \"payment_method: #{o.payment_method}\"
puts \"Auto-charge: #{o.payment_method == \"credit_card\" ? \"YES\" : \"NO\"}\"
"'

What Gets Changed

Payment Terms Options

Result

✓ Daily auto-charge attempts STOP immediately ✓ Decline emails STOP ✓ Customer receives invoices instead ✓ You track payment manually

Common Mistake

❌ Only updating company settings or sending invoice ✅ Must update the ORDER's payment_method field

Files Created