Skip to content

Payment Methods & Card Vaulting Module Documentation

5 min readUpdated: Sep 26, 2026
View as Markdown

Module Code: billing/client/cards
Route: /portal/cards
Backend Service: clientService.ts (ring2all-billing-api)
Database Table: payment_methods
Brand Purity: 100% White-Label Compliant (Ring2All Billing)


  1. Executive Summary & PCI-DSS Scope Reduction
  2. Technical Architecture & Tokenization Pipeline
  3. 🎯 User Roles & Key Capabilities
  4. Visual Interface & Screen Breakdown
  5. Card Lifecycle Management & Default Routing
  6. Stripe Elements Client Tokenization
  7. Database Schema & Data Dictionary
  8. Diagnostic CLI & Operational Playbooks
  9. Domain Glossary

The Payment Methods & Card Vaulting module enables customers to securely store, update, and manage multiple credit/debit cards for automated subscription renewals and on-demand wallet refills without exposing raw card numbers to Ring2All servers.

+-------------------------------------------------------------------------------+
| COMMERCIAL & OPERATIONAL IMPACT |
+-------------------------------------------------------------------------------+
| β€’ Zero PCI Scope for Telecom Provider: Raw PANs and CVVs never touch or |
| traverse Ring2All backend servers; tokenization occurs in Stripe's vault. |
| β€’ Churn Reduction: Customers independently replace expiring or stolen cards |
| before monthly plan subscription renewals fail. |
| β€’ One-Click Checkout: Default card designation enables friction-free top-ups |
| and instant invoice payments across the entire portal. |
| β€’ Complete Cardholder Security: Visual card displays are strictly limited to |
| card brand, last 4 digits, and expiration dates. |
+-------------------------------------------------------------------------------+

When a customer registers a payment card, the client portal communicates directly with Stripe Elements to create a tokenized PaymentMethod ID (pm_...), which is then safely linked to the customer’s account:

β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”
β”‚ Client Web Browser (Portal UI) β”‚
β”‚ Route: /portal/cards β”‚
β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”¬β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”¬β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜
β”‚ β”‚
1. Raw Card β”‚ Direct HTTPS β”‚ 3. Vaulted Token
Data β–Ό β”‚ (pm_1N2e3f...)
β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β” β”‚
β”‚ Stripe Tokenization Engine β”‚ β”‚
β”‚ β€’ Validates CVV & Expiration β”‚ β”‚
β”‚ β€’ Issues Opaque Token ID β”‚ β”‚
β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”¬β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜ β”‚
β”‚ 2. Return Token β–Ό
└────────────────► β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”
β”‚ Ring2All Billing Core API β”‚
β”‚ POST /api/client/payment-methodsβ”‚
β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”¬β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜
β”‚ 4. Store Safe Metadata
β–Ό
β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”
β”‚ PostgreSQL 17 (payment_methods) β”‚
β”‚ β€’ brand: 'visa' β”‚
β”‚ β€’ last4: '4242' β”‚
β”‚ β€’ exp_year: 2028 β”‚
β”‚ β€’ gateway_method_id: 'pm_...' β”‚
β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜

Access to stored payment methods is strictly restricted:

User Role Access Level Primary Operational Capabilities
Enterprise Account Owner Full Access Adds new company payment cards, toggles default billing card, removes outdated cards.
Accounts Payable Manager Card Management Verifies card expiration dates, updates billing addresses, monitors failed transaction alerts.
Billing & Finance Auditor Read-Only Audit Verifies vaulted payment method count and default gateway configurations.

The cards interface provides a clean cardholder dashboard:

Vaulted Payment Methods Inventory

  • Card Brand Badges: Visual iconography representing Visa, Mastercard, American Express, or Discover.
  • Masked Display: Masked card representation (β€’β€’β€’β€’ β€’β€’β€’β€’ β€’β€’β€’β€’ 4242) ensuring complete privacy.
  • Expiration Date: Prominent display of valid month and year (Exp: 12/2028).
  • Default Card Star: Visual indicator badge designating the card used for automated plan sweeps.
  • Management Controls: Options to make default or permanently remove vaulted cards.

Clicking Add Payment Method opens the secure tokenization form:

Add Vaulted Payment Method Modal

  • Cardholder Name: Full legal billing name matching the issuing bank account.
  • Card Details: Hosted iframe fields capturing card number, expiration date, and CVC security code.
  • Set as Default Toggle: Checkbox automatically configuring the new card as primary for recurring charges.

The portal enforces deterministic rules for stored cards:

  1. Single Default Enforceability: Only one card can be flagged as is_default = true per customer. Setting a new default card automatically updates previous cards in an atomic transaction.
  2. Deletion Safeguards: Customers cannot delete a payment method if it is currently the sole active card on an account with an active recurring subscription plan.
  3. Automatic Expiry Tracking: Cards nearing expiration trigger portal banner warnings 30 days prior to month end.

Under PCI-DSS SAQ-A compliance:

  • The web application uses Stripe Elements iframe injection.
  • Keystrokes for the 16-digit Primary Account Number (PAN) and 3-digit Card Verification Value (CVV) are captured directly by Stripe’s encrypted infrastructure.
  • Ring2All servers never log, cache, or process raw credit card numbers.

CREATE TABLE public.payment_methods (
id BIGSERIAL PRIMARY KEY,
uuid UUID NOT NULL DEFAULT gen_random_uuid(),
customer_id BIGINT NOT NULL REFERENCES customers(id) ON DELETE CASCADE,
gateway VARCHAR(30) NOT NULL DEFAULT 'stripe',
gateway_method_id VARCHAR(100) NOT NULL,
type VARCHAR(30) NOT NULL DEFAULT 'card',
brand VARCHAR(30),
last4 VARCHAR(4),
exp_month INTEGER,
exp_year INTEGER,
is_default BOOLEAN NOT NULL DEFAULT false,
created_at TIMESTAMPTZ NOT NULL DEFAULT NOW(),
updated_at TIMESTAMPTZ NOT NULL DEFAULT NOW()
);
-- Partial index ensuring fast default card resolution
CREATE INDEX idx_payment_methods_default ON payment_methods (customer_id) WHERE is_default = true;

Terminal window
su - postgres -c "psql -d ss_billing -c \"
SELECT brand, last4, exp_month, exp_year, is_default, gateway_method_id
FROM payment_methods
WHERE customer_id = 5;
\""

  • Gateway Method ID: Opaque token (e.g. pm_1N2e...) representing an authorized payment instrument.
  • PCI-DSS SAQ-A: Payment Card Industry Self-Assessment Questionnaire A for merchants who outsource all cardholder data functions.
  • PAN (Primary Account Number): The 15 or 16-digit card number embossed on physical payment cards.